xref: /lighttpd1.4/tests/README (revision 25f5085a)
1140c0fb8SGlenn StraussRunning tests
2140c0fb8SGlenn Strauss-------------
3140c0fb8SGlenn Strauss
4140c0fb8SGlenn Strauss  $ make check
5140c0fb8SGlenn Strauss
6140c0fb8SGlenn StraussIf run from tests/ dir, tests will fail to run tests if lighttpd not built.
7*25f5085aSGlenn StraussIf run from top level, 'make' will build lighttpd executable if not yet built,
8140c0fb8SGlenn Straussand then will run tests.
9140c0fb8SGlenn Strauss
10140c0fb8SGlenn Strauss
11140c0fb8SGlenn StraussRunning individual tests programs
12140c0fb8SGlenn Strauss---------------------------------
13140c0fb8SGlenn Strauss
14140c0fb8SGlenn Straussprep
15140c0fb8SGlenn Strauss  $ cd tests/
16140c0fb8SGlenn Strauss  $ ./prepare.sh
17140c0fb8SGlenn Strauss
18140c0fb8SGlenn Straussthen, for any particular *.t such as request.t,
19140c0fb8SGlenn Strauss  $ ./request.t
20140c0fb8SGlenn Straussor
21140c0fb8SGlenn Strauss  $ VERBOSE=1 RUNTESTS=request ./run-tests.pl
22140c0fb8SGlenn Strauss
23140c0fb8SGlenn StraussMore information is output by tests with additional environment settings:
24140c0fb8SGlenn Strauss  $ TRACE_HTTP=1     ./request.t
25140c0fb8SGlenn Strauss
26140c0fb8SGlenn StraussSee LightyTest.pm before trying TRACEME
27140c0fb8SGlenn Strauss  $ less LightyTest.pm
28140c0fb8SGlenn Strauss
29140c0fb8SGlenn Strauss  $ TRACEME=strace   ./request.t   # output to file 'strace'
30140c0fb8SGlenn Strauss  $ TRACEME=truss    ./request.t   # output to file 'strace'
31140c0fb8SGlenn Strauss  $ TRACEME=gdb      ./request.t   # not for interactive debugging (see below)
32140c0fb8SGlenn Strauss  $ TRACEME=valgrind ./request.t
33140c0fb8SGlenn Strauss
34140c0fb8SGlenn StraussTo reduce noise from valgrind --show-leak-kinds=all (or =reachable), avoid FAM.
35140c0fb8SGlenn StraussUse server.stat-cache-engine = "simple" (not server.stat-cache-engine = "fam")
36140c0fb8SGlenn Straussin lighttpd.conf.  (FAM creates /usr/libexec/gam_server as child process.)
37140c0fb8SGlenn Strauss
38140c0fb8SGlenn Strauss
39140c0fb8SGlenn StraussRunning lighttpd server with a config from tests/*.conf
40140c0fb8SGlenn Strauss-------------------------------------------------------
41140c0fb8SGlenn Strauss
42140c0fb8SGlenn StraussEach *.t loads the lighttpd server with one or more config files.
43140c0fb8SGlenn StraussSee each *.t for which config file is used, e.g. tests/lighttpd.conf
44140c0fb8SGlenn Strauss
45140c0fb8SGlenn StraussTo run a specific config
46140c0fb8SGlenn Strauss  repo=$PWD      # from root of src repository
47140c0fb8SGlenn Strauss  cd tests/
48140c0fb8SGlenn Strauss  ./prepare.sh
49b598bb53SGlenn Strauss  PERL=/usr/bin/perl SRCDIR=$repo/tests \
50140c0fb8SGlenn Strauss    $repo/src/lighttpd -D -f lighttpd.conf -m $repo/src/.libs
51140c0fb8SGlenn Strauss
52140c0fb8SGlenn StraussThe PERL, PHP, and SRCDIR environment variables are set by LightyTest.pm
53140c0fb8SGlenn Strausswhen 'make check' is run.  PERL and PHP can be set to paths to perl and php,
54b598bb53SGlenn Strausse.g. export PERL=/usr/bin/perl
55140c0fb8SGlenn Strauss
56140c0fb8SGlenn StraussTo run a specific config under gdb
57140c0fb8SGlenn Strauss  repo=$PWD      # from root of src repository
58140c0fb8SGlenn Strauss  cd tests/
59140c0fb8SGlenn Strauss  ./prepare.sh
60b598bb53SGlenn Strauss  PERL=/usr/bin/perl SRCDIR=$repo/tests \
61b598bb53SGlenn Strauss    gdb --args $repo/src/lighttpd -D -f lighttpd.conf -m $repo/src/.libs
62140c0fb8SGlenn Strauss
63140c0fb8SGlenn Strauss  (gdb) start
64140c0fb8SGlenn Strauss  (gdb) ...
65140c0fb8SGlenn Strauss
66140c0fb8SGlenn Strauss
67140c0fb8SGlenn StraussHints and tips
68140c0fb8SGlenn Strauss--------------
69140c0fb8SGlenn StraussQ: What do I do if tests fail with:
70140c0fb8SGlenn Strauss     bind: Address already in use at LightyTest.pm line 429.
71140c0fb8SGlenn StraussA: It is likely that something else on the machine is already using the port
72140c0fb8SGlenn Strauss   that tests are trying to use to run a backend.  Try exiting out of your web
73140c0fb8SGlenn Strauss   browser and then run the tests again.  (root can use 'netstat' or 'ss' to
74140c0fb8SGlenn Strauss   find out which process is using the port.)
75140c0fb8SGlenn Strauss
76140c0fb8SGlenn Strauss
77140c0fb8SGlenn StraussAdditional documentation
78140c0fb8SGlenn Strauss------------------------
79140c0fb8SGlenn Strausshttps://redmine.lighttpd.net/projects/lighttpd/wiki/RunningUnitTests
80140c0fb8SGlenn Strausshttps://redmine.lighttpd.net/projects/lighttpd/wiki/HowToReportABug
81140c0fb8SGlenn Strausshttps://redmine.lighttpd.net/projects/lighttpd/wiki/DebugVariables
82