mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-11 03:46:17 +01:00
Improve testing test coverage
In particular, test the just-fixed g_test_trap_reached_timeout.
This commit is contained in:
parent
3343bc3385
commit
cdb14a194e
@ -586,6 +586,44 @@ test_pass (void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_fail (void)
|
||||||
|
{
|
||||||
|
if (g_test_subprocess ())
|
||||||
|
{
|
||||||
|
g_test_fail ();
|
||||||
|
g_assert (g_test_failed ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_test_trap_subprocess (NULL, 0, 0);
|
||||||
|
g_test_trap_assert_failed ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_incomplete (void)
|
||||||
|
{
|
||||||
|
if (g_test_subprocess ())
|
||||||
|
{
|
||||||
|
g_test_incomplete ("not done");
|
||||||
|
g_assert (g_test_failed ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_test_trap_subprocess (NULL, 0, 0);
|
||||||
|
g_test_trap_assert_failed ();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
test_subprocess_timed_out (void)
|
||||||
|
{
|
||||||
|
if (g_test_subprocess ())
|
||||||
|
{
|
||||||
|
g_usleep (1000000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g_test_trap_subprocess (NULL, 50000, 0);
|
||||||
|
g_assert (g_test_trap_reached_timeout ());
|
||||||
|
}
|
||||||
|
|
||||||
static const char *argv0;
|
static const char *argv0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -721,6 +759,9 @@ main (int argc,
|
|||||||
g_test_add_func ("/misc/skip-all/subprocess/skip1", test_skip);
|
g_test_add_func ("/misc/skip-all/subprocess/skip1", test_skip);
|
||||||
g_test_add_func ("/misc/skip-all/subprocess/skip2", test_skip);
|
g_test_add_func ("/misc/skip-all/subprocess/skip2", test_skip);
|
||||||
g_test_add_func ("/misc/skip-all/subprocess/pass", test_pass);
|
g_test_add_func ("/misc/skip-all/subprocess/pass", test_pass);
|
||||||
|
g_test_add_func ("/misc/fail", test_fail);
|
||||||
|
g_test_add_func ("/misc/incomplete", test_incomplete);
|
||||||
|
g_test_add_func ("/misc/timeout", test_subprocess_timed_out);
|
||||||
|
|
||||||
return g_test_run();
|
return g_test_run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user