Max - I was thinking about how to drive my new shell tests with your framework. I have:

data ShellTest = ShellTest {
     filename         ∷ String
    ,command          ∷ String
    ,stdin            ∷ Maybe String
    ,stdoutExpected   ∷ Maybe String
    ,stderrExpected   ∷ Maybe String
    ,exitCodeExpected ∷ Maybe ExitCode
    } deriving (Show)

parseShellTest ∷ FilePath → IO ShellTest
runShellTest ∷ ShellTest → IO Bool

I converted to hunit tests with

shellTestToHUnitTest t = filename t ~: do {r ← runShellTest t; assertBool "" r}

and tied test-framework into my test runner with

main = do
  args ← getArgs
  let (opts,files) = partition ((=="-").take 1) args
hunittests ← mapM (λf → parseShellTest f >>= (return ∘ shellTestToHUnitTest)) files
  withArgs opts $ defaultMain $ concatMap hUnitTestToTests hunittests

With surprisingly little code and pain, the new runner runs my 14 shell tests, with colored output, in the same time as the old one - 3.5s on this macbook.

But, I can now add -j8 and get the same results output in.. 0.13s. This quite surprised me, and now I want to say: thank you very much! :)

Best,
-Simon

$ time tools/shelltest2 tests/*.test -j8
:tests/eliding-balance.test: [OK]
:tests/missing-real-and-virtual-amt.test: [OK]
:tests/null-accountname-component.test: [OK]
:tests/parens-in-account-name.test: [OK]
:tests/sample-balance-depth.test: [OK]
:tests/sample-balance-o.test: [OK]
:tests/sample-balance.test: [OK]
:tests/unbalanced.test: [OK]
:tests/unicode-account-matching.test: [OK]
:tests/unicode-balance.test: [OK]
:tests/unicode-description-matching.test: [OK]
:tests/unicode-print.test: [OK]
:tests/unicode-register.test: [OK]
:tests/virtual.test: [OK]

         Test Cases   Total
 Passed  14           14
 Failed  0            0
 Total   14           14

real    0m0.132s
user    0m0.104s
sys     0m0.104s

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to