diff options
author | Ian Lynagh <igloo@earth.li> | 2011-07-13 17:54:30 +0100 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2011-07-13 17:54:30 +0100 |
commit | e182041fbfc38e97d273469b402c5bb36718c0e4 (patch) | |
tree | c4384d78cd0648e4da77e881f6c4fbcb41f8cfe8 | |
parent | 948c82d8f1f1698f12daf2c4f762abdb67c6804e (diff) | |
download | haskell-e182041fbfc38e97d273469b402c5bb36718c0e4.tar.gz |
Handle missing stderr files
Sometimes, "prog 2> err" won't actually create err on Windows.
-rw-r--r-- | testsuite/driver/testlib.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index c7544723c5..2cac0ef3f8 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -979,7 +979,7 @@ 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 ' + `result` + ') errors were:') - if_verbose(1,open(actual_stderr).read()) + if_verbose_dump(1,actual_stderr) # ToDo: if the sub-shell was killed by ^C, then exit @@ -1241,7 +1241,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): if exit_code != 0: if_verbose(1,'Compiling to External Core failed (status ' + `result` + ') errors were:') - if_verbose(1,open(qerrname).read()) + if_verbose_dump(1,qerrname) return failBecause('ext core exit code non-0') # Compile the resulting files -- if there's more than one module, we need to read the output @@ -1272,7 +1272,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): if exit_code != 0: if_verbose(1,'Compiling External Core file(s) failed (status ' + `result` + ') errors were:') - if_verbose(1,open(qerrname).read()) + if_verbose_dump(1,qerrname) return failBecause('ext core exit code non-0') # Clean up @@ -1468,6 +1468,13 @@ def if_verbose( n, str ): if config.verbose >= n: print str +def if_verbose_dump( n, f ): + if config.verbose >= n: + try: + print open(f).read() + except: + print '' + # Guess flags suitable for the compiler. def guess_compiler_flags(): if config.compiler_type == 'ghc': |