[commit: ghc] wip/testsuite-stdout: WIP: testsuite: Report stdout and stderr (2e3118f)

git at git.haskell.org git at git.haskell.org
Thu Jan 24 19:34:33 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/testsuite-stdout
Link       : http://ghc.haskell.org/trac/ghc/changeset/2e3118f54d0e54a7d8ecd3d20f4c8f7f628ad463/ghc

>---------------------------------------------------------------

commit 2e3118f54d0e54a7d8ecd3d20f4c8f7f628ad463
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Thu Jan 24 14:33:26 2019 -0500

    WIP: testsuite: Report stdout and stderr
    
    I'm having second thoughts about the semantics here; perhaps we actually
    want a diff.


>---------------------------------------------------------------

2e3118f54d0e54a7d8ecd3d20f4c8f7f628ad463
 testsuite/driver/testlib.py  | 9 +++++++--
 testsuite/driver/testutil.py | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 8f76378..431232c 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -942,7 +942,12 @@ def do_test(name, way, func, args, files):
                 t.unexpected_stat_failures.append(TestResult(directory, name, reason, way))
             else:
                 if_verbose(1, '*** unexpected failure for %s' % full_name)
-                t.unexpected_failures.append(TestResult(directory, name, reason, way))
+                other = {
+                    'stdout': result.get('stdout'),
+                    'stderr': result.get('stderr')
+                }
+                result = TestResult(directory, name, reason, way, **other)
+                t.unexpected_failures.append(result)
         else:
             if opts.expect == 'missing-lib':
                 t.missing_libs.append(TestResult(directory, name, 'missing-lib', way))
@@ -1078,7 +1083,7 @@ def do_compile(name, way, should_fail, top_mod, extra_mods, extra_hc_opts, **kwa
                            whitespace_normaliser=getattr(getTestOpts(),
                                                          "whitespace_normaliser",
                                                          normalise_whitespace)):
-        return failBecause('stderr mismatch')
+        return failBecause('stderr mismatch', stderr=open(actual_stderr_file, 'rb').read())
 
     # no problems found, this test passed
     return passed()
diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py
index 6e0c268..888e77b 100644
--- a/testsuite/driver/testutil.py
+++ b/testsuite/driver/testutil.py
@@ -8,8 +8,8 @@ import threading
 def passed():
     return {'passFail': 'pass'}
 
-def failBecause(reason, tag=None):
-    return {'passFail': 'fail', 'reason': reason, 'tag': tag}
+def failBecause(reason, tag=None, **kwargs):
+    return kwargs.update({'passFail': 'fail', 'reason': reason, 'tag': tag})
 
 def strip_quotes(s):
     # Don't wrap commands to subprocess.call/Popen in quotes.



More information about the ghc-commits mailing list