summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2023-10-04 17:55:33 +0100
committerMatt Caswell <matt@openssl.org>2023-10-06 10:55:24 +0100
commit79997a919f6cf3823d04fa9b34adaaa5aadd871a (patch)
tree03b14b0dd96b591ae3e23951185b0c2cab2eeb7a
parent2e62b07a41cca299f7abb69c892053b99ec762b2 (diff)
Timeout in the tserver test using real time
When running the tserver test we bail out if a timeout expires. We shouldn't use fake time for that timeout, because fake time might never actually get incremented. Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22284)
-rw-r--r--test/quic_tserver_test.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/quic_tserver_test.c b/test/quic_tserver_test.c
index 6ed84f0ae6..b2b09354bb 100644
--- a/test/quic_tserver_test.c
+++ b/test/quic_tserver_test.c
@@ -73,7 +73,6 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject)
int s_begin_write = 0;
OSSL_TIME start_time;
unsigned char alpn[] = { 8, 'o', 's', 's', 'l', 't', 'e', 's', 't' };
- OSSL_TIME (*now_cb)(void *arg) = use_fake_time ? fake_now : real_now;
size_t limit_ms = 1000;
#if defined(OPENSSL_NO_QUIC_THREAD_ASSIST)
@@ -194,10 +193,14 @@ static int do_test(int use_thread_assist, int use_fake_time, int use_inject)
if (!TEST_true(SSL_set_blocking_mode(c_ssl, 0)))
goto err;
- start_time = now_cb(NULL);
+ /*
+ * We use real time for the timeout not fake time. Otherwise with fake time
+ * we could hit a hang if we never increment the fake time
+ */
+ start_time = real_now(NULL);
for (;;) {
- if (ossl_time_compare(ossl_time_subtract(now_cb(NULL), start_time),
+ if (ossl_time_compare(ossl_time_subtract(real_now(NULL), start_time),
ossl_ms2time(limit_ms)) >= 0) {
TEST_error("timeout while attempting QUIC server test");
goto err;