diff --git a/.travis.yml b/.travis.yml index f52635658..efc029488 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ before_install: - sudo apt-get install -qq libghc-unordered-containers-dev libghc-mtl-dev libghc-network-dev libghc-xml-dev libghc-transformers-dev libghc-text-dev libghc-utf8-string-dev libghc-vector-dev libghc-split-dev libghc-ansi-terminal-dev libghc-ansi-wl-pprint-dev # trifecta dependencies - sudo apt-get install -qq libghc-blaze-builder-dev libghc-blaze-html-dev libghc-data-lens-dev libghc-bifunctors-dev libghc-hashable-dev libghc-semigroups-dev libghc-semigroupoids-dev libghc-parallel-dev libghc-comonad-dev libghc-terminfo-dev libghc-keys-dev + # test dependency + - sudo apt-get install -qq expect install: - cabal install -f FFI -f LLVM --only-dependencies --enable-tests before_script: diff --git a/test/reg039/expected b/test/reg039/expected new file mode 100644 index 000000000..9c5d73593 --- /dev/null +++ b/test/reg039/expected @@ -0,0 +1,2 @@ +Type checking ./reg039.idr +[3, 2, 1] diff --git a/test/reg039/reg039.idr b/test/reg039/reg039.idr new file mode 100644 index 000000000..6c1cad76b --- /dev/null +++ b/test/reg039/reg039.idr @@ -0,0 +1,12 @@ +module LazyExec + +-- The regression that this tests for is broken laziness in the executor. + +covering +countdown : Int -> Lazy (List Int) +countdown n = if n > 0 + then (n :: countdown (n-1)) + else [] + +go : IO () +go = putStrLn $ show (Force (countdown 3)) diff --git a/test/reg039/run b/test/reg039/run new file mode 100755 index 000000000..23c6aac73 --- /dev/null +++ b/test/reg039/run @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# From http://unix.stackexchange.com/questions/43340/how-to-introduce-timeout-for-shell-scripting +# Executes command with a timeout +# Params: +# $1 timeout in seconds +# $2 command +# Returns 1 if timed out 0 otherwise +timeout() { + + time=$1 + + # start the command in a subshell to avoid problem with pipes + # (spawn accepts one command) + command="/bin/sh -c \"$2\"" + + expect -c "set echo \"-noecho\"; set timeout $time; spawn -noecho $command; expect timeout { exit 1 } eof { exit 0 }" + + if [ $? = 1 ] ; then + echo "Timeout after ${time} seconds" + fi + +} + +timeout 60 "idris $@ --nocolour reg039.idr --exec go" +rm -f reg039 *.ibc