xref: /lighttpd1.4/tests/README (revision 8a2f9c11)
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 exectuable 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 PHP=/usr/bin/php-cgi 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 PHP=/usr/bin/php-cgi
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 PHP=/usr/bin/php-cgi SRCDIR=$repo/tests repo=$repo \
61    gdb $repo/src/lighttpd
62
63  (gdb) set args -D -f lighttpd.conf -m $repo/src/.libs
64  (gdb) start
65  (gdb) ...
66
67
68Hints and tips
69--------------
70Q: What do I do if tests fail with:
71     bind: Address already in use at LightyTest.pm line 429.
72A: It is likely that something else on the machine is already using the port
73   that tests are trying to use to run a backend.  Try exiting out of your web
74   browser and then run the tests again.  (root can use 'netstat' or 'ss' to
75   find out which process is using the port.)
76
77
78Additional documentation
79------------------------
80https://redmine.lighttpd.net/projects/lighttpd/wiki/RunningUnitTests
81https://redmine.lighttpd.net/projects/lighttpd/wiki/HowToReportABug
82https://redmine.lighttpd.net/projects/lighttpd/wiki/DebugVariables
83