[Haskell-cafe] For one cabal'ised library: running specific benchmarks & tests, and obtaining multiple Travis reports

Rob Stewart robstewart57 at gmail.com
Sat Jan 2 17:46:45 UTC 2016


Hi,

Three questions: 1) running specific criterion benchmark groups,
2) running specific test-framework test groups, and 3) getting
multiple Travis CI reports for one cabal'ised library.

1. Running specific criterion benchmark groups

Given this benchmark harness:

main = defaultMain [
  bgroup "fib" [ bench "1"  $ whnf fib 1
               , bench "5"  $ whnf fib 5
               , bench "9"  $ whnf fib 9
               , bench "11" $ whnf fib 11
               ]
  ]

How do I run one specific group benchmar, or a specific benchmark
in a specific group? Can I run:

$ cabal bench "fib"

or

$ cabal bench "fib/1"


2. Running specific test-framework test groups

Given this test harness with test-framework:

main = defaultMain tests
tests = [
        testGroup "Sorting-Group-1" [
                testProperty "sort1" prop_sort1,
                testProperty "sort2" prop_sort2,
                testProperty "sort3" prop_sort3
            ],
        testGroup "Sorting-Group-2" [
                testProperty "sort4" prop_sort4,
                testProperty "sort5" prop_sort5,
                testProperty "sort6" prop_sort6,
                testCase "sort7" test_sort7,
                testCase "sort8" test_sort8
            ]
    ]

Can I run:

$ cabal test "Sorting-Group-1"

or

$ cabal test "Sorting-Group-1/sort3"


3. Separating cabal'ised project to separate Travis CI badges

For my current project, I get one Travis CI report for all of
HUnit and QuikCheck tests I write for a cabal'ised library
expressed with test-framework. For example, if 108 tests fail I get
one Travis CI report saying #108 failing tests, and I get one Travis
CI badge of the form:

https://travis-ci.org/<my_username>/<library_name>.png?branch=master

What I'd really like is to retrieve multiple Travis CI reports and
multiple Travis CI badges for one Haskell libray. E.g.

API tests:       passing (with a URL for a green badge).
Parser tests:    #108 failing (with a URL for a red badge).
Messaging tests: #16 failing (with a URL for a red badge).

How could I refactor my test groups so that Travis CI will provide me
multiple reports for one cabal'ised project?

Thanks!

--
Rob Stewart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160102/af1f37ba/attachment.html>


More information about the Haskell-Cafe mailing list