blob: 7bbebfa3719919fad488a36fe171e8cbd68ff179 (
plain)
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
|
This directory contains the testsuite for pdfgrep.
## Dependencies
The tests depend on the following packages:
- dejagnu
- pdflatex
## Running
To run the tests, execute `make check` from the toplevel source
directory.
The testsuite might output some harmless messages like "WARNING:
Couldn't find the global config file.". What's really important are
any lines beginning with "FAIL:".
## Coverage
To get a test coverage report, install `gcovr` and run configure with
the following arguments:
./configure CXXFLAGS="-O0" --enable-coverage
and then run:
make clean
make coverage
This will print a test coverage report to stdout. To get an HTML
report with lcov, run `make cov-report-html`.
## Configuration
The test runs can be configured by editing `testsuite/site.exp`. The
following variables can be set:
- `disable_poppler_version_check`: Don't mark tests as unsupported if
the poppler version is not recent enough. (This is useful if you
have backported a patch from a later version to your current one).
## Writing new tests
See the existing tests in `testsuite/pdfgrep.tests/` as example on how
to write tests. The utility functions to use are defined in
`testsuite/lib/pdfgrep.exp` and extensively commented. In particular,
the following functions and variables should be of interest:
### Variables
- `test`: The name of the following test.
- `required_poppler_version`: The least poppler version that this test
does require.
- `requires_pcre_support`: Whether this test requires libpcre support.
### Procedures
- `pdfgrep_expect`: Call pdfgrep an expect some output.
- `pdfgrep_expect_x`: Call pdfgrep an expect some output, but mark
this test as known to fail.
- `pdfgrep_expect_error`: Call pdfgrep and expect it print an error.
- `pdfgrep_exit_status`: Compare the exit status of the last spawned
process.
- `mkpdf`: Generate a pdf using latex.
- `clear_pdfdir`: Delete the content of the directory of generated
pdfs.
|