[buildcore] Add test-rerun-verbose target

This commit is contained in:
2021-07-30 19:34:11 -05:00
parent 3e3cfcaf7d
commit 6165f63d09
2 changed files with 15 additions and 7 deletions

View File

@ -31,6 +31,7 @@ def cat(path):
def mkdir(path):
if not os.path.exists(path) and os.path.isdir(path):
os.mkdir(path)
return 0
# this exists because Windows is utterly incapable of providing a proper rm -rf
@ -39,19 +40,22 @@ def rm(path):
os.remove(path)
elif os.path.isdir(path):
shutil.rmtree(path)
return 0
def ctest_verbose(base_path):
def ctest_all():
base_path = sys.argv[2]
if not os.path.isdir(base_path):
# nothing to build
# no generated projects
return 0
args = ['ctest', '--output-on-failure']
args = ['ctest'] + sys.argv[3:]
orig_dir = os.getcwd()
for d in os.listdir(base_path):
os.chdir(os.path.join(orig_dir, base_path, d))
err = subprocess.run(args).returncode
if err != 0:
return err
return 0
def cmake_build(base_path, target):
@ -65,6 +69,7 @@ def cmake_build(base_path, target):
err = subprocess.run(args).returncode
if err != 0:
return err
return 0
def main():
@ -73,8 +78,8 @@ def main():
elif sys.argv[1] == 'rm':
for i in range(2, len(sys.argv)):
rm(sys.argv[i])
elif sys.argv[1] == 'ctest-verbose':
err = ctest_verbose(sys.argv[2])
elif sys.argv[1] == 'ctest-all':
err = ctest_all()
sys.exit(err)
elif sys.argv[1] == 'cmake-build':
err = cmake_build(sys.argv[2], sys.argv[3] if len(sys.argv) > 3 else None)