summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-06-24 20:45:04 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-06-29 18:20:51 +0200
commit1084d3755cac6ccd90f8decc0d79c315387ae388 (patch)
treea71d2acd5aa581d9c4edea6969edc3d0afc3447f
parent8f7194fae23bdc6db72fc5784933f50310ce51f9 (diff)
downloadhaskell-1084d3755cac6ccd90f8decc0d79c315387ae388.tar.gz
Testsuite: use ignore_stderr/stdout instead of ignore_output
The problem with ignore_output is that it hides errors for WAY=ghci. GHCi always returns with exit code 0 (unless it is broken itself). For example: ghci015 must have been failing with compile errors for years, but we didn't notice because all output was ignored. Therefore, replace all uses of ignore_output with either ignore_stderr or ignore_stdout. In some cases I opted for adding the expected output. Update submodule hpc and stm. Reviewed by: simonmar Differential Revision: https://phabricator.haskell.org/D2367
-rw-r--r--libraries/base/tests/all.T8
-rw-r--r--libraries/base/tests/topHandler03.stderr1
m---------libraries/hpc0
m---------libraries/stm0
-rw-r--r--testsuite/driver/extra_files.py1
-rw-r--r--testsuite/driver/testglobals.py6
-rw-r--r--testsuite/driver/testlib.py49
-rw-r--r--testsuite/tests/cabal/Makefile3
-rw-r--r--testsuite/tests/cabal/all.T16
-rw-r--r--testsuite/tests/cabal/cabal03/Makefile8
-rw-r--r--testsuite/tests/cabal/cabal03/all.T2
-rw-r--r--testsuite/tests/cabal/cabal03/cabal03.stderr4
-rw-r--r--testsuite/tests/cabal/cabal05/all.T2
-rw-r--r--testsuite/tests/cabal/cabal05/cabal05.stderr5
-rw-r--r--testsuite/tests/cabal/cabal09/all.T2
-rw-r--r--testsuite/tests/cabal/ghcpkg04.stderr4
-rw-r--r--testsuite/tests/concurrent/should_run/all.T6
-rw-r--r--testsuite/tests/dph/enumfromto/dph-enumfromto.T3
-rw-r--r--testsuite/tests/driver/Makefile8
-rw-r--r--testsuite/tests/driver/all.T6
-rw-r--r--testsuite/tests/ghc-e/should_fail/Makefile14
-rw-r--r--testsuite/tests/ghc-e/should_fail/T7962.stderr3
-rw-r--r--testsuite/tests/ghc-e/should_fail/T9905fail1.stderr4
-rw-r--r--testsuite/tests/ghc-e/should_fail/T9905fail2.stderr3
-rw-r--r--testsuite/tests/ghc-e/should_fail/T9905fail3.stderr2
-rw-r--r--testsuite/tests/ghc-e/should_fail/T9930fail.stderr2
-rw-r--r--testsuite/tests/ghc-e/should_fail/all.T14
-rw-r--r--testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr3
-rw-r--r--testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr4
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T8
-rw-r--r--testsuite/tests/ghci/scripts/ghci015.hs4
-rw-r--r--testsuite/tests/hpc/all.T2
-rw-r--r--testsuite/tests/perf/should_run/all.T4
-rw-r--r--testsuite/tests/rts/T11223/all.T2
-rwxr-xr-xtestsuite/tests/rts/T9839_01.hs4
-rw-r--r--testsuite/tests/rts/T9839_01.stderr1
-rw-r--r--testsuite/tests/rts/T9839_02.stderr1
-rw-r--r--testsuite/tests/rts/T9839_03.stderr1
-rw-r--r--testsuite/tests/rts/T9839_05.stderr1
-rw-r--r--testsuite/tests/rts/T9839_06.stderr1
-rw-r--r--testsuite/tests/rts/all.T74
41 files changed, 176 insertions, 110 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 7950786487..df49172007 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -147,18 +147,10 @@ test('topHandler01', when(opsys('mingw32'), skip), compile_and_run, [''])
test('topHandler02',
[when(opsys('mingw32'), skip),
omit_ways(['ghci']),
- # Irritatingly, the test driver calls the programs via a shell, and
- # depending on the shell, they can add their own "helpful" commentary,
- # pretty printing the name of the signal that killed the process. So we
- # ignore the stdout here, we only care about the exit code (which itself
- # is messed up because of the shell, using 128+sig encoding)
- ignore_output,
signal_exit_code(2)
], compile_and_run, [''])
test('topHandler03',
[when(opsys('mingw32'), skip),
- # As above, shells, grrr.
- ignore_output,
signal_exit_code(15)
], compile_and_run, [''])
test('topHandler04',
diff --git a/libraries/base/tests/topHandler03.stderr b/libraries/base/tests/topHandler03.stderr
new file mode 100644
index 0000000000..e45928c44e
--- /dev/null
+++ b/libraries/base/tests/topHandler03.stderr
@@ -0,0 +1 @@
+Terminated
diff --git a/libraries/hpc b/libraries/hpc
-Subproject b52ab0cc013beb1440607a7e4521a45fd6e96ce
+Subproject 956887d4a15de3e68aae82b14bfa1630c814964
diff --git a/libraries/stm b/libraries/stm
-Subproject ee756000fc654a105ff3f8a319b904f2df33c65
+Subproject fe8899331e6ca7bdf80d57cf77dd597023ae471
diff --git a/testsuite/driver/extra_files.py b/testsuite/driver/extra_files.py
index 604b12d13b..43e78af39d 100644
--- a/testsuite/driver/extra_files.py
+++ b/testsuite/driver/extra_files.py
@@ -65,6 +65,7 @@ extra_src_files = {
'T11223_link_order_a_b_succeed': ['bar.c', 'foo.c', 'foo2.hs'],
'T11223_link_order_b_a_2_succeed': ['bar.c', 'foo.c', 'foo3.hs'],
'T11223_link_order_b_a_succeed': ['bar.c', 'foo.c', 'foo2.hs'],
+ 'T11223_simple_duplicate': ['bar.c', 'foo.c', 'foo.hs'],
'T11223_simple_duplicate_lib': ['bar.c', 'foo.c', 'foo.hs'],
'T11223_simple_link': ['foo.c', 'foo.hs'],
'T11223_simple_link_lib': ['foo.c', 'foo.hs'],
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 2ddd4bf797..b130b3c90e 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -176,7 +176,8 @@ class TestOptions:
self.stdin = ''
# don't compare output
- self.ignore_output = 0
+ self.ignore_stdout = False
+ self.ignore_stderr = False
# We sometimes want to modify the compiler_always_flags, so
# they are copied from config.compiler_always_flags when we
@@ -246,6 +247,9 @@ class TestOptions:
# output, and a normaliser function given other test options
self.check_stdout = None
+ # Check .hp file when profiling libraries are available?
+ self.check_hp = True
+
# Extra normalisation for compiler error messages
self.extra_errmsg_normaliser = lambda x: x
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 79ac62b76c..493e52b0a2 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -172,8 +172,11 @@ def req_smp( name, opts ):
if not config.have_smp:
opts.expect = 'fail'
-def ignore_output( name, opts ):
- opts.ignore_output = 1
+def ignore_stdout(name, opts):
+ opts.ignore_stdout = True
+
+def ignore_stderr(name, opts):
+ opts.ignore_stderr = True
def combined_output( name, opts ):
opts.combined_output = True
@@ -484,6 +487,9 @@ def check_stdout( f ):
def _check_stdout( name, opts, f ):
opts.check_stdout = f
+def no_check_hp(name, opts):
+ opts.check_hp = False
+
# ----
def normalise_slashes( name, opts ):
@@ -902,7 +908,7 @@ def failBecause(reason, tag=None):
# The expected exit code can be changed via exit_code() as normal, and
# the expected stdout/stderr are stored in <testname>.stdout and
# <testname>.stderr. The output of the command can be ignored
-# altogether by using run_command_ignore_output instead of
+# altogether by using the setup function ignore_stdout instead of
# run_command.
def run_command( name, way, cmd ):
@@ -1216,21 +1222,19 @@ def simple_run(name, way, prog, extra_run_opts):
dump_stderr(name)
return failBecause('bad exit code')
- check_hp = '-h' in my_rts_flags
+ if not (opts.ignore_stderr or stderr_ok(name, way) or opts.combined_output):
+ return failBecause('bad stderr')
+ if not (opts.ignore_stdout or stdout_ok(name, way)):
+ return failBecause('bad stdout')
+
+ check_hp = '-h' in my_rts_flags and opts.check_hp
check_prof = '-p' in my_rts_flags
- if not opts.ignore_output:
- bad_stderr = not opts.combined_output and not check_stderr_ok(name, way)
- bad_stdout = not check_stdout_ok(name, way)
- if bad_stderr:
- return failBecause('bad stderr')
- if bad_stdout:
- return failBecause('bad stdout')
- # exit_code > 127 probably indicates a crash, so don't try to run hp2ps.
- if check_hp and (exit_code <= 127 or exit_code == 251) and not check_hp_ok(name):
- return failBecause('bad heap profile')
- if check_prof and not check_prof_ok(name, way):
- return failBecause('bad profile')
+ # exit_code > 127 probably indicates a crash, so don't try to run hp2ps.
+ if check_hp and (exit_code <= 127 or exit_code == 251) and not check_hp_ok(name):
+ return failBecause('bad heap profile')
+ if check_prof and not check_prof_ok(name, way):
+ return failBecause('bad profile')
return checkStats(name, way, stats_file, opts.stats_range_fields)
@@ -1307,11 +1311,12 @@ def interpreter_run(name, way, extra_hc_opts, top_mod):
# ToDo: if the sub-shell was killed by ^C, then exit
- if getTestOpts().ignore_output or (check_stderr_ok(name, way) and
- check_stdout_ok(name, way)):
- return passed()
+ if not (opts.ignore_stderr or stderr_ok(name, way)):
+ return failBecause('bad stderr')
+ elif not (opts.ignore_stdout or stdout_ok(name, way)):
+ return failBecause('bad stdout')
else:
- return failBecause('bad stdout or stderr')
+ return passed()
def split_file(in_fn, delimiter, out1_fn, out2_fn):
# See Note [Universal newlines].
@@ -1345,7 +1350,7 @@ def get_compiler_flags():
return flags
-def check_stdout_ok(name, way):
+def stdout_ok(name, way):
actual_stdout_file = add_suffix(name, 'run.stdout')
expected_stdout_file = find_expected_file(name, 'stdout')
@@ -1363,7 +1368,7 @@ def dump_stdout( name ):
print('Stdout:')
print(read_no_crs(in_testdir(name, 'run.stdout')))
-def check_stderr_ok(name, way):
+def stderr_ok(name, way):
actual_stderr_file = add_suffix(name, 'run.stderr')
expected_stderr_file = find_expected_file(name, 'stderr')
diff --git a/testsuite/tests/cabal/Makefile b/testsuite/tests/cabal/Makefile
index cbf8cbb7ed..45fb6ebb25 100644
--- a/testsuite/tests/cabal/Makefile
+++ b/testsuite/tests/cabal/Makefile
@@ -243,8 +243,7 @@ ghcpkg02:
$(GHC_PKG_ghcpkg02) init $(PACKAGE_CONF_ghcpkg02)
set -e; \
for i in `'$(GHC_PKG)' list --global --simple-output -v0`; do \
- echo Updating $$i; \
- '$(GHC_PKG)' describe --global $$i | $(GHC_PKG_ghcpkg02) update --global --force -; \
+ '$(GHC_PKG)' describe --global $$i | $(GHC_PKG_ghcpkg02) -v0 update --global --force -; \
done
PKGCONF07=local07.package.conf
diff --git a/testsuite/tests/cabal/all.T b/testsuite/tests/cabal/all.T
index 0c1b2d7cc1..cc874c78c2 100644
--- a/testsuite/tests/cabal/all.T
+++ b/testsuite/tests/cabal/all.T
@@ -6,19 +6,31 @@ test('ghcpkg01',
'local01.package.conf.old']),
run_command,
['$MAKE -s --no-print-directory ghcpkg01'])
+
+# Use ignore_stderr to prevent (when HADDOCK_DOCS=NO):
+# warning: haddock-interfaces .. doesn't exist or isn't a file
test('ghcpkg02',
- [ignore_output,
+ [ignore_stderr,
extra_clean(['package.conf.ghcpkg02', 'package.conf.ghcpkg02.old'])],
run_command,
['$MAKE -s --no-print-directory ghcpkg02'])
+
test('ghcpkg03',
[extra_clean(['local03.package.conf',
'local03.package.conf.old']),
normalise_errmsg_fun(normaliseDynlibNames)],
run_command,
['$MAKE -s --no-print-directory ghcpkg03'])
+
+def normalise_package_order(s):
+ # Package order is not deterministic?
+ return re.sub('testpkg-1.2.3.4 newtestpkg-2.0',
+ 'newtestpkg-2.0 testpkg-1.2.3.4',
+ s)
+
test('ghcpkg04',
- [ignore_output,
+ [
+ normalise_errmsg_fun(normalise_package_order),
extra_clean(['local04.package.conf',
'local04.package.conf.old'])],
run_command,
diff --git a/testsuite/tests/cabal/cabal03/Makefile b/testsuite/tests/cabal/cabal03/Makefile
index fbd02c553d..93589e89b0 100644
--- a/testsuite/tests/cabal/cabal03/Makefile
+++ b/testsuite/tests/cabal/cabal03/Makefile
@@ -6,9 +6,9 @@ include $(TOP)/mk/test.mk
SETUP=../Setup -v0
# This test is for overlapping/shadowing packages with Cabal. We
-# 1. install p-1.0 to the global DB
-# 2. install q-1.0 (depending on p-1.0) to a temporary DB
-# 3. install a differnet p-1.0 to the temp DB
+# 1. install p-1.0
+# 2. install q-1.0 (depending on p-1.0)
+# 3. install a different p-1.0
# 4. attempt to configure and buidl r, which depends on p-1.0 and q-1.0
#
# step 4 will elicit a warning from Cabal's configure step that the
@@ -30,7 +30,7 @@ cabal03: clean
cd p && $(SETUP) configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force --ipid p-withopt
cd p && $(SETUP) build
cd p && $(SETUP) register
- cd r && ! ../Setup configure $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force
+ cd r && ! ../Setup configure -v0 $(CABAL_MINIMAL_BUILD) --with-ghc='$(TEST_HC)' --ghc-options='$(TEST_HC_OPTS)' --package-db=../tmp.d --ghc-pkg-option=--force
ifneq "$(CLEANUP)" ""
$(MAKE) -s --no-print-directory clean
endif
diff --git a/testsuite/tests/cabal/cabal03/all.T b/testsuite/tests/cabal/cabal03/all.T
index b1b0561fc4..822d35ef81 100644
--- a/testsuite/tests/cabal/cabal03/all.T
+++ b/testsuite/tests/cabal/cabal03/all.T
@@ -4,6 +4,6 @@ else:
cleanup = 'CLEANUP=0'
test('cabal03',
- ignore_output,
+ normal,
run_command,
['$MAKE -s --no-print-directory cabal03 ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal03/cabal03.stderr b/testsuite/tests/cabal/cabal03/cabal03.stderr
new file mode 100644
index 0000000000..9d46d6883c
--- /dev/null
+++ b/testsuite/tests/cabal/cabal03/cabal03.stderr
@@ -0,0 +1,4 @@
+Setup: The following installed packages are broken because other packages they
+depend on are missing. These broken packages must be rebuilt before they can
+be used.
+package q-1.0 is broken due to missing package p-noopt
diff --git a/testsuite/tests/cabal/cabal05/all.T b/testsuite/tests/cabal/cabal05/all.T
index d7d9ffb3e5..aa209c8f49 100644
--- a/testsuite/tests/cabal/cabal05/all.T
+++ b/testsuite/tests/cabal/cabal05/all.T
@@ -4,6 +4,6 @@ else:
cleanup = 'CLEANUP=0'
test('cabal05',
- ignore_output,
+ normal,
run_command,
['$MAKE -s --no-print-directory cabal05 ' + cleanup])
diff --git a/testsuite/tests/cabal/cabal05/cabal05.stderr b/testsuite/tests/cabal/cabal05/cabal05.stderr
new file mode 100644
index 0000000000..b38f3a5301
--- /dev/null
+++ b/testsuite/tests/cabal/cabal05/cabal05.stderr
@@ -0,0 +1,5 @@
+
+T.hs:3:1: error:
+ Ambiguous interface for ‘Conflict’:
+ it is bound as p-0.1.0.0:P2 by a reexport in package p-0.1.0.0
+ it is bound as P by a reexport in package p-0.1.0.0
diff --git a/testsuite/tests/cabal/cabal09/all.T b/testsuite/tests/cabal/cabal09/all.T
index 6728c7749b..bd7761900d 100644
--- a/testsuite/tests/cabal/cabal09/all.T
+++ b/testsuite/tests/cabal/cabal09/all.T
@@ -4,6 +4,6 @@ else:
cleanup = 'CLEANUP=0'
test('cabal09',
- ignore_output,
+ normal,
run_command,
['$MAKE -s --no-print-directory cabal09 ' + cleanup])
diff --git a/testsuite/tests/cabal/ghcpkg04.stderr b/testsuite/tests/cabal/ghcpkg04.stderr
index 29a912b991..b601f3e706 100644
--- a/testsuite/tests/cabal/ghcpkg04.stderr
+++ b/testsuite/tests/cabal/ghcpkg04.stderr
@@ -1,4 +1,4 @@
-ghcpkg04.hs:1:0:
- Failed to load interface for `A':
+ghcpkg04.hs:1:1: error:
+ Ambiguous interface for ‘A’:
it was found in multiple packages: testpkg-1.2.3.4 newtestpkg-2.0
diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T
index a974f6a304..9f2ed284f6 100644
--- a/testsuite/tests/concurrent/should_run/all.T
+++ b/testsuite/tests/concurrent/should_run/all.T
@@ -239,9 +239,9 @@ test('conc064',
exit_code(1),
compile_and_run, [''])
-test('conc065', ignore_output, compile_and_run, [''])
-test('conc066', ignore_output, compile_and_run, [''])
-test('conc067', ignore_output, compile_and_run, [''])
+test('conc065', ignore_stdout, compile_and_run, [''])
+test('conc066', ignore_stdout, compile_and_run, [''])
+test('conc067', ignore_stdout, compile_and_run, [''])
# omit threaded2, the behaviour of this test is non-deterministic with more
# than one CPU.
diff --git a/testsuite/tests/dph/enumfromto/dph-enumfromto.T b/testsuite/tests/dph/enumfromto/dph-enumfromto.T
index da3061fee9..5f597a6623 100644
--- a/testsuite/tests/dph/enumfromto/dph-enumfromto.T
+++ b/testsuite/tests/dph/enumfromto/dph-enumfromto.T
@@ -2,8 +2,7 @@ test ('EnumFromToP'
, [ extra_clean(['EnumFromToP.o', 'EnumFromToP.hi'])
, reqlib('dph-lifted-vseg')
, reqlib('dph-prim-par')
- , ignore_output
, expect_broken(7736)
, only_ways(['normal', 'threaded1', 'threaded2']) ]
- , compile_fail
+ , compile
, [ '-O0 -package dph-lifted-vseg'])
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 22c70dd7e3..8069331fcb 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -457,8 +457,8 @@ static001:
T3674:
$(RM) T3674*.o T3674*.hi T3674_pre
- "$(TEST_HC)" $(TEST_HC_OPTS) --make T3674_pre.hs
- "$(TEST_HC)" $(TEST_HC_OPTS) --make T3674.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make -v0 T3674_pre.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) --make -v0 T3674.hs
.PHONY: rtsopts001
rtsopts001:
@@ -614,9 +614,9 @@ T10182:
.PHONY: T10320
T10320:
$(RM) -rf T10320 T10320.dump-rule-rewrites T10320.hi T10320.o
- "$(TEST_HC)" $(TEST_HC_OPTS) -ddump-to-file -ddump-rule-rewrites -fenable-rewrite-rules T10320.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -ddump-to-file -ddump-rule-rewrites -fenable-rewrite-rules T10320.hs
[ -s T10320.dump-rule-rewrites ]
- "$(TEST_HC)" $(TEST_HC_OPTS) -fforce-recomp -ddump-to-file -ddump-rule-rewrites T10320.hs
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -fforce-recomp -ddump-to-file -ddump-rule-rewrites T10320.hs
[ -f T10320.dump-rule-rewrites ] && [ ! -s T10320.dump-rule-rewrites ]
.PHONY: T12135
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 00afc1c13a..ee59befe77 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -333,7 +333,7 @@ test('T5313',
test('T2464', normal, compile, [''])
test('T3674',
- [ignore_output,
+ [
extra_clean(['T3674_pre.hi', 'T3674_pre.o', 'T3674_pre', 'T3674_pre.exe'])],
run_command,
['$MAKE -s --no-print-directory T3674'])
@@ -480,8 +480,8 @@ test('T11429c', normal, compile_fail, ['-Wunrecognised-warning-flags -Werror -Wf
test('T11763', normal, compile_and_run, ['-fno-version-macros'])
test('T10320',
- [ ignore_output
- , extra_clean(['T10320', 'T10320.o', 'T10320.hi'])],
+ [
+ extra_clean(['T10320', 'T10320.o', 'T10320.hi'])],
run_command,
['$MAKE -s --no-print-directory T10320'])
diff --git a/testsuite/tests/ghc-e/should_fail/Makefile b/testsuite/tests/ghc-e/should_fail/Makefile
index 9aa7c07fa5..827dfc776a 100644
--- a/testsuite/tests/ghc-e/should_fail/Makefile
+++ b/testsuite/tests/ghc-e/should_fail/Makefile
@@ -3,22 +3,22 @@ include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
T7962:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "return ("
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "return ("
T9905fail1:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import This.Module.Does.Not.Exist"
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import This.Module.Does.Not.Exist"
T9905fail2:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List (bogusIdentifier)"
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Data.List (bogusIdentifier)"
T9905fail3:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Prelude (+)" # syntax error
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "import Prelude (+)" # syntax error
ghc-e-fail1:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "class ["
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "class ["
ghc-e-fail2:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "type A = A"
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -e "type A = A"
T9930fail:
- '$(TEST_HC)' $(TEST_HC_OPTS) -ignore-dot-ghci -x hs T9930
+ -'$(TEST_HC)' $(TEST_HC_OPTS) -v0 -x hs T9930
diff --git a/testsuite/tests/ghc-e/should_fail/T7962.stderr b/testsuite/tests/ghc-e/should_fail/T7962.stderr
new file mode 100644
index 0000000000..b58aa89502
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T7962.stderr
@@ -0,0 +1,3 @@
+
+<interactive>:0:9: error:
+ parse error (possibly incorrect indentation or mismatched brackets)
diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr
new file mode 100644
index 0000000000..1f0fb05138
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T9905fail1.stderr
@@ -0,0 +1,4 @@
+
+<no location info>: error:
+ Could not find module ‘This.Module.Does.Not.Exist’
+ It is not a module in the current program, or in any known package.
diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr
new file mode 100644
index 0000000000..2e3e2d94cc
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T9905fail2.stderr
@@ -0,0 +1,3 @@
+
+<interactive>:1:19: error:
+ Module ‘Data.List’ does not export ‘bogusIdentifier’
diff --git a/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr b/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr
new file mode 100644
index 0000000000..85226ea2b4
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T9905fail3.stderr
@@ -0,0 +1,2 @@
+
+<interactive>:0:17: error: parse error on input ‘+’
diff --git a/testsuite/tests/ghc-e/should_fail/T9930fail.stderr b/testsuite/tests/ghc-e/should_fail/T9930fail.stderr
new file mode 100644
index 0000000000..a76a467f89
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/T9930fail.stderr
@@ -0,0 +1,2 @@
+ghc-stage2: default output name would overwrite the input file; must specify -o explicitly
+Usage: For basic information, try the `--help' option.
diff --git a/testsuite/tests/ghc-e/should_fail/all.T b/testsuite/tests/ghc-e/should_fail/all.T
index 8cb6d9a68b..c4baa0f3d4 100644
--- a/testsuite/tests/ghc-e/should_fail/all.T
+++ b/testsuite/tests/ghc-e/should_fail/all.T
@@ -1,22 +1,22 @@
-test('T7962', [exit_code(2), req_interp, ignore_output], run_command,
+test('T7962', req_interp, run_command,
['$MAKE --no-print-directory -s T7962'])
-test('T9905fail1', [exit_code(2), req_interp, ignore_output], run_command,
+test('T9905fail1', req_interp, run_command,
['$MAKE --no-print-directory -s T9905fail1'])
-test('T9905fail2', [exit_code(2), req_interp, ignore_output], run_command,
+test('T9905fail2', req_interp, run_command,
['$MAKE --no-print-directory -s T9905fail2'])
-test('T9905fail3', [exit_code(2), req_interp, ignore_output], run_command,
+test('T9905fail3', req_interp, run_command,
['$MAKE --no-print-directory -s T9905fail3'])
-test('ghc-e-fail1', [exit_code(2), req_interp, ignore_output], run_command,
+test('ghc-e-fail1', req_interp, run_command,
['$MAKE --no-print-directory -s ghc-e-fail1'])
-test('ghc-e-fail2', [exit_code(2), req_interp, ignore_output], run_command,
+test('ghc-e-fail2', req_interp, run_command,
['$MAKE --no-print-directory -s ghc-e-fail2'])
# Don't run on Windows, as executable is written to T9930.exe
# and no failure is induced.
-test('T9930fail', [exit_code(2), ignore_output, when(opsys('mingw32'), skip)], run_command,
+test('T9930fail', when(opsys('mingw32'), skip), run_command,
['$MAKE --no-print-directory -s T9930fail'])
diff --git a/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr b/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr
new file mode 100644
index 0000000000..cf75b40644
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/ghc-e-fail1.stderr
@@ -0,0 +1,3 @@
+
+<interactive>:0:8: error:
+ parse error (possibly incorrect indentation or mismatched brackets)
diff --git a/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr b/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr
new file mode 100644
index 0000000000..bcd0565d6a
--- /dev/null
+++ b/testsuite/tests/ghc-e/should_fail/ghc-e-fail2.stderr
@@ -0,0 +1,4 @@
+
+<interactive>:0:1: error:
+ Cycle in type synonym declarations:
+ <interactive>:0:1-10: type A = A
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index b2ea302f42..303fd392b1 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -28,10 +28,12 @@ test('ghci012', normal, ghci_script, ['ghci012.script'])
test('ghci013', normal, ghci_script, ['ghci013.script'])
test('ghci014', reqlib('QuickCheck'), ghci_script, ['ghci014.script'])
-# Ignore output from ghci015, the output is non-deterministic
+# Ignore stderr from ghci015, the output is non-deterministic
# (has occasional "thread blocked indefinitely" exceptions), and this
# is part of the test.
-test('ghci015', ignore_output, ghci_script, ['ghci015.script'])
+# But don't silence both stderr and stdout, as then the test would trivially
+# pass when ghci015.hs has errors.
+test('ghci015', [reqlib('stm'), ignore_stderr], ghci_script, ['ghci015.script'])
test('ghci016', expect_broken(552), ghci_script, ['ghci016.script'])
test('ghci017', [reqlib('haskell98'), extra_run_opts('-hide-package haskell98')], ghci_script, ['ghci017.script'])
@@ -245,7 +247,7 @@ test('T10576a', expect_broken(10576), ghci_script, ['T10576a.script'])
test('T10576b', expect_broken(10576), ghci_script, ['T10576b.script'])
test('T11051a', normal, ghci_script, ['T11051a.script'])
test('T11051b', normal, ghci_script, ['T11051b.script'])
-test('T11266', check_stdout(lambda *args: 1), ghci_script, ['T11266.script'])
+test('T11266', ignore_stdout, ghci_script, ['T11266.script'])
test('T11389', req_interp, run_command, ['$MAKE -s --no-print-directory T11389'])
test('T11524a', normal, ghci_script, ['T11524a.script'])
diff --git a/testsuite/tests/ghci/scripts/ghci015.hs b/testsuite/tests/ghci/scripts/ghci015.hs
index 0ff637f046..21a416686a 100644
--- a/testsuite/tests/ghci/scripts/ghci015.hs
+++ b/testsuite/tests/ghci/scripts/ghci015.hs
@@ -25,8 +25,8 @@ runTest loop = do
forked loop args@(tc1, tc2, tmv, hisTId) = catch ((loop args) >>= setTMV . Just) hndlr `finally` setTMV Nothing
where
setTMV x = atomically (tryPutTMVar tmv x >> return ())
- hndlr (AsyncException ThreadKilled) = return ()
- hndlr e = throwTo hisTId e
+ hndlr ThreadKilled = return ()
+ hndlr e = throwTo hisTId e
goodLoop args@(tc1, tc2, tmv, hisTId) = do
x <- atomically (readTChan tc1)
diff --git a/testsuite/tests/hpc/all.T b/testsuite/tests/hpc/all.T
index 5653fe49eb..d253169ef1 100644
--- a/testsuite/tests/hpc/all.T
+++ b/testsuite/tests/hpc/all.T
@@ -1,4 +1,4 @@
-test('T10138', ignore_output, run_command,
+test('T10138', ignore_stdout, run_command,
# Using --hpcdir with an absolute path should work (exit code 0).
['{hpc} report T10138.keepme.tix --hpcdir="`pwd`/.keepme.hpc.T10138"'])
diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T
index 3cb6f8e428..282bb1a4fc 100644
--- a/testsuite/tests/perf/should_run/all.T
+++ b/testsuite/tests/perf/should_run/all.T
@@ -69,7 +69,7 @@ test('lazy-bs-alloc',
# 2016-04-06: 429760 (x86/Linux) no idea what happened
only_ways(['normal']),
extra_run_opts('arith011.stdout'),
- ignore_output,
+ ignore_stdout,
# Use `+RTS -G1` for more stable residency measurements. Note [residency].
# Only 64-bit as we don't have a good 32-bit test environment at the moment
@@ -265,7 +265,7 @@ test('T5536',
# 17/1/13: 892399040 (x86_64/Linux)
# (new demand analyser)
extra_clean(['T5536.data']),
- ignore_output,
+ ignore_stdout,
only_ways(['normal'])
],
compile_and_run,
diff --git a/testsuite/tests/rts/T11223/all.T b/testsuite/tests/rts/T11223/all.T
index 872cf2b93a..1088d02b53 100644
--- a/testsuite/tests/rts/T11223/all.T
+++ b/testsuite/tests/rts/T11223/all.T
@@ -25,7 +25,7 @@ test('T11223_simple_link_lib',
# I'm ignoring the output since for this particular invocation normalise_errmsg
# isn't being called and I can't figure out why not.
test('T11223_simple_duplicate',
- [when(ghc_dynamic(), skip), ignore_output, exit_code(2), normalise_errmsg_fun(normalise_duplicate_errmsg)],
+ [when(ghc_dynamic(), skip), ignore_stderr, ignore_stdout, exit_code(2), normalise_errmsg_fun(normalise_duplicate_errmsg)],
run_command,
['$MAKE -s --no-print-directory t_11223_simple_duplicate'])
diff --git a/testsuite/tests/rts/T9839_01.hs b/testsuite/tests/rts/T9839_01.hs
new file mode 100755
index 0000000000..d82a4bd93b
--- /dev/null
+++ b/testsuite/tests/rts/T9839_01.hs
@@ -0,0 +1,4 @@
+module Main where
+
+main :: IO ()
+main = return ()
diff --git a/testsuite/tests/rts/T9839_01.stderr b/testsuite/tests/rts/T9839_01.stderr
new file mode 100644
index 0000000000..b2e4b75364
--- /dev/null
+++ b/testsuite/tests/rts/T9839_01.stderr
@@ -0,0 +1 @@
+T9839_01: flag -T given an argument when none was expected: -T-s
diff --git a/testsuite/tests/rts/T9839_02.stderr b/testsuite/tests/rts/T9839_02.stderr
new file mode 100644
index 0000000000..4a4b02e568
--- /dev/null
+++ b/testsuite/tests/rts/T9839_02.stderr
@@ -0,0 +1 @@
+T9839_02: flag -Pa given an argument when none was expected: -Pax
diff --git a/testsuite/tests/rts/T9839_03.stderr b/testsuite/tests/rts/T9839_03.stderr
new file mode 100644
index 0000000000..0cd4c3a431
--- /dev/null
+++ b/testsuite/tests/rts/T9839_03.stderr
@@ -0,0 +1 @@
+T9839_03: flag -P given an argument when none was expected: -Px
diff --git a/testsuite/tests/rts/T9839_05.stderr b/testsuite/tests/rts/T9839_05.stderr
new file mode 100644
index 0000000000..567f48e13a
--- /dev/null
+++ b/testsuite/tests/rts/T9839_05.stderr
@@ -0,0 +1 @@
+T9839_05: flag -x given an argument when none was expected: -xcx
diff --git a/testsuite/tests/rts/T9839_06.stderr b/testsuite/tests/rts/T9839_06.stderr
new file mode 100644
index 0000000000..016eed0376
--- /dev/null
+++ b/testsuite/tests/rts/T9839_06.stderr
@@ -0,0 +1 @@
+T9839_06: flag -x given an argument when none was expected: -xtx
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index 25ea8b524b..27e78099af 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -23,7 +23,7 @@ test('derefnull',
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
- when(opsys('linux'), ignore_output),
+ when(opsys('linux'), ignore_stderr),
# SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
when(platform('i386-apple-darwin'), exit_code(138)),
when(platform('powerpc-apple-darwin'), exit_code(138)),
@@ -39,7 +39,7 @@ test('divbyzero',
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
- when(opsys('linux'), ignore_output),
+ when(opsys('linux'), ignore_stderr),
# PowerPC 64 bit and most likely PowerPC 32 bit processors
# do not generate an exception (interrupt) for integer
# division by zero but the result is undefined.
@@ -57,7 +57,7 @@ test('outofmem', when(opsys('darwin'), skip),
run_command, ['$MAKE -s --no-print-directory outofmem'])
test('outofmem2', normal, run_command, ['$MAKE -s --no-print-directory outofmem2'])
-test('T2047', [ignore_output, extra_run_opts('+RTS -c -RTS')],
+test('T2047', [ignore_stdout, extra_run_opts('+RTS -c -RTS')],
compile_and_run, ['-package containers'])
# Blackhole-detection test.
@@ -223,9 +223,10 @@ test('T7815', [ multi_cpu_race,
req_smp,
only_ways(['threaded1', 'threaded2']) ], compile_and_run, [''] )
-# ignore_output because it contains a unique:
+# ignore_stderr because it contains a unique:
# ffishutdown: Main_dul: interrupted
-test('ffishutdown', [ ignore_output, only_ways(['threaded1','threaded2']) ], compile_and_run, [''])
+test('ffishutdown', [ignore_stderr, only_ways(['threaded1','threaded2'])],
+ compile_and_run, [''])
test('T7919',
[extra_clean(['T7919A.o','T7919A.hi', 'T7919A.dyn_o','T7919A.dyn_hi']),
@@ -240,10 +241,10 @@ test('linker_unload',
run_command,
['$MAKE -s --no-print-directory linker_unload'])
-test('T8209', [ only_ways(threaded_ways), ignore_output ],
+test('T8209', [ only_ways(threaded_ways), ignore_stdout ],
compile_and_run, [''])
-test('T8242', [ only_ways(threaded_ways), ignore_output ],
+test('T8242', [ only_ways(threaded_ways), ignore_stdout ],
compile_and_run, [''])
test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
@@ -286,51 +287,62 @@ test('overflow2', [ exit_code(251) ], compile_and_run, [''])
test('overflow3', [ exit_code(251) ], compile_and_run, [''])
test('linker_error1',
- [ extra_clean(['linker_error1.o','linker_error1']), ignore_output ],
+ [ extra_clean(['linker_error1.o','linker_error1']), ignore_stderr ],
run_command,
['$MAKE -s --no-print-directory linker_error1'])
test('linker_error2',
[ extra_clean(['linker_error2.o','linker_error2_c.o', 'linker_error2']),
- ignore_output ],
+ ignore_stderr ],
run_command,
['$MAKE -s --no-print-directory linker_error2'])
test('linker_error3',
[ extra_clean(['linker_error3.o','linker_error3_c.o', 'linker_error3']),
- ignore_output ],
+ ignore_stderr ],
run_command,
['$MAKE -s --no-print-directory linker_error3'])
-test('T9839_01', ignore_output,
- run_command,
- ['{compiler} -e 1 +RTS -T-s 2>&1 | \
- grep "flag -T given an argument when none was expected: -T-s"'])
+def grep_stderr(pattern):
+ def wrapper(cmd, pattern=pattern):
+ swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2.
+ return('{cmd} {swap12} | grep "{pattern}" {swap12}'.format(**locals()))
+ return cmd_wrapper(wrapper)
+
+# The ghci way gets confused by the RTS options
+test('T9839_01',
+ [omit_ways(['ghci']), extra_run_opts('+RTS -T-s'), no_check_hp,
+ grep_stderr('given an argument when none was expected')],
+ compile_and_run, [''])
-test('T9839_02', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -Pax')],
- compile_and_run,
- [''])
+test('T9839_02',
+ [only_ways(prof_ways), extra_run_opts('+RTS -Pax'), no_check_hp,
+ grep_stderr('given an argument when none was expected')],
+ compile_and_run, [''])
-test('T9839_03', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -Px')],
- compile_and_run,
- [''])
+test('T9839_03',
+ [only_ways(prof_ways), extra_run_opts('+RTS -Px'), no_check_hp,
+ grep_stderr('given an argument when none was expected')],
+ compile_and_run, [''])
-test('T9839_04', [ only_ways(prof_ways), ignore_output, exit_code(0), extra_run_opts('+RTS -xc')],
- compile_and_run,
- [''])
+test('T9839_04',
+ [only_ways(prof_ways), extra_run_opts('+RTS -xc')],
+ compile_and_run, [''])
-test('T9839_05', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -xcx')],
- compile_and_run,
- [''])
+test('T9839_05',
+ [only_ways(prof_ways), extra_run_opts('+RTS -xcx'), no_check_hp,
+ grep_stderr('given an argument when none was expected')],
+ compile_and_run, [''])
-test('T9839_06', [ only_ways(prof_ways), ignore_output, exit_code(1), extra_run_opts('+RTS -xtx')],
- compile_and_run,
- [''])
+test('T9839_06',
+ [only_ways(prof_ways), extra_run_opts('+RTS -xtx'), no_check_hp,
+ grep_stderr('given an argument when none was expected')],
+ compile_and_run, [''])
-# ignore_output as RTS reports slightly different error messages
+# ignore_stderr as RTS reports slightly different error messages
# in 'epoll' and 'select' backends on reading from EBADF
# mingw32 skip as UNIX pipe and close(fd) is used to exercise the problem
-test('T10590', [ignore_output, when(opsys('mingw32'),skip)], compile_and_run, [''])
+test('T10590', [ignore_stderr, when(opsys('mingw32'), skip)], compile_and_run, [''])
# 20000 was easily enough to trigger the bug with 7.10
test('T10904', [ omit_ways(['ghci']), extra_run_opts('20000') ],