summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2015-05-29 15:44:21 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2015-06-06 15:15:53 +0200
commitae83a81ad6b6185f5b754c1819cb78399da86d84 (patch)
treee3c9621017675458bae8d94a782c32b41be0e3ba
parentdcaaa980dc59202744bb3888d9662f9a7558cdf6 (diff)
downloadhaskell-ae83a81ad6b6185f5b754c1819cb78399da86d84.tar.gz
Testsuite: only show output diff when test is expected to pass
Don't let the output of tests that either have missing libraries or are expected to be broken obscure real failures. This makes it easier to analyse the testlogs. The only consequence is that when a test fails because a certain library isn't installed, you have to check the all.T file in which the test is defined to actually find out _which_ library that is. Before it would print something like Compile failed (status 256) errors were: stm052.hs:10:8: error: Could not find module ‘System.Random’ Use -v to see a list of the files searched for. And now it doesn't. I think this is an acceptable tradeoff. Differential Revision: https://phabricator.haskell.org/D945
-rw-r--r--testsuite/driver/testlib.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index dbae8d7c79..63b42e8bb1 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -168,6 +168,11 @@ def record_broken(name, opts, bug):
if not me in brokens:
brokens.append(me)
+def _expect_pass(way):
+ # Helper function. Not intended for use in .T files.
+ opts = getTestOpts()
+ return opts.expect == 'pass' and way not in opts.expect_fail_for
+
# -----
def omit_ways( ways ):
@@ -817,8 +822,7 @@ def do_test(name, way, func, args):
passFail = 'No passFail found'
if passFail == 'pass':
- if getTestOpts().expect == 'pass' \
- and way not in getTestOpts().expect_fail_for:
+ if _expect_pass(way):
t.n_expected_passes = t.n_expected_passes + 1
if name in t.expected_passes:
t.expected_passes[name].append(way)
@@ -829,8 +833,7 @@ def do_test(name, way, func, args):
t.n_unexpected_passes = t.n_unexpected_passes + 1
addPassingTestInfo(t.unexpected_passes, getTestOpts().testdir, name, way)
elif passFail == 'fail':
- if getTestOpts().expect == 'pass' \
- and way not in getTestOpts().expect_fail_for:
+ if _expect_pass(way):
reason = result['reason']
tag = result.get('tag')
if tag == 'stat':
@@ -1248,8 +1251,9 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
if result != 0 and not should_fail:
actual_stderr = qualify(name, 'comp.stderr')
- if_verbose(1,'Compile failed (status ' + repr(result) + ') errors were:')
- if_verbose_dump(1,actual_stderr)
+ if config.verbose >= 1 and _expect_pass(way):
+ print('Compile failed (status ' + repr(result) + ') errors were:')
+ if_verbose_dump(1, actual_stderr)
# ToDo: if the sub-shell was killed by ^C, then exit
@@ -1332,9 +1336,10 @@ def simple_run( name, way, prog, args ):
# check the exit code
if exit_code != opts.exit_code:
- print('Wrong exit code (expected', opts.exit_code, ', actual', exit_code, ')')
- dump_stdout(name)
- dump_stderr(name)
+ if config.verbose >= 1 and _expect_pass(way):
+ print('Wrong exit code (expected', opts.exit_code, ', actual', exit_code, ')')
+ dump_stdout(name)
+ dump_stderr(name)
return failBecause('bad exit code')
check_hp = my_rts_flags.find("-h") != -1
@@ -1643,7 +1648,8 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file):
if expected_str == actual_str:
return 1
else:
- if_verbose(1, 'Actual ' + kind + ' output differs from expected:')
+ if config.verbose >= 1 and _expect_pass(way):
+ print('Actual ' + kind + ' output differs from expected:')
if expected_file_for_diff == '/dev/null':
expected_normalised_file = '/dev/null'
@@ -1662,7 +1668,7 @@ def compare_outputs(way, kind, normaliser, expected_file, actual_file):
# (including newlines) so the diff would be hard to read.
# This does mean that the diff might contain changes that
# would be normalised away.
- if (config.verbose >= 1):
+ if config.verbose >= 1 and _expect_pass(way):
r = os.system( 'diff -uw ' + expected_file_for_diff + \
' ' + actual_file )