mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 11:56:16 +01:00
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:
parent
fbc66b834e
commit
9db8765e21
@ -62,10 +62,10 @@ test_rec_mutex3 (void)
|
|||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
ret = g_rec_mutex_trylock (&mutex);
|
ret = g_rec_mutex_trylock (&mutex);
|
||||||
g_assert (ret);
|
g_assert_true (ret);
|
||||||
|
|
||||||
ret = g_rec_mutex_trylock (&mutex);
|
ret = g_rec_mutex_trylock (&mutex);
|
||||||
g_assert (ret);
|
g_assert_true (ret);
|
||||||
|
|
||||||
g_rec_mutex_unlock (&mutex);
|
g_rec_mutex_unlock (&mutex);
|
||||||
g_rec_mutex_unlock (&mutex);
|
g_rec_mutex_unlock (&mutex);
|
||||||
@ -94,28 +94,28 @@ acquire (gint nr)
|
|||||||
g_rec_mutex_lock (&locks[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;
|
owners[nr] = self;
|
||||||
|
|
||||||
/* let some other threads try to ruin our day */
|
/* let some other threads try to ruin our day */
|
||||||
g_thread_yield ();
|
g_thread_yield ();
|
||||||
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 ())
|
if (g_test_verbose ())
|
||||||
g_printerr ("thread %p recursively taking lock %d\n", self, nr);
|
g_printerr ("thread %p recursively taking lock %d\n", self, nr);
|
||||||
|
|
||||||
g_rec_mutex_lock (&locks[nr]); /* we're recursive, after all */
|
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_rec_mutex_unlock (&locks[nr]);
|
||||||
|
|
||||||
g_thread_yield ();
|
g_thread_yield ();
|
||||||
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 */
|
owners[nr] = NULL; /* make way for the next guy */
|
||||||
|
|
||||||
g_rec_mutex_unlock (&locks[nr]);
|
g_rec_mutex_unlock (&locks[nr]);
|
||||||
@ -156,7 +156,7 @@ test_rec_mutex4 (void)
|
|||||||
g_rec_mutex_clear (&locks[i]);
|
g_rec_mutex_clear (&locks[i]);
|
||||||
|
|
||||||
for (i = 0; i < LOCKS; i++)
|
for (i = 0; i < LOCKS; i++)
|
||||||
g_assert (owners[i] == NULL);
|
g_assert_null (owners[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint count_to = 0;
|
static gint count_to = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user