summaryrefslogtreecommitdiff
path: root/test/containers.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-05-31 19:36:45 +0100
committerSimon McVittie <smcv@collabora.com>2018-06-21 17:43:40 +0100
commiteaaa2b67e487f76f266508a6064e0cebf6c90214 (patch)
tree23a07c98450fd0d445e6e622716334619069c537 /test/containers.c
parent7512fe499349c9e2851a876549eaa8445f849d0b (diff)
downloaddbus-eaaa2b67e487f76f266508a6064e0cebf6c90214.tar.gz
containers test: Move teardown below all test-cases
Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
Diffstat (limited to 'test/containers.c')
-rw-r--r--test/containers.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/test/containers.c b/test/containers.c
index acac82a4..18c2f241 100644
--- a/test/containers.c
+++ b/test/containers.c
@@ -1514,6 +1514,59 @@ test_max_connections_per_container (Fixture *f,
#endif /* !HAVE_CONTAINERS_TEST */
}
+/*
+ * Test what happens when we exceed max_container_metadata_bytes.
+ * test_metadata() exercises the non-excessive case with the same
+ * configuration.
+ */
+static void
+test_max_container_metadata_bytes (Fixture *f,
+ gconstpointer context)
+{
+#ifdef HAVE_CONTAINERS_TEST
+ /* Must be >= max_container_metadata_bytes in limit-containers.conf, so that
+ * when the serialization overhead, app-container type and app name are
+ * added, it is too much for the limit */
+ guchar waste_of_space[4096] = { 0 };
+ GVariant *tuple;
+ GVariant *parameters;
+ GVariantDict dict;
+
+ if (f->skip)
+ return;
+
+ f->proxy = g_dbus_proxy_new_sync (f->unconfined_conn,
+ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+ NULL, DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS, DBUS_INTERFACE_CONTAINERS1,
+ NULL, &f->error);
+ g_assert_no_error (f->error);
+
+ g_variant_dict_init (&dict, NULL);
+ g_variant_dict_insert (&dict, "waste of space", "@ay",
+ g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
+ waste_of_space,
+ sizeof (waste_of_space),
+ 1));
+
+ /* Floating reference, call_..._sync takes ownership */
+ parameters = g_variant_new ("(ss@a{sv}a{sv})",
+ "com.wasteheadquarters",
+ "Packt Like Sardines in a Crushd Tin Box",
+ g_variant_dict_end (&dict),
+ NULL); /* no named arguments */
+
+ tuple = g_dbus_proxy_call_sync (f->proxy, "AddServer", parameters,
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &f->error);
+ g_assert_error (f->error, G_DBUS_ERROR, G_DBUS_ERROR_LIMITS_EXCEEDED);
+ g_assert_null (tuple);
+ g_clear_error (&f->error);
+
+#else /* !HAVE_CONTAINERS_TEST */
+ g_test_skip ("Containers or gio-unix-2.0 not supported");
+#endif /* !HAVE_CONTAINERS_TEST */
+}
+
static void
teardown (Fixture *f,
gconstpointer context G_GNUC_UNUSED)
@@ -1590,59 +1643,6 @@ teardown (Fixture *f,
test_main_context_unref (f->ctx);
}
-/*
- * Test what happens when we exceed max_container_metadata_bytes.
- * test_metadata() exercises the non-excessive case with the same
- * configuration.
- */
-static void
-test_max_container_metadata_bytes (Fixture *f,
- gconstpointer context)
-{
-#ifdef HAVE_CONTAINERS_TEST
- /* Must be >= max_container_metadata_bytes in limit-containers.conf, so that
- * when the serialization overhead, app-container type and app name are
- * added, it is too much for the limit */
- guchar waste_of_space[4096] = { 0 };
- GVariant *tuple;
- GVariant *parameters;
- GVariantDict dict;
-
- if (f->skip)
- return;
-
- f->proxy = g_dbus_proxy_new_sync (f->unconfined_conn,
- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
- NULL, DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS, DBUS_INTERFACE_CONTAINERS1,
- NULL, &f->error);
- g_assert_no_error (f->error);
-
- g_variant_dict_init (&dict, NULL);
- g_variant_dict_insert (&dict, "waste of space", "@ay",
- g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE,
- waste_of_space,
- sizeof (waste_of_space),
- 1));
-
- /* Floating reference, call_..._sync takes ownership */
- parameters = g_variant_new ("(ss@a{sv}a{sv})",
- "com.wasteheadquarters",
- "Packt Like Sardines in a Crushd Tin Box",
- g_variant_dict_end (&dict),
- NULL); /* no named arguments */
-
- tuple = g_dbus_proxy_call_sync (f->proxy, "AddServer", parameters,
- G_DBUS_CALL_FLAGS_NONE, -1, NULL, &f->error);
- g_assert_error (f->error, G_DBUS_ERROR, G_DBUS_ERROR_LIMITS_EXCEEDED);
- g_assert_null (tuple);
- g_clear_error (&f->error);
-
-#else /* !HAVE_CONTAINERS_TEST */
- g_test_skip ("Containers or gio-unix-2.0 not supported");
-#endif /* !HAVE_CONTAINERS_TEST */
-}
-
static const Config stop_server_explicitly =
{
"valid-config-files/multi-user.conf",