[exim-cvs] Properly detect/set test variables from scripts.

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Exim Git Commits Mailing List
Data:  
Para: exim-cvs
Asunto: [exim-cvs] Properly detect/set test variables from scripts.
Gitweb: http://git.exim.org/exim.git/commitdiff/770feb2f08f38dc1ac8e484659c60c8dd76d370c
Commit:     770feb2f08f38dc1ac8e484659c60c8dd76d370c
Parent:     fca41d5a245023376c7d7716a3f84abc2aaa4b8e
Author:     Todd Lyons <tlyons@???>
AuthorDate: Thu Aug 14 12:36:34 2014 -0700
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Sun Aug 17 16:51:13 2014 +0100


    Properly detect/set test variables from scripts.
---
 doc/doc-txt/ChangeLog |   11 +++++++++++
 test/runtest          |   15 ++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletions(-)


diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index 615b4cf..bb4752f 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -2,6 +2,17 @@ Change log file for Exim from version 4.21
-------------------------------------------


+Exim version 4.85
+-----------------
+TL/01 When running the test suite, the README says that variables such as
+      no_msglog_check are global and can be placed anywhere in a specific
+      test's script, however it was observed that placement needed to be near
+      the beginning for it to behave that way. Changed the runtest perl
+      script to read through the entire script once to detect and set these
+      variables, reset to the beginning of the script, and then run through
+      the script parsing/test process like normal.
+
+
 Exim version 4.84
 -----------------
 TL/01 Bugzilla 1506: Re-add a 'return NULL' to silence complaints from static
diff --git a/test/runtest b/test/runtest
index aeca824..048fc2a 100755
--- a/test/runtest
+++ b/test/runtest
@@ -3358,9 +3358,20 @@ foreach $test (@test_list)
   undef %expected_msglogs;


   # Open the test's script
-
   open(SCRIPT, "scripts/$test") ||
     tests_exit(-1, "Failed to open \"scripts/$test\": $!");
+  # Run through the script once to set variables which should be global
+  while (<SCRIPT>)
+    {
+    if (/^no_message_check/) { $message_skip = 1; next; }
+    if (/^no_msglog_check/)  { $msglog_skip = 1; next; }
+    if (/^no_stderr_check/)  { $stderr_skip = 1; next; }
+    if (/^no_stdout_check/)  { $stdout_skip = 1; next; }
+    if (/^rmfiltertest/)     { $rmfiltertest = 1; next; }
+    if (/^sortlog/)          { $sortlog = 1; next; }
+    }
+  # Reset to beginning of file for per test interpreting/processing
+  seek(SCRIPT, 0, 0);


   # The first line in the script must be a comment that is used to identify
   # the set of tests as a whole.
@@ -3383,6 +3394,8 @@ foreach $test (@test_list)
     while (<SCRIPT>)
       {
       $lineno++;
+      # Could remove these variable settings because they are already
+      # set above, but doesn't hurt to leave them here.
       if (/^no_message_check/) { $message_skip = 1; next; }
       if (/^no_msglog_check/)  { $msglog_skip = 1; next; }
       if (/^no_stderr_check/)  { $stderr_skip = 1; next; }