Skip to content

Commit

Permalink
Merge pull request #146 from EZoni/EZoni_rm_testdir
Browse files Browse the repository at this point in the history
Add option to clean up each test dir
  • Loading branch information
zingale authored Aug 12, 2024
2 parents 21c052c + 715ea85 commit 4789924
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions regtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,20 @@ def test_suite(argv):
suite.log.log("creating problem test report ...")
report.report_single_test(suite, test, test_list)

#----------------------------------------------------------------------
# if test ran and passed, remove test directory if requested
#----------------------------------------------------------------------
test_successful = (test.return_code == 0 and test.analysis_successful and test.compare_successful)
if (test.ignore_return_code == 1 or test_successful):
if args.clean_testdir:
suite.log.log("removing subdirectories from test directory...")
for file_name in os.listdir(output_dir):
file_path = os.path.join(output_dir, file_name)
if os.path.isdir(file_path):
shutil.rmtree(file_path)
# switch to the full test directory
os.chdir(suite.full_test_dir)

#--------------------------------------------------------------------------
# Clean Cmake build and install directories if needed
#--------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@ def get_args(arg_string=None):
help="complete report generation from a crashed test suite run named testdir")
suite_options.add_argument("--log_file", type=str, default=None, metavar="logfile",
help="log file to write output to (in addition to stdout")
suite_options.add_argument("--clean_testdir", action="store_true",
help="remove individual test directory after each passed test")

comp_options = parser.add_argument_group("comparison options",
"options that control how the comparisons are done")
Expand Down

0 comments on commit 4789924

Please sign in to comment.