[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / gio / tests / gschema-compile.c
index 930d352..1d3cc19 100644 (file)
@@ -2,7 +2,7 @@
 #include <unistd.h>
 #include <locale.h>
 #include <libintl.h>
-#include <gio.h>
+#include <gio/gio.h>
 #include <gstdio.h>
 
 typedef struct {
@@ -12,26 +12,35 @@ typedef struct {
 } 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_test_build_filename (G_TEST_DIST, "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/subprocess/do_compile", test->name, test->opt ? "/opt" : "");
+  g_test_trap_subprocess (child_name, 0, 0);
+  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",
-        "--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 ();
@@ -45,12 +54,12 @@ static const SchemaTest tests[] = {
   { "no-default",                   NULL, "*<default> is required in <key>*"                    },
   { "missing-quotes",               NULL, "*unknown keyword*"                                   },
   { "incomplete-list",              NULL, "*to follow array element*"                           },
-  { "wrong-category",               NULL, "*attribute 'l10n' invalid*"                          },
+  { "wrong-category",               NULL, "*unsupported l10n category*"                         },
   { "bad-type",                     NULL, "*invalid GVariant type string*"                      },
   { "overflow",                     NULL, "*out of range*"                                      },
   { "range-wrong-type",             NULL, "*<range> not allowed for keys of type*"              },
-  { "range-missing-min",            NULL, "*element 'range' requires attribute 'min'*"          },
-  { "range-missing-max",            NULL, "*element 'range' requires attribute 'max'*"          },
+  { "range-missing-min",            NULL, NULL                                                  },
+  { "range-missing-max",            NULL, NULL                                                  },
   { "default-out-of-range",         NULL, "*<default> is not contained in the specified range*" },
   { "choices-wrong-type",           NULL, "*<choices> not allowed for keys of type*"            },
   { "choice-missing-value",         NULL, "*element 'choice' requires attribute 'value'*"       },
@@ -75,7 +84,7 @@ static const SchemaTest tests[] = {
   { "enum-with-repeated-value",     NULL, "*value='1' already specified*"                       },
   { "enum-with-chained-alias",      NULL, "*'sausages' is not in enumerated type*"              },
   { "enum-with-shadow-alias",       NULL, "*'mash' is already a member of the enum*"            },
-  { "enum-with-choice",             NULL, "*<choices> can not be specified*"                    },
+  { "enum-with-choice",             NULL, "*<choices> cannot be specified*"                     },
   { "enum-with-bad-default",        NULL, "*<default> is not a valid member*"                   },
   { "choice",                       NULL, NULL                                                  },
   { "choice-upside-down",           NULL, NULL                                                  },
@@ -101,8 +110,8 @@ static const SchemaTest tests[] = {
   { "extend-self",                  NULL, "*not yet existing*"                                  },
   { "extend-wrong-list-indirect",   NULL, "*'y' does not extend 'x'*"                           },
   { "extend-wrong-list",            NULL, "*'y' does not extend 'x'*"                           },
-  { "key-in-list-indirect",         NULL, "*can not add keys to a list*"                        },
-  { "key-in-list",                  NULL, "*can not add keys to a list*"                        },
+  { "key-in-list-indirect",         NULL, "*cannot add keys to a 'list*"                        },
+  { "key-in-list",                  NULL, "*cannot add keys to a 'list*"                        },
   { "list-of-missing",              NULL, "*is list of not yet existing schema*"                },
   { "extend-and-shadow",            NULL, "*shadows*use <override>*"                            },
   { "extend-and-shadow-indirect",   NULL, "*shadows*use <override>*"                            },
@@ -116,9 +125,13 @@ static const SchemaTest tests[] = {
   { "flags-bad-default",            NULL, "*<default> * not in the specified flags type*"       },
   { "flags-more-than-one-bit",      NULL, "*flags values must have at most 1 bit set*"          },
   { "flags-with-enum-attr",         NULL, "*<enum id='flags'> not (yet) defined*"               },
-  { "flags-with-enum-tag",          NULL, "*<flags id='flags'> not (yet) defined*"              }
+  { "flags-with-enum-tag",          NULL, "*<flags id='flags'> not (yet) defined*"              },
+  { "inherit-gettext-domain",       NULL, NULL                                                  },
+  { "range-type-test",              NULL, NULL                                                  },
+  { "cdata",                        NULL, NULL                                                  }
 };
 
+
 int
 main (int argc, char *argv[])
 {
@@ -126,14 +139,19 @@ main (int argc, char *argv[])
 
   setlocale (LC_ALL, "");
 
-  g_type_init ();
   g_test_init (&argc, &argv, NULL);
 
   for (i = 0; i < G_N_ELEMENTS (tests); ++i)
     {
-      gchar *name = g_strdup_printf ("/gschema/%s%s", tests[i].name, tests[i].opt ? "/opt" : "");
+      gchar *name;
+
+      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/subprocess/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 ();