From 1c477b37eeb5251be787bd56936ba668e41c8c4a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 9 Nov 2018 17:12:09 +0000 Subject: [PATCH] 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 3e1f0ebfc..a450f45c3 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 d4cf9f90e..df7de0d9a 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 29e4784d0..a0a7fa048 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.ex Test message 2. **** dump retry -millisleep 2000 +millisleep 4000 exim -q **** killdaemon diff --git a/test/stdout/0548 b/test/stdout/0548 index 522bec99b..a3cff8454 100644 --- a/test/stdout/0548 +++ b/test/stdout/0548 @@ -1,22 +1,22 @@ +++++++++++++++++++++++++++ R:userx@test.ex: -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:: 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@test.ex: -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:: 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@test.ex: -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:: 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@test.ex: -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:: 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@test.ex: -44 13121 H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]: SMTP error from remote mail server after RCPT TO:: 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 -- 2.30.2