Fix up test topHandler03 by ignoring unhelpful shell output
authorDuncan Coutts <duncan@community.haskell.org>
Fri, 15 Nov 2013 11:26:03 +0000 (11:26 +0000)
committerDuncan Coutts <duncan@well-typed.com>
Fri, 15 Nov 2013 13:56:44 +0000 (13:56 +0000)
Shells! Grrrr. Some shells print out a message if your program terminates with
a signal. In the case of topHandler03 which deliberately exits with signal 15
SIGTERM, some shells were printing "Terminated" to stdout.

Why the testsuite driver goes via a shell I do not know (it also messes up the
exit codes for signals).

tests/all.T

index efc5ca9..f722538 100644 (file)
@@ -136,6 +136,21 @@ test('T7653', normal, compile_and_run, [''])
 test('T7787', normal, compile_and_run, [''])
 
 test('topHandler01', when(opsys('mingw32'), skip), compile_and_run, [''])
-test('topHandler02', [ when(opsys('mingw32'), skip), exit_code(130), omit_ways(['ghci']) ], compile_and_run, [''])
-test('topHandler03', [ when(opsys('mingw32'), skip), exit_code(143) ], 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,
+      exit_code(130)  # actually signal 2 SIGINT
+     ], compile_and_run, [''])
+test('topHandler03',
+     [when(opsys('mingw32'), skip),
+      # As above, shells, grrr.
+      ignore_output,
+      exit_code(143)  # actually signal 15 SIGTERM
+     ], compile_and_run, [''])