mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
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>
This commit is contained in:
parent
74e71c78c0
commit
6b8240f061
@ -231,7 +231,7 @@ run_test_thread (gpointer user_data)
|
|||||||
results = g_array_new (FALSE, FALSE, sizeof (double));
|
results = g_array_new (FALSE, FALSE, sizeof (double));
|
||||||
|
|
||||||
/* Run the test */
|
/* Run the test */
|
||||||
while (g_timer_elapsed (total, NULL) < test_length)
|
do
|
||||||
{
|
{
|
||||||
g_timer_reset (timer);
|
g_timer_reset (timer);
|
||||||
g_timer_start (timer);
|
g_timer_start (timer);
|
||||||
@ -241,6 +241,7 @@ run_test_thread (gpointer user_data)
|
|||||||
g_array_append_val (results, elapsed);
|
g_array_append_val (results, elapsed);
|
||||||
test->reset (data);
|
test->reset (data);
|
||||||
}
|
}
|
||||||
|
while (g_timer_elapsed (total, NULL) < test_length);
|
||||||
|
|
||||||
/* Tear down */
|
/* Tear down */
|
||||||
test->teardown (data);
|
test->teardown (data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user