Skip to content

Commit e9a20b8

Browse files
committed
delete compressed plotfiles, executable
1 parent 4789924 commit e9a20b8

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

regtest.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ def test_suite(argv):
11801180
#----------------------------------------------------------------------
11811181
suite.log.log("archiving the output...")
11821182
match_count = 0
1183+
archived_file_list = []
11831184
for pfile in os.listdir(output_dir):
11841185

11851186
if (os.path.isdir(pfile) and
@@ -1198,9 +1199,11 @@ def test_suite(argv):
11981199
elif suite.archive_output == 1:
11991200
# tar it up
12001201
try:
1201-
tar = tarfile.open(f"{pfile}.tgz", "w:gz")
1202+
tarfilename = f"{pfile}.tgz"
1203+
tar = tarfile.open(tarfilename, "w:gz")
12021204
tar.add(f"{pfile}")
12031205
tar.close()
1206+
archived_file_list.append(tarfilename)
12041207

12051208
except:
12061209
suite.log.warn(f"unable to tar output file {pfile}")
@@ -1228,11 +1231,23 @@ def test_suite(argv):
12281231
test_successful = (test.return_code == 0 and test.analysis_successful and test.compare_successful)
12291232
if (test.ignore_return_code == 1 or test_successful):
12301233
if args.clean_testdir:
1234+
# remove subdirectories
12311235
suite.log.log("removing subdirectories from test directory...")
12321236
for file_name in os.listdir(output_dir):
12331237
file_path = os.path.join(output_dir, file_name)
12341238
if os.path.isdir(file_path):
12351239
shutil.rmtree(file_path)
1240+
1241+
# remove archived plotfiles
1242+
suite.log.log("removing compressed plotfiles from test directory...")
1243+
for file_name in archived_file_list:
1244+
file_path = os.path.join(output_dir, file_name)
1245+
os.remove(file_path)
1246+
1247+
# delete executable
1248+
suite.log.log("removing executable from test directory...")
1249+
os.remove(executable)
1250+
12361251
# switch to the full test directory
12371252
os.chdir(suite.full_test_dir)
12381253

0 commit comments

Comments
 (0)