[4b53371] | 1 | Unit Tests for Apache's mod_gnutls |
---|
| 2 | ================================== |
---|
| 3 | |
---|
[26081ce] | 4 | Authors: Daniel Kahn Gillmor <dkg@fifthhorseman.net> |
---|
| 5 | Thomas Klute <thomas2.klute@uni-dortmund.de> |
---|
[4b53371] | 6 | |
---|
| 7 | There are a lot of ways that a TLS-capable web server can go wrong. I |
---|
| 8 | want to at least test for some basic/common configurations. |
---|
| 9 | |
---|
| 10 | |
---|
| 11 | Running the tests |
---|
| 12 | ================= |
---|
| 13 | |
---|
[e78bc78] | 14 | from the top level of the source, or from test/ (where this README is), |
---|
[0f5c9e1] | 15 | just run: |
---|
[4b53371] | 16 | |
---|
| 17 | make check |
---|
| 18 | |
---|
[7813802] | 19 | from test/ you can also run specific tests by passing their script |
---|
| 20 | names to make in the TESTS variable: |
---|
[4b53371] | 21 | |
---|
[7813802] | 22 | TESTS="test-03_cachetimeout_in_vhost.bash" make -e check |
---|
[4b53371] | 23 | |
---|
| 24 | This should be handy when you're just trying to experiment with a new |
---|
| 25 | test and don't want to wait for the full test suite to run. |
---|
| 26 | |
---|
[dff57b4] | 27 | The default configuration assumes that a loopback device with IPv4 and |
---|
| 28 | IPv6 support is available (TEST_IP="[::1] 127.0.0.1") and that |
---|
| 29 | TEST_HOST="localhost" resolves to at least one of these addresses. If |
---|
| 30 | this does not apply to your system, you can pass different values to |
---|
| 31 | ./configure, e.g. to use IPv4 only: |
---|
[26081ce] | 32 | |
---|
| 33 | TEST_HOST="localhost" TEST_IP="127.0.0.1" ./configure |
---|
[4b53371] | 34 | |
---|
[fc8e463b] | 35 | |
---|
[4b53371] | 36 | Adding a Test |
---|
| 37 | ============= |
---|
| 38 | |
---|
| 39 | Please add more tests! |
---|
| 40 | |
---|
[e78bc78] | 41 | The simplest way to add a test is (from test/): |
---|
[4b53371] | 42 | |
---|
| 43 | ./newtest |
---|
| 44 | |
---|
[e78bc78] | 45 | This will prompt you for a simple name for the test and then copy a |
---|
| 46 | starting set of files from tests/00_basic, and create a script which |
---|
| 47 | you can add to TESTS in Makefile.am when your test is ready for |
---|
| 48 | inclusion in the test suite. |
---|
[4b53371] | 49 | |
---|
| 50 | |
---|
| 51 | Implementation |
---|
| 52 | ============== |
---|
| 53 | |
---|
[e78bc78] | 54 | Each test consists of a directory in test/tests/, which will cause the |
---|
[4b53371] | 55 | test suite to spin up an isolated apache instance and try to connect |
---|
| 56 | to it with gnutls-cli and make a simple HTTP 1.1 request. |
---|
| 57 | |
---|
| 58 | By default, these tests are expected to succeed, by having |
---|
| 59 | |
---|
| 60 | In each directory, you can put the following files: |
---|
| 61 | |
---|
| 62 | * apache.conf -- the apache configuration to be used |
---|
| 63 | |
---|
| 64 | * gnutls-cli.args -- the arguments to pass to gnutls-cli |
---|
| 65 | |
---|
| 66 | * input -- the full HTTP request (including the final blank line) |
---|
| 67 | |
---|
| 68 | * output [optional] -- the lines of this file will be checked against |
---|
| 69 | the same number of lines at the end of the output produced by the |
---|
| 70 | gnutls-cli process. |
---|
| 71 | |
---|
| 72 | * fail.server [optional] -- if this file exists, it means we expect |
---|
| 73 | the web server to fail to even start due to some serious |
---|
| 74 | configuration problem. |
---|
| 75 | |
---|
| 76 | * fail.client [optional] -- if this file exists, it means we expect |
---|
| 77 | the client to fail to fetch its file. If you already have |
---|
| 78 | fail.server, do not also specify this; we know that a failed server |
---|
| 79 | should result in a failed file retrieval. |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | Robustness and Tuning |
---|
| 83 | ===================== |
---|
| 84 | |
---|
| 85 | These tests aren't nearly as robust as i'd like them to be, but they |
---|
| 86 | work for the moment and they're better than no tests at all. |
---|
| 87 | |
---|
| 88 | Here are some things that you might want to tune based on your |
---|
| 89 | expected setup (along with the variables that can be passed to "make |
---|
| 90 | check" to adjust them): |
---|
| 91 | |
---|
[26081ce] | 92 | * they need a functioning loopback device. |
---|
[4b53371] | 93 | |
---|
[dff57b4] | 94 | * they expect (by default) to have port 9932 [TEST_PORT] available |
---|
| 95 | and open for connections on the addresses listed in TEST_IP. |
---|
[4b53371] | 96 | |
---|
| 97 | * if a machine is particularly slow or under heavy load, it's |
---|
| 98 | possible that these tests will fail for timing |
---|
| 99 | reasons. [TEST_QUERY_DELAY (seconds for the http request to be sent |
---|
[34e5dc7] | 100 | and responded to)] |
---|
[f9f184f] | 101 | |
---|
| 102 | In some situations you may want to see the exact environment as |
---|
| 103 | configured by make, e.g. if you want to manually run an Apache |
---|
| 104 | instance with Valgrind using the same configuration as a test |
---|
| 105 | case. Use "make show-test-env" to dump AM_TESTS_ENVIRONMENT to stdout. |
---|