README
1Running tests
2-------------
3
4 $ make check
5
6If run from tests/ dir, tests will fail to run tests if lighttpd not built.
7If run from top level, 'make' will build lighttpd executable if not yet built,
8and then will run tests.
9
10
11Running individual tests programs
12---------------------------------
13
14prep
15 $ cd tests/
16 $ ./prepare.sh
17
18then, for any particular *.t such as request.t,
19 $ ./request.t
20or
21 $ VERBOSE=1 RUNTESTS=request ./run-tests.pl
22
23More information is output by tests with additional environment settings:
24 $ TRACE_HTTP=1 ./request.t
25
26See 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
34To reduce noise from valgrind --show-leak-kinds=all (or =reachable), avoid FAM.
35Use server.stat-cache-engine = "simple" (not server.stat-cache-engine = "fam")
36in lighttpd.conf. (FAM creates /usr/libexec/gam_server as child process.)
37
38
39Running lighttpd server with a config from tests/*.conf
40-------------------------------------------------------
41
42Each *.t loads the lighttpd server with one or more config files.
43See each *.t for which config file is used, e.g. tests/lighttpd.conf
44
45To 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
52The PERL, PHP, and SRCDIR environment variables are set by LightyTest.pm
53when 'make check' is run. PERL and PHP can be set to paths to perl and php,
54e.g. export PERL=/usr/bin/perl
55
56To 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
67Hints and tips
68--------------
69Q: What do I do if tests fail with:
70 bind: Address already in use at LightyTest.pm line 429.
71A: 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
77Additional documentation
78------------------------
79https://redmine.lighttpd.net/projects/lighttpd/wiki/RunningUnitTests
80https://redmine.lighttpd.net/projects/lighttpd/wiki/HowToReportABug
81https://redmine.lighttpd.net/projects/lighttpd/wiki/DebugVariables
82