diff options
author | Colin Walters <walters@verbum.org> | 2004-08-23 16:09:54 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2004-08-23 16:09:54 +0000 |
commit | ee78f2800f2642b4fff962b736296d87a7f12a17 (patch) | |
tree | 6ea2949c889f80ae4a4f0f72dee53f277056b0b7 /bus/test-main.c | |
parent | a7291aee0e12b9b6abe90f835ef9cb3e158a96c4 (diff) |
2004-08-23 Colin Walters <walters@redhat.com>
* bus/selinux.h: Prototype bus_selinux_get_policy_root.
* bus/selinux.c: Create a thread for policy reload notification.
(bus_selinux_get_policy_root): Implement.
Updated SELinux support from Matthew Rickard <mjricka@epoch.ncsc.mil>
* bus/config-parser.c (start_busconfig_child)
(bus_config_parser_content): Support SELinux-root relative
inclusion.
* configure.in <HAVE_SELINUX>: Add -lpthread.
* bus/test-main.c (test_pre_hook, test_post_hook): New.
(test_post_hook): Move memory checking into here.
(test_pre_hook, test_post_hook): Move SELinux checks in
here, but conditional on a DBUS_TEST_SELINUX environment
variable. Unfortunately we can't run the SELinux checks
as a normal user, since they won't have any permissions
for /selinux. So this will have to be tested manually
for now, until we have virtualization for most of
libselinux.
Diffstat (limited to 'bus/test-main.c')
-rw-r--r-- | bus/test-main.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/bus/test-main.c b/bus/test-main.c index d92e3fee..4043f6ed 100644 --- a/bus/test-main.c +++ b/bus/test-main.c @@ -52,6 +52,23 @@ check_memleaks (const char *name) } #endif /* DBUS_BUILD_TESTS */ +static void +test_pre_hook (void) +{ + + if (_dbus_getenv ("DBUS_TEST_SELINUX") && !bus_selinux_init ()) + die ("could not init selinux support"); +} + +static char *progname = ""; +static void +test_post_hook (void) +{ + if (_dbus_getenv ("DBUS_TEST_SELINUX")) + bus_selinux_shutdown (); + check_memleaks (progname); +} + int main (int argc, char **argv) { @@ -59,6 +76,8 @@ main (int argc, char **argv) const char *dir; DBusString test_data_dir; + progname = argv[0]; + if (argc > 1) dir = argv[1]; else @@ -70,9 +89,6 @@ main (int argc, char **argv) return 1; } - if (!bus_selinux_init ()) - die ("could not init selinux support"); - _dbus_string_init_const (&test_data_dir, dir); #if 0 @@ -81,50 +97,50 @@ main (int argc, char **argv) die ("initializing debug threads"); #endif + test_pre_hook (); printf ("%s: Running expire list test\n", argv[0]); if (!bus_expire_list_test (&test_data_dir)) die ("expire list"); - - check_memleaks (argv[0]); - + test_post_hook (); + + test_pre_hook (); printf ("%s: Running config file parser test\n", argv[0]); if (!bus_config_parser_test (&test_data_dir)) die ("parser"); - - check_memleaks (argv[0]); - + test_post_hook (); + + test_pre_hook (); printf ("%s: Running policy test\n", argv[0]); if (!bus_policy_test (&test_data_dir)) die ("policy"); + test_post_hook (); - check_memleaks (argv[0]); - + test_pre_hook (); printf ("%s: Running signals test\n", argv[0]); if (!bus_signals_test (&test_data_dir)) die ("signals"); + test_post_hook (); - check_memleaks (argv[0]); - + test_pre_hook (); printf ("%s: Running SHA1 connection test\n", argv[0]); if (!bus_dispatch_sha1_test (&test_data_dir)) die ("sha1"); + test_post_hook (); - check_memleaks (argv[0]); + test_pre_hook (); printf ("%s: Running message dispatch test\n", argv[0]); if (!bus_dispatch_test (&test_data_dir)) die ("dispatch"); + test_post_hook (); - check_memleaks (argv[0]); - + test_pre_hook (); printf ("%s: Running service files reloading test\n", argv[0]); if (!bus_activation_service_reload_test (&test_data_dir)) die ("service reload"); + test_post_hook (); - check_memleaks (argv[0]); - printf ("%s: Success\n", argv[0]); - bus_selinux_shutdown (); return 0; #else /* DBUS_BUILD_TESTS */ |