mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
tests: port from g_test_trap_subprocess() to g_test_trap_fork()
(or, in a few cases, to g_test_expect_message()) https://bugzilla.gnome.org/show_bug.cgi?id=679683
This commit is contained in:
committed by
Matthias Clasen
parent
e3a29184d5
commit
ea06ec8063
@@ -5,6 +5,7 @@ SUBDIRS=gobject refcount
|
||||
AM_CPPFLAGS = \
|
||||
$(gmodule_INCLUDES) \
|
||||
-DGLIB_DISABLE_DEPRECATION_WARNINGS \
|
||||
-DG_LOG_DOMAIN=\"GLib\" \
|
||||
$(GLIB_DEBUG_FLAGS)
|
||||
|
||||
AM_CFLAGS = -g
|
||||
|
@@ -552,32 +552,30 @@ test_g_parse_debug_string (void)
|
||||
static void
|
||||
log_warning_error_tests (void)
|
||||
{
|
||||
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
|
||||
{
|
||||
g_message ("this is a g_message test.");
|
||||
g_message ("non-printable UTF-8: \"\xc3\xa4\xda\x85\"");
|
||||
g_message ("unsafe chars: \"\x10\x11\x12\n\t\x7f\x81\x82\x83\"");
|
||||
exit (0);
|
||||
}
|
||||
g_test_trap_assert_passed();
|
||||
g_test_trap_assert_stderr ("*is a g_message test*");
|
||||
g_test_trap_assert_stderr ("*non-printable UTF-8*");
|
||||
g_test_trap_assert_stderr ("*unsafe chars*");
|
||||
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
|
||||
{
|
||||
g_warning ("harmless warning with parameters: %d %s %#x", 42, "Boo", 12345);
|
||||
exit (0);
|
||||
}
|
||||
g_test_trap_assert_failed(); /* we have fatal-warnings enabled */
|
||||
g_test_trap_assert_stderr ("*harmless warning*");
|
||||
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
|
||||
{
|
||||
g_print (NULL);
|
||||
exit (0);
|
||||
}
|
||||
g_test_trap_assert_failed(); /* we have fatal-warnings enabled */
|
||||
g_test_trap_assert_stderr ("*g_print*assertion*failed*");
|
||||
g_test_trap_assert_stderr ("*NULL*");
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE,
|
||||
"*is a g_message test*");
|
||||
g_message ("this is a g_message test.");
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE,
|
||||
"*non-printable UTF-8*");
|
||||
g_message ("non-printable UTF-8: \"\xc3\xa4\xda\x85\"");
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE,
|
||||
"*unsafe chars*");
|
||||
g_message ("unsafe chars: \"\x10\x11\x12\n\t\x7f\x81\x82\x83\"");
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
|
||||
"*harmless warning*");
|
||||
g_warning ("harmless warning with parameters: %d %s %#x", 42, "Boo", 12345);
|
||||
g_test_assert_expected_messages ();
|
||||
|
||||
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
|
||||
"*g_print*assertion*failed*");
|
||||
g_print (NULL);
|
||||
g_test_assert_expected_messages ();
|
||||
}
|
||||
|
||||
static void
|
||||
|
Reference in New Issue
Block a user