X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f3f065bbe8b7d7fdc4d46dbfa063ae4dfb05bfd7..1058096b8c5317376c1df7473f6ca7c543d20715:/test/README?ds=inline diff --git a/test/README b/test/README index 5c060974c..bca17eb18 100644 --- a/test/README +++ b/test/README @@ -1,12 +1,10 @@ -$Cambridge: exim/test/README,v 1.7 2007/01/31 16:52:12 ph10 Exp $ - EXPORTABLE EXIM TEST SUITE -------------------------- This document last updated for: -Test Suite Version: 4.67 -Date: 31 January 2007 +Test Suite Version: 4.87 +Date: 30 January 2016 BACKGROUND @@ -65,18 +63,29 @@ In order to run this test suite, the following requirements must be met: Defaults timestamp_timeout=480 in /etc/sudoers, a password lasts for 8 hours (a working day). It is - probably not a good idea to run the tests as the Exim user, as this is - recognized as special by Exim. - -(3) The login under which you run the tests must be in the exim group so that - it has access to logs, spool files, etc. The login should not be one of the - names "userx", "usery", "userz", or a few other simple ones such as "abcd" - and "xyz" and single letters that are used in the tests. The test suite - expects the login to have a gecos name; I think it will now run if the - gecos field is empty but there may be anomalies. + not permitted to run the tests as the Exim user because the test suite + tracks the two users independently. Using the same user would result + in false positives on some tests. + + Further, some tests invoke sudo in an environment where there might not be + a TTY, so tickets should be global, not per-TTY. Taking this all together + and assuming a user of "exim-build", you might have this in sudoers: + + Defaults:exim-build timestamp_timeout=480,!tty_tickets + +(3) The login under which you run the tests must have the exim group as a + secondary so that it has access to logs, spool files, etc. However, it + should have a different primary group (eg. "users" vs. "eximgroup"). The + login should not be one of the names "userx", "usery", "userz", or a few + other simple ones such as "abcd" and "xyz" and single letters that are used + in the tests. The test suite expects the login to have a gecos name; I think + it will now run if the gecos field is empty but there may be anomalies. + The login must not contain a dash or an equal sign. (Otherwise some tests + about local_from_{suffix,prefix} will fail.) (4) The directory into which you unpack the test suite must be accessible by - the Exim user, so that code running as exim can access the files therein. A + the Exim user, so that code running as exim can access the files therein. + This includes search-access on all path elements leading to it. A world-readable directory is fine. However, there may be problems if the path name of the directory is excessively long. This is because it sometimes appears in log lines or debug output, and if it is truncated, it @@ -85,9 +94,10 @@ In order to run this test suite, the following requirements must be met: (5) Exim must be built with its user and group specified at build time, and with certain minimum facilities, namely: - Routers: accept, dnslookup, manualroute, redirect - Transports: appendfile, autoreply, pipe, smtp - Lookups: lsearch + Routers: accept, dnslookup, manualroute, redirect + Transports: appendfile, autoreply, pipe, smtp + Lookups: lsearch + Authenticators: plaintext Most Exim binaries will have these included. @@ -105,7 +115,23 @@ In order to run this test suite, the following requirements must be met: is also an IPv6 address, additional tests are run when the Exim binary contains IPv6 support. There are checks in the scripts for a running IPv4 interface; when one is not found, some tests are skipped (with a warning - message). + message). The local net may not be in 10.250.0/16 as that is used by the suite. + +(9) Exim must be built with TRUSTED_CONFIG_LIST support, so that the test + configs can be placed into it. A suitable file location is .../exim/test/trusted_configs + with content .../exim/test/test-config [fill out the ... to make full + paths]. This file should be owner/group matching CONFIGURE_OWNER/GROUP, + or root/root, and it has to be accessible for the login, under which + you run the tests. The config files in .../exim/test/confs/ should be + owner/group the same. DISABLE_D_OPTION must not be used. If ALT_CONFIG_PREFIX is used, it + must contain the directory of the test-suite. WHITELIST_D_MACROS should contain: + + DIR:EXIM_PATH:AA:ACL:ACLRCPT:ACL_MAIL:ACL_PREDATA:ACL_RCPT:AFFIX:ALLOW:ARG1:ARG2:AUTHF:AUTHS:AUTH_ID_DOMAIN:BAD:BANNER:BB:BR:BRB:CERT:COM:COMMAND_USER:CONNECTCOND:CONTROL:CREQCIP:CREQMAC:CRL:CSS:D6:DATA:DCF:DDF:DEFAULTDWC:DELAY:DETAILS:DRATELIMIT:DYNAMIC_OPTION:ELI:ERROR_DETAILS:ERT:FAKE:FALLBACK:FILTER:FILTER_PREPEND_HOME:FORBID:FORBID_SMTP_CODE:FUSER:HAI:HAP:HARDLIMIT:HEADER_LINE_MAXSIZE:HEADER_MAXSIZE:HELO_MSG:HL:HOSTS:HOSTS_AVOID_TLS:HOSTS_MAX_TRY:HVH:IFACE:IGNORE_QUOTA:INC:INSERT:IP1:IP2:LAST:LDAPSERVERS:LENCHECK:LIMIT:LIST:LOG_SELECTOR:MAXNM:MESSAGE_LOGS:MSIZE:NOTDAEMON:ONCE:ONLY:OPT:OPTION:ORDER:PAH:PEX:PORT:PTBC:QDG:QOLL:QUOTA:QUOTA_FILECOUNT:QWM:RCPT_MSG:REMEMBER:REQUIRE:RETRY:RETRY1:RETRY2:RETURN:RETURN_ERROR_DETAILS:REWRITE:ROUTE_DATA:RRATELIMIT:SELECTOR:SELF:SERVER:SERVERS:SREQCIP:SREQMAC:SRV:STRICT:SUB:SUBMISSION_OPTIONS:TIMEOUTDEFER:TIMES:TRUSTED:TRYCLEAR:UL:USE_SENDER:UTF8:VALUE:WMF + +(10) Exim must *not* be built with USE_READLINE, as the test-suite's automation + assumes the simpler I/O model. + Exim must *not* be built with HEADERS_CHARSET set to UTF-8. + OPTIONAL EXTRAS @@ -120,17 +146,20 @@ the extra functionality, except for a few special cases such as the databases RUNNING THE TEST SUITE ---------------------- -(1) Download the tarball exim-testsuite-x.xx.tar.bz2 and unpack it, preferably - in a directory alongside an Exim source directory (see below). +(1) Clone the git tree for Exim. This include both the Exim source and the + testsuite. + +(2) cd into the test/ subdirectory (where this README lives). -(2) cd into the exim-testsuite-x.xx directory. +(3) Run "./configure" and then "make". This builds a few auxiliary programs that + are written in C. -(3) Run "./configure" and then "make". This builds a few auxiliary programs - that are written in C. +(4) echo $PWD/test-config >> your_TRUSTED_CONFIG_LIST_filename + Typically that is .../exim/test/trusted_configs -(4) Run "./runtest" (a Perl script) as described below. +(5) Run "./runtest" (a Perl script) as described below. -(5) If you want to see what tests are available, run "./listtests". +(6) If you want to see what tests are available, run "./listtests". BREAKING OUT OF THE TEST SCRIPT @@ -186,10 +215,12 @@ THE RUNTEST SCRIPT ------------------ If you do not supply any arguments to ./runtest, it searches for an Exim -source tree at the same level as the test suite directory. It then looks for an -Exim binary in a "build" directory of that source tree. If there are several -Exim source trees, it chooses the latest version of Exim. Consider the -following example: +source tree at the same level as the test suite directory. A source tree +is a source tree, if it contains a build-* directory. + +It then looks for an Exim binary in a "build" directory of that source +tree. If there are several Exim source trees, it chooses the latest +version of Exim. Consider the following example: $ ls -F /source/exim exim-4.60/ exim-4.62/ exim-testsuite-x.xx/ @@ -216,6 +247,11 @@ is as follows: There are some options for the ./runtest script itself: + -CONTINUE This will allow the script to move past some failing tests. It will + write a simple failure line with the test number in a temporary + logfile test/failed-summary.log. Unexpected exit codes will still + stall the test execution and require interaction. + -DEBUG This option is for debugging the test script. It causes some tracing information to be output. @@ -228,6 +264,21 @@ There are some options for the ./runtest script itself: (If it turns out that most people prefer to use diff, I'll change the default.) + -FLAVOR + -FLAVOUR + This allows "overrides" for the test results. It's intended + use is to deal with distro specific differences in the test + output. The default flavour is "FOO" if autodetection fails. + (Autodetection is possible for known flavours only. Known + flavours are computed after file name extensions in stdout/* + and stderr/*.) + + If during the test run differences between the current and + the expected output are found and no flavour file exists already, + you may update the "common" expected output or you may create a + flavour file. If a flavour file already exists, any updates will go + into that flavour file! + -KEEP Normally, after a successful run, the test output files are deleted. This option prevents this. It is useful when running a single test, in order to look at the actual output before it is @@ -247,6 +298,9 @@ There are some options for the ./runtest script itself: maintainer after making a change to the code that affects a lot of tests (for example, the wording of a message). + -SLOW For very slow hosts that appear to have Heisenbugs, delay before + comparing output files from a testcase + The options for ./runtest must be given first (but after the name of the binary, if present). Any further options, that is, items on the command line that start with a hyphen, are passed to the Exim binary when it is run as part @@ -342,7 +396,7 @@ default, the output is from the "cf" program, and might look like this: 1 difference found. "test-stdout-munged" contains 16 lines; "stdout/1300" contains 18 lines. - Continue, Update & retry, Quit? [Q] + Continue, Retry, Update & retry, Quit? [Q] This example was generated by running the test with a version of Exim that had a bug in the exim_dbmbuild utility (the bug was fixed at release @@ -351,7 +405,7 @@ used. In this case, the standard output differed from what was expected. The reply to the prompt must either be empty, in which case it takes the default that is given in brackets (in this case Q), or a single letter, in -upper or lower case (in this case, one of C, U, or Q). If you type anything +upper or lower case (in this case, one of C, R, U, or Q). If you type anything else, the prompt is repeated. "Continue" carries on as if the files had matched; that is, it ignores the @@ -361,9 +415,11 @@ moving on to the next test. "Update & retry" copies the new file to the saved file, and reruns the test after doing any further comparisons that may be necessary. +"Retry" does the same apart from the file copy. + Other circumstances give rise to other prompts. If a test generates output for which there is no saved data, the prompt (after a message stating which file is -unexpectely not empty) is: +unexpectedly not empty) is: Continue, Show, or Quit? [Q] @@ -398,6 +454,40 @@ OTHER ISSUES . Test 0142 tests open file descriptors; on some hosts the output may vary. +. Some tests may fail, for example 0022, because it says it uses cached data + when the expected output thinks it should not be in cache. Item #5 in the + Requirements section has: + "Exim must be built with its user and group specified at build time" + This means that you cannot use the "ref:username" in your Local/Makefile + when building the exim binary, in any of the following fields: + EXIM_USER EXIM_GROUP CONFIGURE_OWNER CONFIGURE_GROUP + +. If the runtest script warns that the hostname is not a Fully Qualified + Domain Name (FQDN), expect that some tests will fail, for example 0036, + with an extra log line saying the hostname doesn't resolve. You must use a + FQDN for the hostname for proper test functionality. + +. If you change your hostname to a FQDN, you must delete the test/dnszones + subdirectory. When you next run the runtest script, it will rebuild the + content to use the new hostname. + +. If your hostname has an uppercase characters in it, expect that some tests + will fail, for example, 0036, because some log lines will have the hostname + in all lowercase. The regex which extracts the hostname from the log lines + will not match the lowercased version. + +. Some tests may fail, for example 0015, with a cryptic error message: + Server return code 99 + Due to security concerns, some specific files MUST have the group write bit + off. For the purposes of the test suite, some test/aux-fixed/* files MUST + have the group write bit off, so it's easier to just remove the group write + bit for all of them. If your umask is set to 002, the group write bit will + be on by default and you'll see this problem, so make sure your umask is + 022 and re-checkout the test/ subdirectory. + +. Some tests will fail if the username and group name are different. It does + not have to be the primary group, a secondary group is sufficient. + OTHER SCRIPTS AND PROGRAMS -------------------------- @@ -427,6 +517,9 @@ bin/client-ssl A script-driven SMTP client simulation with OpenSSL support. This is built only if OpenSSL support is detected on the host. +bin/client-anytls A symlink to either client-ssl or client-gnutls, if + any is built. + bin/fakens A fake "nameserver" for DNS tests (see below for details). bin/fd A program that outputs details of open file descriptors. @@ -468,6 +561,7 @@ here: PORT_D is replaced by a port number for normal daemon use PORT_N is replaced by a port number that should never respond PORT_S is replaced by a port number for normal bin/server use + PORT_DYNAMIC is replaced by a port number allocated dynamically TESTNUM is replaced by the current test number V4NET is replaced by an IPv4 network number for testing V6NET is replaced by an IPv6 network number for testing @@ -478,6 +572,10 @@ testing purposes, and for testing Exim with -bh. The only requirement is that they are networks that can never be used for an IP address of a real host. I've chosen two multicast networks for the moment. +PORT_DYNAMIC is allocated by hunting for a free port (starting at port +1024) a listener can bind to. This is done by runtest, for simulating +inetd operations. + If the host has no IPv6 address, "" is substituted but that does not matter because no IPv6 tests will be run. A similar substitution is made if there is no IPv4 address, and again, tests that actually require a @@ -593,7 +691,7 @@ just one command: The expected return code in this case is 1, and the data lines are passed to Exim on its standard input. Both the command line and the data lines have the -standard substitions applied to them. Thus, HOSTNAME in the example above will +standard substitutions applied to them. Thus, HOSTNAME in the example above will be replaced by the local host's name. Long commands can be continued over several lines by using \ as a continuation character. This does *not* apply to data lines. @@ -607,6 +705,11 @@ Commands with no input These commands are not followed by any input data, or by a line of asterisks. + ### This is a verbose comment + +A line starting with three hashmarks and some space copies the following text to +both stdout and stderr file being written by the test. + dbmbuild This command runs the exim_dbmbuild utility to build a DBM file. It is used @@ -614,7 +717,7 @@ only when DBM support is available in Exim, and typically follows the use of a "write" command (see below) that creates the input file. - dumpdb + dump This command runs the exim_dumpdb utility on the testing spool directory, using the database name given, for example: "dumpdb retry". @@ -629,7 +732,8 @@ scripts. exim_lock [options] This command runs the exim_lock utility with the given options and file name. -The file remains locked with the following command (normally exim) is obeyed. +The file remains locked for following commands until a non-daemon "exim" +completes. exinext @@ -665,6 +769,12 @@ This command causes the script to sleep for m milliseconds. Nothing is output to the screen. + munge + +This command requests custom munging of the test outputs. The munge names +used are coded in the runtest script (look for 'name of munge'). + + need_ipv4 This command must be at the head of a script. If no IPv4 interface has been @@ -680,7 +790,7 @@ found, the entire script is skipped, and a comment is output. need_largefiles This command must be at the head of a script. If the Exim binary does not -suppport large files (off_t is <= 4), the entire script is skipped, and a +support large files (off_t is <= 4), the entire script is skipped, and a comment is output. @@ -749,9 +859,31 @@ Commands with input ------------------- The remaining commands are followed by data lines for their standard input, -terminated by four asterisks. Even if no data is required for the particular +terminated by four asterisks ("****"). Even if no data is required for the particular usage, the asterisks must be given. +If the input line starts with '::', this prefix is removed and the +line is processed by the runtest script before sending. The following +commands are recognised: + +- "eval": process the reset of the line with Perl's string eval() + function. This can be used to send arbitrary data by encoding it as + escape sequences (e.g. "\x41\101"). If you need a line ending, you have + to append it accordingly (e.g. "\r\n"). + +- "noeol": do not terminate the data sent to the application with an end + of line character. + +- "sleep": interpret the rest of the line as an integer and sleep for + that number of seconds before proceeding. No data will be output to + the application. + + + background + +This command takes one script line and runs it in the background, +in parallel with following commands. For external daemons, eg. redis-server. + catwrite [nxm[=start-of-line-text]]* @@ -760,14 +892,16 @@ except that the data it generates is copied to the end of the test-stdout file as well as to the named file. - client [] [] This command runs the auxiliary "client" program that simulates an SMTP client. It is controlled by a script read from its standard input, details of which are -given below. The only option is -t, which must be followed by a number, to -specify the command timeout in seconds. The program connects to the given IP -address and port, using the specified interface, if one is given. +given below. There are two options. One is -t, which must be followed directly +by a number, to specify the command timeout in seconds (e.g. -t5). The default +timeout is 5 seconds. The other option is -tls-on-connect, which causes the +client to try to start up a TLS session as soon as it has connected, without +using the STARTTLS command. The client program connects to the given IP address +and port, using the specified interface, if one is given. client-ssl [] [] \ @@ -775,9 +909,11 @@ address and port, using the specified interface, if one is given. When OpenSSL is available on the host, an alternative version of the client program is compiled, one that supports TLS using OpenSSL. The additional -arguments specify a certificate and key file when required. There is one -additional option, -tls-on-connect, that causes the client to initiate TLS -negotiation immediately on connection. +arguments specify a certificate and key file when required for the connection. +There are two additional options: -tls-on-connect, that causes the client to +initiate TLS negotiation immediately on connection; -ocsp that causes the TLS +negotiation to include a certificate-status request. The latter takes a +filename argument, the CA info for verifying the stapled response. client-gnutls [] [] \ @@ -808,6 +944,11 @@ example: Finally, "exim" can be preceded by "sudo", to run Exim as root. If more than one of these prefixes is present, they must be in the above order. +If the options include "-DSERVER" but not "-DNOTDAEMON", the script waits for +Exim to start but then continues without waiting for it to terminate. Typically +this will be for a daemon-mode "-bd" operation. The daemon should be later +terminated using "killdaemon". + exim_exim [] [] @@ -823,13 +964,17 @@ input, details of which are given below. A number of options are implemented: -d causes the server to output debugging information - -t sets a timeout in seconds (default 5) for when the server is - awaiting an incoming connection + -t sets a timeout (default 5) for when the server is + awaiting an incoming connection. If negative, the + absolute value is used and a timeout results in a + nonfailure exit code -noipv4 causes the server not to set up an IPv4 socket -noipv6 causes the server not to set up an IPv6 socket + -i sets an initial pause, to delay before creating the listen sockets + By default, in an IPv6 environment, both kinds of socket are set up. However, the test script knows which interfaces actually exist on the host, and it adds -noipv4 or -noipv6 to the server command as required. An error occurs if both @@ -848,8 +993,9 @@ connections. Here are some example commands: The following lines, up to a line of four asterisks, are the server's controlling standard input (described below). These lines are read and -remembered; during the following commands, until an "exim" command is reached, -the server is run in parallel. +remembered; during the following commands, until a non-deamon "exim" command +is reached, the server is run in parallel. Then the server termination +is waited for. write [nxm[=start-of-line-text]]* @@ -896,23 +1042,43 @@ one-off things to be done. CLIENT SCRIPTS -------------- -Lines in client scripts are of two kinds: +Lines in client scripts are of several kinds: -(1) If a line begins with three question marks and a space, the rest of the +(1) "??? ": If a line begins with three question marks and a space, the rest of the line defines the start of expected output from the server. If what is received does not match, the client bombs out with an error message. -(2) If a line starts with three plus signs followed by a space, the rest of the +(2) "???*": If a line begins with three question marks and an asterisk, the server + is expected to close the connection. + +(3) "????": If a line begins with four question marks, the rest of the line defines + the start of one or more possible output lines from the server. When it + matches, the client silently repeats the comparison using the next server + line. When the match fails, the client silently proceeds to the next script + line with the then-current server output unconsumed. + +(4) "+++ ": If a line starts with three plus signs followed by a space, the rest of the line specifies a number of seconds to sleep for before proceeding. -(3) Otherwise, the line is an input line line that is sent to the server. Any +(5) ">>> ": If a line begins with three '>' characters and a space, the rest of the + line is input to be sent to the server. Backslash escaping is done as + described below, but no trailing "\r\n" is sent. + +(6) "<<< ": If a line begin with three '<' characters and a space, the rest of the + line is a filename; the content of the file is inserted into the script + at this point. + +(7) Otherwise, the line is an input line line that is sent to the server. Any occurrences of \r and \n in the line are turned into carriage return and linefeed, respectively. This is used for testing PIPELINING. + Any sequences of \x followed by two hex digits are converted to the equivalent + byte value. Any other character following a \ is sent verbatim. + The line is sent with a trailing "\r\n". Here is a simple example: client 127.0.0.1 PORT_D - ??? 250 + ??? 220 EHLO xxx ??? 250- ??? 250 @@ -945,21 +1111,30 @@ are of the following kinds: (d) If the line starts with ">*eof", nothing is sent and the connection is closed. - The data that is sent starts after the initial '>' sequence. + The data that is sent starts after the initial '>' sequence. Within + each line the sequence '\x' followed by two hex digits can be used + to specify an arbitrary byte value. The sequence '\\' specifies a + single backslash. (2) A line that starts with "*sleep" specifies a number of seconds to wait before proceeding. -(3) A line containing "*eof" specifies that the client is expected to close +(3) A line containing "*data" and a number specifies that the client is + expected to send that many byte; the server discards them + +(4) A line containing "*eof" specifies that the client is expected to close the connection at this point. -(4) A line containing just '.' specifies that the client is expected to send +(5) A line containing just '.' specifies that the client is expected to send many lines, terminated by one that contains just a dot. -(5) Otherwise, the line defines the start of an input line that the client +(6) Otherwise, the line defines the start of an input line that the client is expected to send. To allow for lines that start with digits, the line may start with '<', which is not taken as part of the input data. If the - input does not match, the server bombs out with an error message. + lines starts with '<<' then only the characters are expected; no return- + linefeed terminator. If the input does not match, the server bombs out + with an error message. Backslash-escape sequences may be used in the + line content as for output lines. Here is a simple example of server use in a test script: @@ -1005,7 +1180,7 @@ indicating that they are specific to that one test. A few fixed files (for example, some TLS certificates) are used by more than one test, and so their names are not of this form. -There are also some auxilary DNS zone files, which are described in the next +There are also some auxiliary DNS zone files, which are described in the next section. @@ -1042,8 +1217,15 @@ directory by applying the standard substitutions. The test suite also builds dynamic zone files for the name of the current host and its IP address(es). The idea is that there should not be any need to rely on an external DNS. -The domain names that are handled directly by Exim, without being passed to -fakens, are: +The fakens program handles some names programmatically rather than using the +fake zone files. These are: + + manyhome.test.ex This name is used for testing hosts with ridiculously large + numbers of IP addresses; 2048 IP addresses are generated + and returned. Doing it this way saves having to make the + interface to fakens handle more records that can fit in the + data block. The addresses that are generated are in the + 10.250.0.0/16 network. test.again.dns This always provokes a TRY_AGAIN response, for testing the handling of temporary DNS error. If the full domain name @@ -1052,23 +1234,12 @@ fakens, are: test.fail.dns This always provokes a NO_RECOVERY response, for testing DNS server failures. -This special handling could now be done in the fakens program, but while the -old test suite is still being used it has to be done in Exim itself, so for the -moment it remains there. - The use of gethostbyname() and its IPv6 friends is also subverted when Exim is running in the test harness. The test code handles a few special names directly; for all the others it uses DNS lookups, which are then handled as just described. Thus, the use of /etc/hosts is completely bypassed. The names that are specially handled are: - manyhome.test.ex This name is used for testing hosts with ridiculously large - numbers of IP addresses; 2048 IP addresses are generated - and returned. Doing it this way saves having to make the - interface to fakens handle more records that can fit in the - data block. The addresses that are generated are in the - 10.250.0.0/16 network. - localhost Always returns 127.0.0.1 or ::1, for IPv4 and IPv6 lookups, respectively.