README 2.6 KB

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