From ab30fdcfe6a45beee2f930c06820802dfeb65c9a Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Fri, 15 Jul 2011 08:41:07 -0700 Subject: [PATCH] add wrapper for shelltest --- development.md | 4 +++- tests/run.sh | 17 +++++++++++++++++ tests/runscaffold.sh | 2 +- tests/scaffold.shelltest | 11 +---------- 4 files changed, 22 insertions(+), 12 deletions(-) create mode 100755 tests/run.sh diff --git a/development.md b/development.md index 9568de23..531621ea 100644 --- a/development.md +++ b/development.md @@ -2,9 +2,11 @@ ## Test suite +install the shelltest package: cabal install shelltests + Run this from the project root directory. It will make sure each site type builds. It first does an sdist, which ensures we are testing what will be put on hackage. - shelltest tests/scaffold.shelltest + tests/run.sh Give it the --debug flag to see all output diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 00000000..93536b6d --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,17 @@ +#!/bin/bash -x +# +# A wrapper for the shelltest test. Passes along options to shelltest. +# +# cabal install shelltestrunner + +cabal clean && cabal install && cabal sdist + +# I am not that good at shell scripting +# this for loop only operates on 1 file (as per tail -1) +for f in $(ls -1rt dist/*.tar.gz | tail -1) +do + tar -xzvf $f && cd `basename $f .tar.gz` + shelltest ../tests/scaffold.shelltest $@ + cd .. + rm -r `basename $f .tar.gz` +done diff --git a/tests/runscaffold.sh b/tests/runscaffold.sh index 6ec79864..03b40ced 100755 --- a/tests/runscaffold.sh +++ b/tests/runscaffold.sh @@ -1,3 +1,3 @@ #!/bin/bash -x - rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. +rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. diff --git a/tests/scaffold.shelltest b/tests/scaffold.shelltest index 16cd5be7..a35a8554 100644 --- a/tests/scaffold.shelltest +++ b/tests/scaffold.shelltest @@ -1,13 +1,4 @@ -# This uses shelltest -# -# cabal install shelltestrunner -# shelltest tests/scaffold.shelltest -# -# note that the first 2 lines setup this test but will also be counted as 2 tests. - -cabal clean && cabal install && cabal sdist - -for f in $(ls -1rt dist/*.tar.gz | tail -1); do tar -xzvf $f && cd `basename $f .tar.gz`; done +# Important! run with tests/run.sh rm -rf foobar && runghc scaffold.hs init && cd foobar && cabal install && cabal install -fdevel && cd .. <<<