[exim-cvs] Testsuite: Provide '>>> ' for script input to all…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] Testsuite: Provide '>>> ' for script input to allow binary data
Gitweb: https://git.exim.org/exim.git/commitdiff/f7ec095232186edba2b7137594bfdd7d7b7f9504
Commit:     f7ec095232186edba2b7137594bfdd7d7b7f9504
Parent:     f093e580a55ad4d41a3ba70bae265b131b5c3bbb
Author:     Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Sat Oct 3 19:43:48 2020 +0200
Committer:  Heiko Schlittermann (HS12-RIPE) <hs@???>
CommitDate: Sat Oct 3 19:48:09 2020 +0200


    Testsuite: Provide '>>> ' for script input to allow binary data


    This mimics the '>>> ' prefix 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.
---
 test/README                  | 7 ++++++-
 test/runtest                 | 8 +++++---
 test/scripts/0000-Basic/0100 | 6 +++---
 test/scripts/0000-Basic/0101 | 6 +++---
 test/scripts/0000-Basic/0242 | 4 ++--
 5 files changed, 19 insertions(+), 12 deletions(-)


diff --git a/test/README b/test/README
index d944b29..34f09ff 100644
--- a/test/README
+++ b/test/README
@@ -862,6 +862,12 @@ 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', '\r', and
+such. If you need a line feed there, you need to encode it according to your
+needs.
+

background

@@ -876,7 +882,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.
diff --git a/test/runtest b/test/runtest
index 4972aed..9621e27 100755
--- a/test/runtest
+++ b/test/runtest
@@ -2766,8 +2766,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.

@@ -2781,7 +2782,8 @@ while (<SCRIPT>)
$lineno++;
last if /^\*{4}\s*$/;
do_substitute($testno);
- if (/^(.*)\\NONL\\\s*$/) { print CMD $1; } else { print CMD; }
+ 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 a8cf686..e31e980 100644
--- a/test/scripts/0000-Basic/0100
+++ b/test/scripts/0000-Basic/0100
@@ -78,7 +78,7 @@ exim -odi userx@??? <test-data
****
exim -odi userx@???
Last line ending without a newline and with a partial match:
-From\NONL\
+>>> From
****
exim -odi filter-userx@???
Test message
@@ -91,11 +91,11 @@ From: is how headers start
****
exim -odi filter-userx@???
Last line ending without a newline and with a partial match:
-From\NONL\
+>>> From
****
exim -odi userx@???
Last line ending without a newline and being a single dot:
-.\NONL\
+>>> .
****
exim -odi mmdf-userx@???
Line consisting of four ^A characters
diff --git a/test/scripts/0000-Basic/0101 b/test/scripts/0000-Basic/0101
index 12f73c0..512a60e 100644
--- a/test/scripts/0000-Basic/0101
+++ b/test/scripts/0000-Basic/0101
@@ -61,7 +61,7 @@ exim -odi userx@??? <test-data
****
exim -odi userx@???
Last line ending without a newline and with a partial match:
-From\NONL\
+>>> From
****
exim -odi filter-userx@???
Test message
@@ -74,11 +74,11 @@ From: is how headers start
****
exim -odi filter-userx@???
Last line ending without a newline and with a partial match:
-From\NONL\
+>>> From
****
exim -odi userx@???
Last line ending without a newline and being a single dot:
-.\NONL\
+>>> .
****
exim -odi mmdf-userx@???
Line consisting of four ^A characters
diff --git a/test/scripts/0000-Basic/0242 b/test/scripts/0000-Basic/0242
index 38e49ed..995f5cc 100644
--- a/test/scripts/0000-Basic/0242
+++ b/test/scripts/0000-Basic/0242
@@ -17,7 +17,7 @@ QUIT
250 OK
****
exim -odi abc@???
-Test message\NONL\
+>>> Test message
****
server PORT_S
220 Server ready
@@ -35,5 +35,5 @@ QUIT
250 OK
****
exim -odi abc@???
-Subject: Test message\NONL\
+>>> Subject: Test message
****