summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-10-24 12:58:19 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2019-10-24 12:58:19 +0100
commit444163417b289354b53d4708760f31d947ac6fd1 (patch)
treeb2e07cfb7ca7f7364119ee37b2132935e36effcf /src
parent979c462ed43bd4f53f61a0031ec22967dea83902 (diff)
Testsuite: handle slow test-hosts more intelligently
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c46
-rw-r--r--src/src/functions.h1
-rw-r--r--src/src/queue.c4
-rw-r--r--src/src/spool_in.c6
4 files changed, 34 insertions, 23 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 0055ad481..34990b71e 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -5474,6 +5474,26 @@ fprintf(f, "Action: %s\n"
}
+
+/* When running in the test harness, there's an option that allows us to
+fudge this time so as to get repeatability of the tests. Take the first
+time off the list. In queue runs, the list pointer gets updated in the
+calling process. */
+
+int
+test_harness_fudged_queue_time(int actual_time)
+{
+int qt;
+if ( f.running_in_test_harness && *fudged_queue_times
+ && (qt = readconf_readtime(fudged_queue_times, '/', FALSE)) >= 0)
+ {
+ DEBUG(D_deliver) debug_printf("fudged queue_times = %s\n",
+ fudged_queue_times);
+ return qt;
+ }
+return actual_time;
+}
+
/*************************************************
* Deliver one message *
*************************************************/
@@ -6164,7 +6184,8 @@ if (process_recipients != RECIP_IGNORE)
new->onetime_parent = recipients_list[r->pno].address;
/* If DSN support is enabled, set the dsn flags and the original receipt
- to be passed on to other DSN enabled MTAs */
+ to be passed on to other DSN enabled MTAs */
+
new->dsn_flags = r->dsn_flags & rf_dsnflags;
new->dsn_orcpt = r->orcpt;
DEBUG(D_deliver) debug_printf("DSN: set orcpt: %s flags: 0x%x\n",
@@ -7284,10 +7305,9 @@ for (address_item * a = addr_succeed; a; a = a->next)
);
/* send report if next hop not DSN aware or a router flagged "last DSN hop"
- and a report was requested */
- if ( ( a->dsn_aware != dsn_support_yes
- || a->dsn_flags & rf_dsnlasthop
- )
+ and a report was requested */
+
+ if ( (a->dsn_aware != dsn_support_yes || a->dsn_flags & rf_dsnlasthop)
&& a->dsn_flags & rf_notify_success
)
{
@@ -8131,21 +8151,7 @@ else if (addr_defer != (address_item *)(+1))
int show_time;
int queue_time = time(NULL) - received_time.tv_sec;
- /* When running in the test harness, there's an option that allows us to
- fudge this time so as to get repeatability of the tests. Take the first
- time off the list. In queue runs, the list pointer gets updated in the
- calling process. */
-
- if (f.running_in_test_harness && fudged_queue_times[0] != 0)
- {
- int qt = readconf_readtime(fudged_queue_times, '/', FALSE);
- if (qt >= 0)
- {
- DEBUG(D_deliver) debug_printf("fudged queue_times = %s\n",
- fudged_queue_times);
- queue_time = qt;
- }
- }
+ queue_time = test_harness_fudged_queue_time(queue_time);
/* See how many warnings we should have sent by now */
diff --git a/src/src/functions.h b/src/src/functions.h
index 35600ba2a..8905d02a2 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -539,6 +539,7 @@ extern int strcmpic(const uschar *, const uschar *);
extern int strncmpic(const uschar *, const uschar *, int);
extern uschar *strstric(uschar *, uschar *, BOOL);
+extern int test_harness_fudged_queue_time(int);
#ifdef EXIM_TFO_PROBE
extern void tfo_probe(void);
#endif
diff --git a/src/src/queue.c b/src/src/queue.c
index d8c160a3a..670f51c45 100644
--- a/src/src/queue.c
+++ b/src/src/queue.c
@@ -664,8 +664,8 @@ for (int i = queue_run_in_order ? -1 : 0;
if (f.running_in_test_harness && !f.queue_2stage)
{
- uschar *fqtnext = Ustrchr(fudged_queue_times, '/');
- if (fqtnext != NULL) fudged_queue_times = fqtnext + 1;
+ uschar * fqtnext = Ustrchr(fudged_queue_times, '/');
+ if (fqtnext) fudged_queue_times = fqtnext + 1;
}
} /* End loop for list of messages */
diff --git a/src/src/spool_in.c b/src/src/spool_in.c
index f393d4d3e..7c60a12a0 100644
--- a/src/src/spool_in.c
+++ b/src/src/spool_in.c
@@ -423,12 +423,16 @@ if (sscanf(CS big_buffer, TIME_T_FMT " %d", &received_time.tv_sec, &warning_coun
received_time.tv_usec = 0;
message_age = time(NULL) - received_time.tv_sec;
+#ifndef COMPILE_UTILITY
+if (f.running_in_test_harness)
+ message_age = test_harness_fudged_queue_time(message_age);
+#endif
#ifndef COMPILE_UTILITY
DEBUG(D_deliver) debug_printf("user=%s uid=%ld gid=%ld sender=%s\n",
originator_login, (long int)originator_uid, (long int)originator_gid,
sender_address);
-#endif /* COMPILE_UTILITY */
+#endif
/* Now there may be a number of optional lines, each starting with "-". If you
add a new setting here, make sure you set the default above.