Revert "tests: port from g_test_trap_subprocess() to g_test_trap_fork()"

This reverts commit ea06ec8063.
This commit is contained in:
Matthias Clasen
2012-12-19 15:20:37 -05:00
parent 6f15db8c3d
commit 0178402c6d
19 changed files with 859 additions and 1250 deletions

View File

@@ -11,36 +11,28 @@ typedef struct {
const gchar *err;
} SchemaTest;
static void
test_schema_do_compile (gpointer data)
{
SchemaTest *test = (SchemaTest *) data;
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
gchar *path = g_build_filename (SRCDIR, "schema-tests", filename, NULL);
gchar *argv[] = {
"../glib-compile-schemas",
"--strict",
"--dry-run",
"--schema-file", path,
(gchar *)test->opt,
NULL
};
gchar *envp[] = { NULL };
execve (argv[0], argv, envp);
g_assert_not_reached ();
}
static void
test_schema (gpointer data)
{
SchemaTest *test = (SchemaTest *) data;
gchar *child_name;
child_name = g_strdup_printf ("/gschema/%s%s:do_compile", test->name, test->opt ? "/opt" : "");
g_test_trap_subprocess (child_name, 0, G_TEST_TRAP_SILENCE_STDERR);
g_free (child_name);
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR))
{
gchar *filename = g_strconcat (test->name, ".gschema.xml", NULL);
gchar *path = g_build_filename (SRCDIR, "schema-tests", filename, NULL);
gchar *argv[] = {
"../glib-compile-schemas",
"--strict",
"--dry-run",
"--schema-file", path,
(gchar *)test->opt,
NULL
};
gchar *envp[] = { NULL };
execve (argv[0], argv, envp);
g_free (filename);
g_free (path);
}
if (test->err)
{
g_test_trap_assert_failed ();
@@ -143,15 +135,9 @@ main (int argc, char *argv[])
for (i = 0; i < G_N_ELEMENTS (tests); ++i)
{
gchar *name;
name = g_strdup_printf ("/gschema/%s%s", tests[i].name, tests[i].opt ? "/opt" : "");
gchar *name = g_strdup_printf ("/gschema/%s%s", tests[i].name, tests[i].opt ? "/opt" : "");
g_test_add_data_func (name, &tests[i], (gpointer) test_schema);
g_free (name);
name = g_strdup_printf ("/gschema/%s%s:do_compile", tests[i].name, tests[i].opt ? "/opt" : "");
g_test_add_data_func (name, &tests[i], (gpointer) test_schema_do_compile);
g_free (name);
}
return g_test_run ();