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