[glib: 9/16] tests: Fix performance-threaded test when run for zero seconds
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 9/16] tests: Fix performance-threaded test when run for zero seconds
- Date: Wed, 22 Jun 2022 18:49:08 +0000 (UTC)
commit 6b8240f061e9d545bf2b3a8741ccdf73697f1600
Author: Philip Withnall <pwithnall endlessos org>
Date: Tue Jun 14 15:26:51 2022 +0100
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 <pwithnall endlessos org>
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 12a8b3d1e7..97aa4384b9 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]