tests: Use g_assert_*() rather than g_assert() in rec-mutex tests

It won’t get compiled out with `G_DISABLE_ASSERT`.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall 2023-06-01 11:40:18 +01:00
parent fbc66b834e
commit 9db8765e21

View File

@ -62,10 +62,10 @@ test_rec_mutex3 (void)
gboolean ret;
ret = g_rec_mutex_trylock (&mutex);
g_assert (ret);
g_assert_true (ret);
ret = g_rec_mutex_trylock (&mutex);
g_assert (ret);
g_assert_true (ret);
g_rec_mutex_unlock (&mutex);
g_rec_mutex_unlock (&mutex);
@ -94,28 +94,28 @@ acquire (gint nr)
g_rec_mutex_lock (&locks[nr]);
}
g_assert (owners[nr] == NULL); /* hopefully nobody else is here */
g_assert_null (owners[nr]); /* hopefully nobody else is here */
owners[nr] = self;
/* let some other threads try to ruin our day */
g_thread_yield ();
g_thread_yield ();
g_assert (owners[nr] == self); /* hopefully this is still us... */
g_assert_true (owners[nr] == self); /* hopefully this is still us... */
if (g_test_verbose ())
g_printerr ("thread %p recursively taking lock %d\n", self, nr);
g_rec_mutex_lock (&locks[nr]); /* we're recursive, after all */
g_assert (owners[nr] == self); /* hopefully this is still us... */
g_assert_true (owners[nr] == self); /* hopefully this is still us... */
g_rec_mutex_unlock (&locks[nr]);
g_thread_yield ();
g_thread_yield ();
g_assert (owners[nr] == self); /* hopefully this is still us... */
g_assert_true (owners[nr] == self); /* hopefully this is still us... */
owners[nr] = NULL; /* make way for the next guy */
g_rec_mutex_unlock (&locks[nr]);
@ -156,7 +156,7 @@ test_rec_mutex4 (void)
g_rec_mutex_clear (&locks[i]);
for (i = 0; i < LOCKS; i++)
g_assert (owners[i] == NULL);
g_assert_null (owners[i]);
}
static gint count_to = 0;