| 1 |
Running tests |
| 2 |
------------- |
| 3 |
|
| 4 |
$ make check |
| 5 |
|
| 6 |
If run from tests/ dir, tests will fail to run tests if lighttpd not built. |
| 7 |
If run from top level, 'make' will build lighttpd executable if not yet built, |
| 8 |
and then will run tests. |
| 9 |
|
| 10 |
|
| 11 |
Running individual tests programs |
| 12 |
--------------------------------- |
| 13 |
|
| 14 |
prep |
| 15 |
$ cd tests/ |
| 16 |
$ ./prepare.sh |
| 17 |
|
| 18 |
then, for any particular *.t such as request.t, |
| 19 |
$ ./request.t |
| 20 |
or |
| 21 |
$ VERBOSE=1 RUNTESTS=request ./run-tests.pl |
| 22 |
|
| 23 |
More information is output by tests with additional environment settings: |
| 24 |
$ TRACE_HTTP=1 ./request.t |
| 25 |
|
| 26 |
See LightyTest.pm before trying TRACEME |
| 27 |
$ less LightyTest.pm |
| 28 |
|
| 29 |
$ TRACEME=strace ./request.t # output to file 'strace' |
| 30 |
$ TRACEME=truss ./request.t # output to file 'strace' |
| 31 |
$ TRACEME=gdb ./request.t # not for interactive debugging (see below) |
| 32 |
$ TRACEME=valgrind ./request.t |
| 33 |
|
| 34 |
To reduce noise from valgrind --show-leak-kinds=all (or =reachable), avoid FAM. |
| 35 |
Use server.stat-cache-engine = "simple" (not server.stat-cache-engine = "fam") |
| 36 |
in lighttpd.conf. (FAM creates /usr/libexec/gam_server as child process.) |
| 37 |
|
| 38 |
|
| 39 |
Running lighttpd server with a config from tests/*.conf |
| 40 |
------------------------------------------------------- |
| 41 |
|
| 42 |
Each *.t loads the lighttpd server with one or more config files. |
| 43 |
See each *.t for which config file is used, e.g. tests/lighttpd.conf |
| 44 |
|
| 45 |
To run a specific config |
| 46 |
repo=$PWD # from root of src repository |
| 47 |
cd tests/ |
| 48 |
./prepare.sh |
| 49 |
PERL=/usr/bin/perl SRCDIR=$repo/tests \ |
| 50 |
$repo/src/lighttpd -D -f lighttpd.conf -m $repo/src/.libs |
| 51 |
|
| 52 |
The PERL, PHP, and SRCDIR environment variables are set by LightyTest.pm |
| 53 |
when 'make check' is run. PERL and PHP can be set to paths to perl and php, |
| 54 |
e.g. export PERL=/usr/bin/perl |
| 55 |
|
| 56 |
To run a specific config under gdb |
| 57 |
repo=$PWD # from root of src repository |
| 58 |
cd tests/ |
| 59 |
./prepare.sh |
| 60 |
PERL=/usr/bin/perl SRCDIR=$repo/tests \ |
| 61 |
gdb --args $repo/src/lighttpd -D -f lighttpd.conf -m $repo/src/.libs |
| 62 |
|
| 63 |
(gdb) start |
| 64 |
(gdb) ... |
| 65 |
|
| 66 |
|
| 67 |
Hints and tips |
| 68 |
-------------- |
| 69 |
Q: What do I do if tests fail with: |
| 70 |
bind: Address already in use at LightyTest.pm line 429. |
| 71 |
A: It is likely that something else on the machine is already using the port |
| 72 |
that tests are trying to use to run a backend. Try exiting out of your web |
| 73 |
browser and then run the tests again. (root can use 'netstat' or 'ss' to |
| 74 |
find out which process is using the port.) |
| 75 |
|
| 76 |
|
| 77 |
Additional documentation |
| 78 |
------------------------ |
| 79 |
https://redmine.lighttpd.net/projects/lighttpd/wiki/RunningUnitTests |
| 80 |
https://redmine.lighttpd.net/projects/lighttpd/wiki/HowToReportABug |
| 81 |
https://redmine.lighttpd.net/projects/lighttpd/wiki/DebugVariables |