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