From 62416776f66e26003465c3a49cdd276e554a0d0d Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Mon, 11 Aug 2014 15:16:41 +0100 Subject: [PATCH 4/4] new tests: max_connections_per_user, max_connections_per_cgroup Similar to the previous test max_connections_per_process. https://bugs.freedesktop.org/show_bug.cgi?id=81469 --- configure.ac | 2 ++ test/Makefile.am | 2 ++ test/data/valid-config-files/.gitignore | 2 ++ .../max-connections-per-cgroup.conf.in | 18 ++++++++++++++++++ .../max-connections-per-user.conf.in | 18 ++++++++++++++++++ test/dbus-daemon.c | 19 ++++++++++++++++--- 6 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 test/data/valid-config-files/max-connections-per-cgroup.conf.in create mode 100644 test/data/valid-config-files/max-connections-per-user.conf.in diff --git a/configure.ac b/configure.ac index f748566..139b07f 100644 --- a/configure.ac +++ b/configure.ac @@ -1779,6 +1779,8 @@ dbus-1-uninstalled.pc test/data/valid-config-files/debug-allow-all.conf test/data/valid-config-files/debug-allow-all-sha1.conf test/data/valid-config-files/incoming-limit.conf +test/data/valid-config-files/max-connections-per-user.conf +test/data/valid-config-files/max-connections-per-cgroup.conf test/data/valid-config-files/max-connections-per-process.conf test/data/valid-config-files-system/debug-allow-all-pass.conf test/data/valid-config-files-system/debug-allow-all-fail.conf diff --git a/test/Makefile.am b/test/Makefile.am index d499b1d..9e665c6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -250,6 +250,8 @@ in_data = \ data/valid-config-files/debug-allow-all-sha1.conf.in \ data/valid-config-files/debug-allow-all.conf.in \ data/valid-config-files/incoming-limit.conf.in \ + data/valid-config-files/max-connections-per-user.conf.in \ + data/valid-config-files/max-connections-per-cgroup.conf.in \ data/valid-config-files/max-connections-per-process.conf.in \ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \ diff --git a/test/data/valid-config-files/.gitignore b/test/data/valid-config-files/.gitignore index acef7c7..7bdb0f6 100644 --- a/test/data/valid-config-files/.gitignore +++ b/test/data/valid-config-files/.gitignore @@ -1,6 +1,8 @@ debug-allow-all.conf debug-allow-all-sha1.conf incoming-limit.conf +max-connections-per-user.conf +max-connections-per-cgroup.conf max-connections-per-process.conf session.conf system.conf diff --git a/test/data/valid-config-files/max-connections-per-cgroup.conf.in b/test/data/valid-config-files/max-connections-per-cgroup.conf.in new file mode 100644 index 0000000..fda24a8 --- /dev/null +++ b/test/data/valid-config-files/max-connections-per-cgroup.conf.in @@ -0,0 +1,18 @@ + + + + session + @TEST_LISTEN@ + + + + + + + + + + + 3 + diff --git a/test/data/valid-config-files/max-connections-per-user.conf.in b/test/data/valid-config-files/max-connections-per-user.conf.in new file mode 100644 index 0000000..5394557 --- /dev/null +++ b/test/data/valid-config-files/max-connections-per-user.conf.in @@ -0,0 +1,18 @@ + + + + session + @TEST_LISTEN@ + + + + + + + + + + + 3 + diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 153fbd7..a31b594 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -457,8 +457,7 @@ test_creds (Fixture *f, } static void -test_max_connections_per_process (Fixture *f, - gconstpointer context) +test_max_connections (Fixture *f, gconstpointer context) { DBusConnection *conn3, *conn4; DBusError error = DBUS_ERROR_INIT; @@ -538,6 +537,14 @@ static Config max_connections_per_process_config = { "82346", 0, "valid-config-files/max-connections-per-process.conf" }; +static Config max_connections_per_user_config = { + "82346", 0, "valid-config-files/max-connections-per-user.conf" +}; + +static Config max_connections_per_cgroup_config = { + "81469", 0, "valid-config-files/max-connections-per-cgroup.conf" +}; + int main (int argc, char **argv) @@ -551,7 +558,13 @@ main (int argc, g_test_add ("/creds", Fixture, NULL, setup, test_creds, teardown); g_test_add ("/limit/max_connections_per_process", Fixture, &max_connections_per_process_config, setup, - test_max_connections_per_process, teardown); + test_max_connections, teardown); + g_test_add ("/limit/max_connections_per_user", Fixture, + &max_connections_per_user_config, setup, + test_max_connections, teardown); + g_test_add ("/limit/max_connections_per_cgroup", Fixture, + &max_connections_per_cgroup_config, setup, + test_max_connections, teardown); return g_test_run (); } -- 1.8.5.3