[commit: ghc] master: Fix broken tests (2ec1c83)

git at git.haskell.org git at git.haskell.org
Mon Jan 30 19:03:03 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/2ec1c834ca1129b69f4dd3e2586d9f318cbb3fa6/ghc

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

commit 2ec1c834ca1129b69f4dd3e2586d9f318cbb3fa6
Author: Phil Ruffwind <rf at rufflewind.com>
Date:   Mon Jan 30 11:49:58 2017 -0500

    Fix broken tests
    
    1. DoParamM requires the FlexibleContexts pragma now.
    
    2. topHandler02 and topHandler03 were broken as timeout.py failed to
       translate signals to exit codes.
    
    3. topHandler03 does not produce a consistent stderr, as it depends on
       what the user has /bin/sh set to.  dash writes "Terminated" whereas
       bash and zsh produce nothing in non-interactive mode.
    
    4. The remaining tests are broken due to changes in the error message
       formatting.
    
    Test Plan: validate
    
    Reviewers: thomie, dfeuer, austin, hvr, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: Phyx, dfeuer
    
    Differential Revision: https://phabricator.haskell.org/D2807


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

2ec1c834ca1129b69f4dd3e2586d9f318cbb3fa6
 libraries/base/tests/all.T                           |  5 +----
 libraries/base/tests/topHandler03.stderr             |  1 -
 .../tests/deriving/should_fail/drvfail006.stderr     |  8 +++-----
 testsuite/tests/rebindable/DoParamM.stderr           | 20 ++++++++++----------
 testsuite/tests/typecheck/should_compile/tc232.hs    |  1 +
 testsuite/timeout/timeout.py                         |  8 ++++++--
 6 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 3211054..3be05af 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -138,9 +138,6 @@ test('CatEntail', normal, compile, [''])
 test('T7653', high_memory_usage, compile_and_run, [''])
 test('T7787', normal, compile_and_run, [''])
 
-def stderr_contains(pattern):
-    return normalise_errmsg_fun(lambda s: pattern if pattern in s else s)
-
 test('topHandler01', when(opsys('mingw32'), skip), compile_and_run, [''])
 test('topHandler02',
      [when(opsys('mingw32'), skip),
@@ -148,7 +145,7 @@ test('topHandler02',
       signal_exit_code(2)
      ], compile_and_run, [''])
 test('topHandler03',
-     [when(opsys('mingw32'), skip), stderr_contains('Terminated'),
+     [when(opsys('mingw32'), skip), ignore_stderr,
       signal_exit_code(15)
      ], compile_and_run, [''])
 test('topHandler04',
diff --git a/libraries/base/tests/topHandler03.stderr b/libraries/base/tests/topHandler03.stderr
deleted file mode 100644
index e45928c..0000000
--- a/libraries/base/tests/topHandler03.stderr
+++ /dev/null
@@ -1 +0,0 @@
-Terminated
diff --git a/testsuite/tests/deriving/should_fail/drvfail006.stderr b/testsuite/tests/deriving/should_fail/drvfail006.stderr
index 3968d97..61900e8 100644
--- a/testsuite/tests/deriving/should_fail/drvfail006.stderr
+++ b/testsuite/tests/deriving/should_fail/drvfail006.stderr
@@ -1,6 +1,4 @@
 
-drvfail006.hs:9:45:
-    Can't make a derived instance of `MonadState T'
-      (even with cunning newtype deriving):
-      `MonadState' does not have arity 1
-    In the newtype declaration for `T'
+drvfail006.hs:9:45: error:
+    • ‘MonadState’ is not a unary constraint, as expected by a deriving clause
+    • In the newtype declaration for ‘T’
diff --git a/testsuite/tests/rebindable/DoParamM.stderr b/testsuite/tests/rebindable/DoParamM.stderr
index 6328d08..8d37640 100644
--- a/testsuite/tests/rebindable/DoParamM.stderr
+++ b/testsuite/tests/rebindable/DoParamM.stderr
@@ -11,12 +11,12 @@ DoParamM.hs:286:28: error:
         Actual type: LIO Unlocked Locked ()
     • In a stmt of a 'do' block: tlock2_do
       In the expression:
-        do { tlock2_do;
-             tlock2_do }
+        do tlock2_do
+           tlock2_do
       In an equation for ‘tlock4_do’:
           tlock4_do
-            = do { tlock2_do;
-                   tlock2_do }
+            = do tlock2_do
+                 tlock2_do
 
 DoParamM.hs:302:37: error:
     • Couldn't match type ‘Locked’ with ‘Unlocked’
@@ -24,11 +24,11 @@ DoParamM.hs:302:37: error:
         Actual type: LIO Locked Unlocked ()
     • In a stmt of a 'do' block: unlock
       In the expression:
-        do { tlock2_do;
-             unlock;
-             unlock }
+        do tlock2_do
+           unlock
+           unlock
       In an equation for ‘tlock4'_do’:
           tlock4'_do
-            = do { tlock2_do;
-                   unlock;
-                   unlock }
+            = do tlock2_do
+                 unlock
+                 unlock
diff --git a/testsuite/tests/typecheck/should_compile/tc232.hs b/testsuite/tests/typecheck/should_compile/tc232.hs
index 9d5ede3..2fc8544 100644
--- a/testsuite/tests/typecheck/should_compile/tc232.hs
+++ b/testsuite/tests/typecheck/should_compile/tc232.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE FlexibleContexts #-}
 {-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
 
 -- This one fixed the constraint solver (Lint error)
diff --git a/testsuite/timeout/timeout.py b/testsuite/timeout/timeout.py
index 51fb63c..f3468ad 100644
--- a/testsuite/timeout/timeout.py
+++ b/testsuite/timeout/timeout.py
@@ -42,8 +42,12 @@ try:
         (pid2, res) = os.waitpid(pid, 0)
         if (os.WIFEXITED(res)):
             sys.exit(os.WEXITSTATUS(res))
-        else:
-            sys.exit(res)
+        elif os.WIFSIGNALED(res):
+            # represent signals using the Bourne shell convention
+            sys.exit(128 + os.WTERMSIG(res))
+        else:                           # WIFCONTINUED or WIFSTOPPED
+            killProcess(pid)
+            sys.exit(99)                # unexpected
 
 except KeyboardInterrupt:
     sys.exit(98)



More information about the ghc-commits mailing list