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