Tests: Add VtOs.system

This commit is contained in:
Wilson Snyder
2026-09-19 21:31:14 -04:00
parent 8c6dd7a164
commit 3444d57929
+12 -5
View File
@@ -120,6 +120,13 @@ class VtOs:
sys.exit("%Error: command failed '" + command + "':\n" + proc.stderr + proc.stdout)
return str(proc.stdout)
@staticmethod
def system(command: str, debug=None) -> None:
"""Run os.system, optionally showing command printed"""
if Args.verbose or debug:
print("\t" + command)
os.system(command)
@staticmethod
def unlink_ok(filename: str) -> None:
"""Unlink a file, no error if fails"""
@@ -1085,17 +1092,17 @@ class VlTest:
def clean(self, for_rerun=False) -> None:
"""Called on a --driver-clean or rerun to cleanup files."""
if self.clean_command:
os.system(self.clean_command)
os.system('/bin/rm -rf ' + self.obj_dir + '__fail1')
VtOs.system(self.clean_command)
VtOs.system('/bin/rm -rf ' + self.obj_dir + '__fail1')
if for_rerun:
# Prevents false-failures when switching compilers
# Remove old results to force hard rebuild
os.system('/bin/mv ' + self.obj_dir + ' ' + self.obj_dir + '__fail1')
VtOs.system('/bin/mv ' + self.obj_dir + ' ' + self.obj_dir + '__fail1')
else:
os.system('/bin/rm -rf ' + self.obj_dir)
VtOs.system('/bin/rm -rf ' + self.obj_dir)
def clean_objs(self) -> None:
os.system("/bin/rm -rf " + ' '.join(glob.glob(self.obj_dir + "/*")))
VtOs.system("/bin/rm -rf " + ' '.join(glob.glob(self.obj_dir + "/*")))
def _checkflags(self, param):
checkflags = (