File: tests-and-benchmarks.markdown

package info (click to toggle)
haskell-text 1.2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 956 kB
  • sloc: haskell: 9,554; ansic: 233; python: 87; ruby: 84; sh: 49; makefile: 38
file content (68 lines) | stat: -rw-r--r-- 2,349 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Tests and benchmarks
====================

Prerequisites
-------------

To run the tests and benchmarks, you will need the test data, which
you can clone from one of the following locations:

* Mercurial master repository:
  [bitbucket.org/bos/text-test-data](https://bitbucket.org/bos/text-test-data)

* Git mirror repository:
  [github.com/bos/text-test-data](https://github.com/bos/text-test-data)

You can clone either repository into the `tests` subdirectory using

    cd tests/
    make text-test-data         # to clone from mercurial, OR
    make VCS=git text-test-data # to clone from git

Many tests and benchmarks will fail if the test files are missing.

Functional tests
----------------

The functional tests are located in the `tests` subdirectory. An overview of
what's in that directory:

    Makefile          Has targets for common tasks
    Tests             Source files of the testing code
    scripts           Various utility scripts
    text-tests.cabal  Cabal file that compiles all benchmarks

The `text-tests.cabal` builds:

- A copy of the text library, sharing the source code, but exposing all internal
  modules, for testing purposes
- The different test suites

To compile, run all tests, and generate a coverage report, simply use `make`.

Benchmarks
----------

The benchmarks are located in the `benchmarks` subdirectory. An overview of
what's in that directory:

    Makefile               Has targets for common tasks
    haskell                Source files of the haskell benchmarks
    python                 Python implementations of some benchmarks
    ruby                   Ruby implementations of some benchmarks
    text-benchmarks.cabal  Cabal file which compiles all benchmarks

To compile the benchmarks, navigate to the `benchmarks` subdirectory and run
`cabal configure && cabal build`. Then, you can run the benchmarks using:

    ./dist/build/text-benchmarks/text-benchmarks

Or if you have a recent enough `cabal`, you can build and run the
benchmarks via

    cabal new-run exe:text-benchmarks -- --help

However, since there's quite a lot of benchmarks, you usually don't want to
run them all. Instead, use the `-l` flag to get a list of benchmarks
and run the ones you want to inspect. If you want to configure the benchmarks
further, the exact parameters can be changed in `Benchmarks.hs`.