[commit: packages/base] master: Fix up test topHandler03 by ignoring unhelpful shell output (f3e5ad3)

git at git.haskell.org git at git.haskell.org
Fri Nov 15 13:56:59 UTC 2013


Repository : ssh://git@git.haskell.org/base

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f3e5ad387c2e77bed36fc41b6319514fc38e59f2/base

>---------------------------------------------------------------

commit f3e5ad387c2e77bed36fc41b6319514fc38e59f2
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Fri Nov 15 11:26:03 2013 +0000

    Fix up test topHandler03 by ignoring unhelpful shell output
    
    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).


>---------------------------------------------------------------

f3e5ad387c2e77bed36fc41b6319514fc38e59f2
 tests/all.T |   19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/tests/all.T b/tests/all.T
index efc5ca9..f722538 100644
--- a/tests/all.T
+++ b/tests/all.T
@@ -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, [''])
 



More information about the ghc-commits mailing list