[commit: ghc] master: Relax test TH_addCStub2 so it succeeds on travis. (e79ef75)

git at git.haskell.org git at git.haskell.org
Fri Feb 10 20:40:01 UTC 2017


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

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

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

commit e79ef75d9a224ab1eac1c237e686bcaef97b8e9c
Author: Facundo Domínguez <facundo.dominguez at tweag.io>
Date:   Thu Feb 9 23:20:17 2017 -0300

    Relax test TH_addCStub2 so it succeeds on travis.
    
    Test Plan: ./validate
    
    Reviewers: bgamari, nomeata, austin, mpickering
    
    Reviewed By: mpickering
    
    Subscribers: mpickering, rwbarton, mboes, thomie
    
    Differential Revision: https://phabricator.haskell.org/D3124


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

e79ef75d9a224ab1eac1c237e686bcaef97b8e9c
 testsuite/tests/th/TH_addCStub2.stderr |  6 ------
 testsuite/tests/th/all.T               | 12 +++++++++++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/testsuite/tests/th/TH_addCStub2.stderr b/testsuite/tests/th/TH_addCStub2.stderr
deleted file mode 100644
index ba3277b..0000000
--- a/testsuite/tests/th/TH_addCStub2.stderr
+++ /dev/null
@@ -1,6 +0,0 @@
-
-TH_addCStub2.hs:13:13:
-     expected ‘;’, ‘,’ or ‘)’ before ‘{’ token
-          [ "#include <stdio.h>"
-                 ^
-`gcc' failed in phase `C Compiler'. (Exit code: 1)
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 56aca1a..47da8df 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -63,8 +63,18 @@ test('TH_reifyDecl2', normal, compile, ['-v0'])
 test('TH_reifyLocalDefs', normal, compile, ['-v0'])
 test('TH_reifyLocalDefs2', normal, compile, ['-v0'])
 
+
+# Checks if the error output of an appended command has the given pattern.
+def error_has(pattern):
+    swap12 = '3>&1 1>&2 2>&3 3>&-' # Swap file descriptors 1 and 2.
+    # pipefail: make a pipe fail if any of the commands fails
+    # the following fails only if both the command fails and the pattern is found
+    return('bash -o pipefail -c \'! (! "$@" {swap12}) | grep {pattern} {swap12} &> /dev/null\' --'.format(**locals()))
+
 test('TH_addCStub1', normal, compile_and_run, ['-v0'])
-test('TH_addCStub2', normal, compile_fail, ['-v0'])
+test('TH_addCStub2'
+     , [compile_cmd_prefix(error_has('TH_addCStub2.hs:13:'))]
+     , compile_fail, ['-v0'])
 
 test('TH_reifyMkName', normal, compile, ['-v0'])
 



More information about the ghc-commits mailing list