summaryrefslogtreecommitdiff
path: root/testsuite/driver
diff options
context:
space:
mode:
authorPaolo Capriotti <p.capriotti@gmail.com>2012-04-23 15:07:40 +0100
committerPaolo Capriotti <p.capriotti@gmail.com>2012-04-23 15:36:27 +0100
commitef0d0b70a0546835c32bbfba564b875d8eb023c5 (patch)
treed8a64a1edc28361b33c3a2c9e6c7ee813a222347 /testsuite/driver
parenta7bf4c0148b4c2dc1329eb21c428ca215c75ceab (diff)
downloadhaskell-ef0d0b70a0546835c32bbfba564b875d8eb023c5.tar.gz
Add combined_output option.
Added an option to combine stdout and stderr into a single file. This is useful for ghci scripts that produce interleaved errors and normal output. Also modified check_stderr_ok so that it normalizes stderr in the same way as compile tests.
Diffstat (limited to 'testsuite/driver')
-rw-r--r--testsuite/driver/testglobals.py4
-rw-r--r--testsuite/driver/testlib.py18
2 files changed, 17 insertions, 5 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index d3b566c493..d7e63d1c87 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -144,7 +144,6 @@ def getTestRun():
class TestOptions:
def __init__(self):
-
# if not None then we look for namebase.stderr etc rather than
# using the test name
self.with_namebase = None
@@ -253,6 +252,9 @@ class TestOptions:
# The directory the test is in
self.testdir = '.'
+ # Should we redirect stdout and stderr to a single file?
+ self.combined_output = False
+
# The default set of options
global default_testopts
default_testopts = TestOptions()
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 15b6d4eb66..ee9cc7c077 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -141,6 +141,9 @@ def ignore_output( opts ):
def no_stdin( opts ):
opts.no_stdin = 1
+def combined_output( opts ):
+ opts.combined_output = True
+
# -----
def expect_fail_for( ways ):
@@ -1155,11 +1158,18 @@ def simple_run( name, way, prog, args ):
stdin_comes_from = ''
else:
stdin_comes_from = ' <' + use_stdin
+
+ if opts.combined_output:
+ redirection = ' >' + run_stdout \
+ + ' 2>&1'
+ else:
+ redirection = ' >' + run_stdout \
+ + ' 2>' + run_stderr
+
cmd = prog + ' ' + args + ' ' \
+ my_rts_flags + ' ' \
+ stdin_comes_from \
- + ' >' + run_stdout \
- + ' 2>' + run_stderr
+ + redirection
if getTestOpts().cmd_wrapper != None:
cmd = getTestOpts().cmd_wrapper(cmd);
@@ -1183,7 +1193,7 @@ def simple_run( name, way, prog, args ):
check_prof = my_rts_flags.find("-p") != -1
if not opts.ignore_output:
- if not check_stderr_ok(name):
+ if not opts.combined_output and not check_stderr_ok(name):
return failBecause('bad stderr')
if not check_stdout_ok(name):
return failBecause('bad stdout')
@@ -1445,7 +1455,7 @@ def check_stderr_ok( name ):
if platform_specific:
return str
else:
- return normalise_output(str)
+ return normalise_errmsg(str)
return compare_outputs('stderr', \
two_normalisers(norm, getTestOpts().extra_normaliser), \