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:
Philip Withnall 2022-06-14 15:26:51 +01:00
parent 74e71c78c0
commit 6b8240f061

View File

@ -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);