]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
libtest: display the times after a test timeout error
authorDan Fandrich <dan@coneharvesters.com>
Fri, 16 Jun 2023 20:30:09 +0000 (13:30 -0700)
committerDan Fandrich <dan@coneharvesters.com>
Tue, 20 Jun 2023 00:14:27 +0000 (17:14 -0700)
This is to help with test failure debugging.

Ref: #11328
Closes #11329

tests/libtest/test.h

index cb2d47ac7ad3f51e1d1fe8f5e3be073ff5bd0be4..7eb7fdaa2fa5e5a35c20bc25a6f3d81f1140147f 100644 (file)
@@ -440,12 +440,14 @@ extern int unitfail;
   tv_test_start = tutil_tvnow(); \
 } while(0)
 
-#define exe_test_timedout(Y,Z) do {                                    \
-  if(tutil_tvdiff(tutil_tvnow(), tv_test_start) > TEST_HANG_TIMEOUT) { \
-    fprintf(stderr, "%s:%d ABORTING TEST, since it seems "             \
-                    "that it would have run forever.\n", (Y), (Z));    \
-    res = TEST_ERR_RUNS_FOREVER;                                       \
-  }                                                                    \
+#define exe_test_timedout(Y,Z) do {                                       \
+  long timediff = tutil_tvdiff(tutil_tvnow(), tv_test_start);             \
+  if(timediff > (TEST_HANG_TIMEOUT)) {                                    \
+    fprintf(stderr, "%s:%d ABORTING TEST, since it seems "                \
+            "that it would have run forever (%ld ms > %ld ms)\n",         \
+            (Y), (Z), timediff, (long) (TEST_HANG_TIMEOUT));              \
+    res = TEST_ERR_RUNS_FOREVER;                                          \
+  }                                                                       \
 } while(0)
 
 #define res_test_timedout() \