summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts
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 /testsuite/tests/rts
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
Diffstat (limited to 'testsuite/tests/rts')
-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
8 files changed, 53 insertions, 32 deletions
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') ],