gtestutils: Add G_TEST_SUBPROCESS_DEFAULT, G_TEST_TRAP_DEFAULT

This makes calls to test subprocesses with default behaviour more
self-documenting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie
2022-03-31 14:30:43 +01:00
parent f59e02a143
commit de8672fe0b
34 changed files with 223 additions and 143 deletions

View File

@@ -750,7 +750,7 @@ test_param_invalid_name (gconstpointer test_data)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_param_spec_is_valid_name (name)*");
}
@@ -1395,7 +1395,8 @@ test_param_implement (void)
test_path = g_strdup_printf ("/param/implement/subprocess/%d-%d-%d-%d",
change_this_flag, change_this_type,
use_this_flag, use_this_type);
g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND, 0);
g_test_trap_subprocess (test_path, G_TIME_SPAN_SECOND,
G_TEST_SUBPROCESS_DEFAULT);
g_free (test_path);
/* We want to ensure that any flags mismatch problems are reported first. */

View File

@@ -582,7 +582,7 @@ properties_testv_with_invalid_property_type (void)
g_object_unref (test_obj);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*foo*gint*gchararray*");
}
@@ -620,7 +620,7 @@ properties_testv_with_invalid_property_names (void)
g_object_unref (test_obj);
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_object_new_is_valid_property*boo*");
}

View File

@@ -1640,7 +1640,7 @@ test_lookup_invalid (void)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*WARNING*unable to look up invalid signal name*");
}
@@ -1757,7 +1757,7 @@ test_signals_invalid_name (gconstpointer test_data)
return;
}
g_test_trap_subprocess (NULL, 0, 0);
g_test_trap_subprocess (NULL, 0, G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*CRITICAL*g_signal_is_valid_name (signal_name)*");
}

View File

@@ -52,7 +52,8 @@ test_assert_finalize_object (void)
g_assert_finalize_object (obj);
g_test_trap_subprocess ("/assert/finalize_object/subprocess/bad", 0, 0);
g_test_trap_subprocess ("/assert/finalize_object/subprocess/bad", 0,
G_TEST_SUBPROCESS_DEFAULT);
g_test_trap_assert_failed ();
g_test_trap_assert_stderr ("*g_assert_finalize_object:*'weak_pointer' should be NULL*");
}