From 6b8240f061e9d545bf2b3a8741ccdf73697f1600 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 14 Jun 2022 15:26:51 +0100 Subject: [PATCH] tests: Fix performance-threaded test when run for zero seconds When running the test with `-s 0` it would previously crash. Fix that, and make it so that it only does a single test run in that case. This will be useful in an upcoming commit for smoketesting the test to avoid bitrot. Signed-off-by: Philip Withnall --- gobject/tests/performance/performance-threaded.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gobject/tests/performance/performance-threaded.c b/gobject/tests/performance/performance-threaded.c index 12a8b3d1e..97aa4384b 100644 --- a/gobject/tests/performance/performance-threaded.c +++ b/gobject/tests/performance/performance-threaded.c @@ -231,7 +231,7 @@ run_test_thread (gpointer user_data) results = g_array_new (FALSE, FALSE, sizeof (double)); /* Run the test */ - while (g_timer_elapsed (total, NULL) < test_length) + do { g_timer_reset (timer); g_timer_start (timer); @@ -241,6 +241,7 @@ run_test_thread (gpointer user_data) g_array_append_val (results, elapsed); test->reset (data); } + while (g_timer_elapsed (total, NULL) < test_length); /* Tear down */ test->teardown (data);