Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to clean up each test dir #146

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading