[commit: packages/stm] ghc-7.8: Integrate tests with TravisCI job (c0de155)

git at git.haskell.org git at git.haskell.org
Tue Mar 25 13:08:50 UTC 2014


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

On branch  : ghc-7.8
Link       : http://git.haskell.org/packages/stm.git/commitdiff/c0de155171f6462ca5e862c4dd6bf9c535742143

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

commit c0de155171f6462ca5e862c4dd6bf9c535742143
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Tue Mar 25 14:05:47 2014 +0100

    Integrate tests with TravisCI job
    
    A simple bash runner-script is included as the GHC testsuite runner
    isn't available for the Travis-CI job
    
    Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>


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

c0de155171f6462ca5e862c4dd6bf9c535742143
 .travis.yml                                  |    6 +++-
 tests/{stm046.stderr => T2411.stdout.ignore} |    0
 tests/runtests.sh                            |   44 ++++++++++++++++++++++++++
 tests/stm050.hs                              |    6 ++--
 4 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 034a8cc..4d77888 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
 env:
- - GHCVER=6.12.3
+# - GHCVER=6.12.3
  - GHCVER=7.0.1
  - GHCVER=7.0.2
  - GHCVER=7.0.3
@@ -11,6 +11,7 @@ env:
  - GHCVER=7.6.1
  - GHCVER=7.6.2
  - GHCVER=7.6.3
+ - GHCVER=7.8.1
  - GHCVER=head
 
 matrix:
@@ -27,6 +28,7 @@ install:
  - cabal-1.18 update
 
 script:
+ - cabal-1.18 install random
  - cabal-1.18 configure -v2
  - cabal-1.18 build
  - cabal-1.18 check
@@ -39,3 +41,5 @@ script:
       echo "expected '$SRC_TGZ' not found";
       exit 1;
    fi
+ - cabal-1.18 install random
+ - tests/runtests.sh
\ No newline at end of file
diff --git a/tests/stm046.stderr b/tests/T2411.stdout.ignore
similarity index 100%
copy from tests/stm046.stderr
copy to tests/T2411.stdout.ignore
diff --git a/tests/runtests.sh b/tests/runtests.sh
new file mode 100755
index 0000000..4124fdc
--- /dev/null
+++ b/tests/runtests.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+# Simple runner script used for TravisCI (where GHC's testsuite runner isn't available)
+
+set -e
+
+die () {
+    echo "ERROR: $1" >&2;
+    exit 1;
+}
+
+[ -f tests/runtests.sh ] && cd tests/
+
+[ -f runtests.sh ] || die "must be called from inside tests folder"
+
+for T in *.hs;do
+    T=${T%.hs}
+
+    echo "== running test '$T'"
+
+    ghc --make -threaded -O2 --make ${T}.hs
+
+    if ./${T} > ${T}.stdout.run 2> ${T}.stderr.run
+    then
+        echo "${T} exited with code $?"
+    fi
+
+    for FD in stdout stderr; do
+        if [ -f "${T}.${FD}.ignore" ]; then
+            echo "ignoring ${FD} output"
+            continue
+        fi
+        echo "validate ${FD} output..."
+        if [ -f "${T}.${FD}" ]; then REF="${T}.${FD}"; else REF=/dev/null; fi
+        diff -w -u ${REF} ${T}.${FD}.run
+    done
+
+    echo "> '${T}' PASSED"
+
+    rm ${T}.hi ${T}.o ${T} ${T}.stdout.run ${T}.stderr.run
+done
+
+echo "----------------------------------------------------------------------------"
+echo "all tests PASSED!"
diff --git a/tests/stm050.hs b/tests/stm050.hs
index ebb8209..cefeb3d 100644
--- a/tests/stm050.hs
+++ b/tests/stm050.hs
@@ -200,8 +200,10 @@ directoryPoster2 n state
   The DirectoryService main process.
 -}
 directoryService
- = do [s] <- getArgs
-      let n = read s :: Int
+ = do args <- getArgs
+      n <- case args of
+        []  -> return 10000
+        [s] -> return (read s :: Int)
 
       c <- atomically (newTChan)
       t <- atomically (newTVar [])



More information about the ghc-commits mailing list