diff options
author | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2020-10-03 19:43:48 +0200 |
---|---|---|
committer | Heiko Schlittermann (HS12-RIPE) <hs@schlittermann.de> | 2020-10-04 11:20:55 +0200 |
commit | 0dfff3282dcfbee8f1568797c2acd4983674c0d9 (patch) | |
tree | 12a6576a0e7270ed4956f3971162c514c21d96b6 | |
parent | 8e2fe7340c5d6abf952c45bc6b96462b8e809b94 (diff) |
Testsuite: Provide '>>> ' for script input to allow binary data (take 2)
This mimics the '>>> ' prefix known for the test client. Any line prefixed
with '>>> ' will be processed by Perl's string eval().
As '>>> ' is generic and documented, it replaces the (undocumented)
'\NONL\' tag.
The client input lines starting with '>>> ' are now changed to '\>>> '
to avoid evaluation by the runtest script. (Test 4030, 1101).
-rw-r--r-- | test/README | 18 | ||||
-rwxr-xr-x | test/runtest | 8 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0100 | 6 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0101 | 6 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0242 | 4 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0900 | 2 | ||||
-rw-r--r-- | test/scripts/0000-Basic/0901 | 4 | ||||
-rw-r--r-- | test/scripts/1100-Basic-TLS/1101 | 2 | ||||
-rw-r--r-- | test/scripts/4030-proxy-protocol/4030 | 2 |
9 files changed, 33 insertions, 19 deletions
diff --git a/test/README b/test/README index d944b29ac..7a852ee43 100644 --- a/test/README +++ b/test/README @@ -862,6 +862,16 @@ 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 usage, the asterisks must be given. +If the input line starts with '>>> ', this prefix and any trailing spaces +(including line feed) are removed. The reminder is processed with Perl's +string eval() function, effectivly evaluatiing escape sequences like +'\x41', or '\r'. If you need a line feed there, you need to encode it +according to your needs. + +If the input line starts with '\>>> ', the backslash is removed and the +rest of the line is passed as input. This is used by the client tool, +which understands the '>>> ' prefix for similar processing. + background @@ -876,7 +886,6 @@ except that the data it generates is copied to the end of the test-stdout file as well as to the named file. - client [<options>] <ip address> <port> [<outgoing interface>] This command runs the auxiliary "client" program that simulates an SMTP client. @@ -1047,10 +1056,13 @@ Lines in client scripts are of several kinds: (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. + described below, but no trailing "\r\n" is sent. As the runtest's + input processing catches the '>>> ' for its string eval, you may + want to escape from this first stage processing by prefixing your + line with '\'. (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 intto the script + 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 diff --git a/test/runtest b/test/runtest index f61b016f9..a4d49aa79 100755 --- a/test/runtest +++ b/test/runtest @@ -2792,8 +2792,9 @@ else { tests_exit(-1, "Command unrecognized in line $lineno: $_"); } # Run the command, with stdin connected to a pipe, and write the stdin data -# to it, with appropriate substitutions. If a line ends with \NONL\, chop off -# the terminating newline (and the \NONL\). If the command contains +# to it, with appropriate substitutions. If a starts with '>>> ', process it +# via Perl's string eval(). +# If the command contains # -DSERVER=server add "-server" to the command, where it will adjoin the name # for the stderr file. See comment above about the use of -DSERVER. @@ -2807,7 +2808,8 @@ while (<SCRIPT>) $lineno++; last if /^\*{4}\s*$/; do_substitute($testno); - if (/^(.*)\\NONL\\\s*$/) { print CMD $1; } else { print CMD; } + s/^\\(>>>\s.*)/$1/ or s/^>>>\s(.*)\s*$/$1/ and $_ = eval "\"$1\""; + print CMD; } # For timeout tests, wait before closing the pipe; we expect a diff --git a/test/scripts/0000-Basic/0100 b/test/scripts/0000-Basic/0100 index a8cf6863d..e31e9809d 100644 --- a/test/scripts/0000-Basic/0100 +++ b/test/scripts/0000-Basic/0100 @@ -78,7 +78,7 @@ exim -odi userx@test.ex <test-data **** exim -odi userx@test.ex Last line ending without a newline and with a partial match: -From\NONL\ +>>> From **** exim -odi filter-userx@test.ex Test message @@ -91,11 +91,11 @@ From: is how headers start **** exim -odi filter-userx@test.ex Last line ending without a newline and with a partial match: -From\NONL\ +>>> From **** exim -odi userx@test.ex Last line ending without a newline and being a single dot: -.\NONL\ +>>> . **** exim -odi mmdf-userx@test.ex Line consisting of four ^A characters diff --git a/test/scripts/0000-Basic/0101 b/test/scripts/0000-Basic/0101 index 12f73c0b8..512a60ea8 100644 --- a/test/scripts/0000-Basic/0101 +++ b/test/scripts/0000-Basic/0101 @@ -61,7 +61,7 @@ exim -odi userx@test.ex <test-data **** exim -odi userx@test.ex Last line ending without a newline and with a partial match: -From\NONL\ +>>> From **** exim -odi filter-userx@test.ex Test message @@ -74,11 +74,11 @@ From: is how headers start **** exim -odi filter-userx@test.ex Last line ending without a newline and with a partial match: -From\NONL\ +>>> From **** exim -odi userx@test.ex Last line ending without a newline and being a single dot: -.\NONL\ +>>> . **** exim -odi mmdf-userx@test.ex Line consisting of four ^A characters diff --git a/test/scripts/0000-Basic/0242 b/test/scripts/0000-Basic/0242 index 38e49edae..995f5cc13 100644 --- a/test/scripts/0000-Basic/0242 +++ b/test/scripts/0000-Basic/0242 @@ -17,7 +17,7 @@ QUIT 250 OK **** exim -odi abc@x.y.z -Test message\NONL\ +>>> Test message **** server PORT_S 220 Server ready @@ -35,5 +35,5 @@ QUIT 250 OK **** exim -odi abc@x.y.z -Subject: Test message\NONL\ +>>> Subject: Test message **** diff --git a/test/scripts/0000-Basic/0900 b/test/scripts/0000-Basic/0900 index 4503ae0c0..af7840470 100644 --- a/test/scripts/0000-Basic/0900 +++ b/test/scripts/0000-Basic/0900 @@ -231,7 +231,7 @@ mail from:someone@some.domain rcpt to:CALLER@test.ex ??? 250 bdat 87 last ->>> To: Susan@random.com\n +\>>> To: Susan@random.com\n From: Sam@random.com Subject: This is a Bodyless test message diff --git a/test/scripts/0000-Basic/0901 b/test/scripts/0000-Basic/0901 index f5a6fff9a..10c582a17 100644 --- a/test/scripts/0000-Basic/0901 +++ b/test/scripts/0000-Basic/0901 @@ -58,7 +58,7 @@ mail from:someone3@some.domain rcpt to:CALLER@test.ex ??? 250 bdat 10 ->>> To: Susan@ +\>>> To: Susan@ ??? 250 bdat 78 last random.com @@ -103,7 +103,7 @@ mail from:someone3A@some.domain rcpt to:CALLER@test.ex ??? 250 bdat 10 ->>> To: Susan@ +\>>> To: Susan@ ??? 250 bdat 78 last random.com diff --git a/test/scripts/1100-Basic-TLS/1101 b/test/scripts/1100-Basic-TLS/1101 index 41407e80b..a1ed5a43b 100644 --- a/test/scripts/1100-Basic-TLS/1101 +++ b/test/scripts/1100-Basic-TLS/1101 @@ -10,7 +10,7 @@ STARTTLS ??? 220 EHLO rhu.barb ????250 ->>> MAIL FROM:<>\r\nRCPT TO:test@example.com\r\n +\>>> MAIL FROM:<>\r\nRCPT TO:test@example.com\r\n ??? 250 OK ??? 250 Accepted (rcpt via callout) QUIT diff --git a/test/scripts/4030-proxy-protocol/4030 b/test/scripts/4030-proxy-protocol/4030 index 1eece1112..154e056d8 100644 --- a/test/scripts/4030-proxy-protocol/4030 +++ b/test/scripts/4030-proxy-protocol/4030 @@ -50,7 +50,7 @@ QUIT # # protocol v2 plain receive client HOSTIPV4 PORT_D ->>> \x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A\x21\x11\x00\x0c\x7f\x00\x00\x02\x7f\x2a\x2a\x2a\xc2\x95\x04\x01 +\>>> \x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A\x21\x11\x00\x0c\x7f\x00\x00\x02\x7f\x2a\x2a\x2a\xc2\x95\x04\x01 ??? 220 HELO clientname ??? 250 |