[exim-cvs] Testsuite: avoid time-quantization issue

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Testsuite: avoid time-quantization issue
Gitweb: https://git.exim.org/exim.git/commitdiff/1c477b37eeb5251be787bd56936ba668e41c8c4a
Commit:     1c477b37eeb5251be787bd56936ba668e41c8c4a
Parent:     4a7ad62b15ea97dd2de1c98d0cd0219f99233bce
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Fri Nov 9 17:12:09 2018 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Fri Nov 9 17:12:09 2018 +0000


    Testsuite: avoid time-quantization issue
---
 test/confs/0548              |  4 ++--
 test/runtest                 |  4 +++-
 test/scripts/0000-Basic/0548 | 12 +++++++++---
 test/stdout/0548             | 18 +++++++++---------
 4 files changed, 23 insertions(+), 15 deletions(-)


diff --git a/test/confs/0548 b/test/confs/0548
index 3e1f0eb..a450f45 100644
--- a/test/confs/0548
+++ b/test/confs/0548
@@ -50,7 +50,7 @@ smtp:

begin retry

-thishost.test.ex  *  F,20s,2s
-*                 *  F,1s,1s; F,1s,5s
+thishost.test.ex  *  F,40s,4s
+*                 *  F,2s,2s; F,2s,10s


 # End
diff --git a/test/runtest b/test/runtest
index d4cf9f9..df7de0d 100755
--- a/test/runtest
+++ b/test/runtest
@@ -460,7 +460,9 @@ RESET_AFTER_EXTRA_LINE_READ:
     {
     my($date1,$date2,$date3,$expired) = ($1,$2,$3,$4);
     $expired = '' if !defined $expired;
-    my($increment) = date_seconds($date3) - date_seconds($date2);
+
+    # Round the time-difference up to nearest even value
+    my($increment) = ((date_seconds($date3) - date_seconds($date2) + 1) >> 1) << 1;


     # We used to use globally unique replacement values, but timing
     # differences make this impossible. Just show the increment on the
diff --git a/test/scripts/0000-Basic/0548 b/test/scripts/0000-Basic/0548
index 29e4784..a0a7fa0 100644
--- a/test/scripts/0000-Basic/0548
+++ b/test/scripts/0000-Basic/0548
@@ -2,6 +2,12 @@
 # In this test, the primary host (normal IP address) defers the recipient, and
 # the secondary host (loopback address) defers the connection.
 #
+#XXX the test is relying on one-second accuracy, which is too tight.
+# The measured time is only one-second precision, so certain to sometime
+# straddle a boundary, even ignoring scheduling and I/O-wait issues.
+# Consider a factor of (?) two, in the retry section of the conf/ file
+# and +1 /2 after the diff operation (runtest:463).
+#
 need_ipv4
 #
 exim -DSERVER=server -bd -oX PORT_D
@@ -11,13 +17,13 @@ Test message
 ****
 # defers from both
 dump retry
-millisleep 2100
+millisleep 4200
 # At this point, the primary host retry rule ehould have timed out
 # and the secondary is ready for a retry
 exim -q
 ****
 dump retry
-millisleep 2100
+millisleep 4200
 # This should be similar
 exim -q
 ****
@@ -29,7 +35,7 @@ exim -odi usery@???
 Test message 2.
 ****
 dump retry
-millisleep 2000
+millisleep 4000
 exim -q
 ****
 killdaemon
diff --git a/test/stdout/0548 b/test/stdout/0548
index 522bec9..a3cff84 100644
--- a/test/stdout/0548
+++ b/test/stdout/0548
@@ -1,22 +1,22 @@
 +++++++++++++++++++++++++++
   R:userx@???:<CALLER@???> -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:<userx@???>: 451 Recipient deferred
-first failed = time last try = time2 next try = time2 + 1
-  T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
 first failed = time last try = time2 next try = time2 + 2
+  T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
+first failed = time last try = time2 next try = time2 + 4
 +++++++++++++++++++++++++++
   R:userx@???:<CALLER@???> -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:<userx@???>: 451 Recipient deferred
-first failed = time last try = time2 next try = time2 + 5 *
+first failed = time last try = time2 next try = time2 + 10 *
   T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
-first failed = time last try = time2 next try = time2 + 2
+first failed = time last try = time2 next try = time2 + 4
 +++++++++++++++++++++++++++
   R:userx@???:<CALLER@???> -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:<userx@???>: 451 Recipient deferred
-first failed = time last try = time2 next try = time2 + 5 *
+first failed = time last try = time2 next try = time2 + 10 *
   T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
-first failed = time last try = time2 next try = time2 + 2
+first failed = time last try = time2 next try = time2 + 4
 +++++++++++++++++++++++++++
   R:userx@???:<CALLER@???> -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:<userx@???>: 451 Recipient deferred
-first failed = time last try = time2 next try = time2 + 5 *
+first failed = time last try = time2 next try = time2 + 10 *
   R:usery@???:<CALLER@???> -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:<usery@???>: 451 Recipient deferred
-first failed = time last try = time2 next try = time2 + 1
-  T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
 first failed = time last try = time2 next try = time2 + 2
+  T:thishost.test.ex:127.0.0.1:1225 0 65 H=thishost.test.ex [127.0.0.1]: SMTP error from remote mail server after initial connection: 451 host deferred
+first failed = time last try = time2 next try = time2 + 4