Skip to content

Commit db67b6b

Browse files
committed
Fail loudly if new benchmark has no output.
When --make_benchmarks is on, a misconfigured / buggy test program might fail to produce any output. If this happens, the regression testing script will continue executing and eventually crash when it can't find the .status file that it is expecting to be there. This produces an unintuitive backtrace that does not make clear the root cause of the problem. This PR fixes the above by failing with a clear error message as soon as it can be determined that output from the test program cannot be found.
1 parent 93ddfb1 commit db67b6b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

regtest.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ def find_build_dirs(tests):
4848
last_safe = False
4949

5050
for obj in tests:
51-
51+
5252
# keep track of the build directory and which source tree it is
5353
# in (e.g. the extra build dir)
54-
54+
5555
# first find the list of unique build directories
5656
dir_pair = (obj.buildDir, obj.extra_build_dir)
5757
if build_dirs.count(dir_pair) == 0:
5858
build_dirs.append(dir_pair)
59-
59+
6060
# re-make all problems that specify an extra compile argument,
6161
# and the test that comes after, just to make sure that any
6262
# unique build commands are seen.
@@ -66,9 +66,9 @@ def find_build_dirs(tests):
6666
obj.reClean = 0
6767
else:
6868
last_safe = True
69-
69+
7070
return build_dirs
71-
71+
7272
def cmake_setup(suite):
7373
"Setup for cmake"
7474

@@ -1177,11 +1177,14 @@ def test_suite(argv):
11771177
# archive (or delete) the output
11781178
#----------------------------------------------------------------------
11791179
suite.log.log("archiving the output...")
1180+
match_count = 0
11801181
for pfile in os.listdir(output_dir):
11811182

11821183
if (os.path.isdir(pfile) and
11831184
re.match(f"{test.name}.*_(plt|chk)[0-9]+", pfile)):
11841185

1186+
match_count += 1
1187+
11851188
if suite.purge_output == 1 and not pfile == output_file:
11861189

11871190
# delete the plt/chk file
@@ -1206,6 +1209,9 @@ def test_suite(argv):
12061209
except OSError:
12071210
suite.log.warn(f"unable to remove {pfile}")
12081211

1212+
if (match_count == 0):
1213+
suite.log.fail("ERROR: test output could not be found!")
1214+
12091215

12101216
#----------------------------------------------------------------------
12111217
# write the report for this test

0 commit comments

Comments
 (0)