diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-11-06 15:54:27 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-11-10 21:10:30 -0500 |
commit | 049d9ae08821fbfcadb2be708f57143ec0efd73b (patch) | |
tree | a7d56a38a4fce3ff1a781e24f13b74f479502eaf | |
parent | 3e07ea8d120ba4c177341a7e4d2e73fa696a103a (diff) | |
download | haskell-049d9ae08821fbfcadb2be708f57143ec0efd73b.tar.gz |
testsuite: Don't check_stats at runtime if not requestedwip/T17387
Previously we would call check_stats to check the runtime metrics even
if the test definition hadn't requested it. This would result in an
error since the .stats file doesn't exist.
-rw-r--r-- | testsuite/driver/testlib.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index f6bea5b5c5..35bb4ad32e 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -1567,19 +1567,20 @@ def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: str) -> my_rts_flags = rts_flags(way) - # Collect stats if necessary: + # Collect runtime stats if necessary: # isStatsTest and not isCompilerStatsTest(): # assume we are running a ghc compiled program. Collect stats. # isStatsTest and way == 'ghci': # assume we are running a program via ghci. Collect stats - stats_file = name + '.stats' + stats_file = None # type: Optional[str] if isStatsTest() and (not isCompilerStatsTest() or way == 'ghci'): + stats_file = name + '.stats' stats_args = ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS' else: stats_args = '' # Put extra_run_opts last: extra_run_opts('+RTS foo') should work. - cmd = prog + stats_args + ' ' + my_rts_flags + ' ' + extra_run_opts + cmd = ' '.join([prog, stats_args, my_rts_flags, extra_run_opts]) if opts.cmd_wrapper is not None: cmd = opts.cmd_wrapper(cmd) @@ -1615,7 +1616,11 @@ def simple_run(name: TestName, way: WayName, prog: str, extra_run_opts: str) -> if check_prof and not check_prof_ok(name, way): return failBecause('bad profile') - return check_stats(name, way, in_testdir(stats_file), opts.stats_range_fields) + # Check runtime stats if desired. + if stats_file is not None: + return check_stats(name, way, in_testdir(stats_file), opts.stats_range_fields) + else: + return passed() def rts_flags(way: WayName) -> str: args = config.way_rts_flags.get(way, []) |