2004-07-24 Havoc Pennington <hp@redhat.com>
[platform/upstream/dbus.git] / bus / test-main.c
index 3768de5..6d453b4 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2003 Red Hat, Inc.
  *
- * Licensed under the Academic Free License version 1.2
+ * Licensed under the Academic Free License version 2.0
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,7 +27,9 @@
 #include <dbus/dbus-string.h>
 #include <dbus/dbus-sysdeps.h>
 #include <dbus/dbus-internals.h>
+#include "selinux.h"
 
+#ifdef DBUS_BUILD_TESTS
 static void
 die (const char *failure)
 {
@@ -48,6 +50,7 @@ check_memleaks (const char *name)
       die ("memleaks");
     }
 }
+#endif /* DBUS_BUILD_TESTS */
 
 int
 main (int argc, char **argv)
@@ -62,29 +65,66 @@ main (int argc, char **argv)
     dir = _dbus_getenv ("DBUS_TEST_DATA");
 
   if (dir == NULL)
-    dir = "";
+    {
+      fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n");
+      return 1;
+    }
+
+  if (!bus_selinux_init ())
+    die ("could not init selinux support");
 
   _dbus_string_init_const (&test_data_dir, dir);
+
+#if 0
+  /* FIXME this is disabled because of thread bugs that need fixing... */
+  if (!_dbus_threads_init_debug ())
+    die ("initializing debug threads");
+#endif
+  printf ("%s: Running expire list test\n", argv[0]);
+  if (!bus_expire_list_test (&test_data_dir))
+    die ("expire list");
+  
+  check_memleaks (argv[0]);
   
   printf ("%s: Running config file parser test\n", argv[0]);
   if (!bus_config_parser_test (&test_data_dir))
     die ("parser");
-
-  check_memleaks (argv[0]);
+  
+  check_memleaks (argv[0]);  
   
   printf ("%s: Running policy test\n", argv[0]);
   if (!bus_policy_test (&test_data_dir))
     die ("policy");
 
   check_memleaks (argv[0]);
+
+  printf ("%s: Running signals test\n", argv[0]);
+  if (!bus_signals_test (&test_data_dir))
+    die ("signals");
+
+  check_memleaks (argv[0]);
   
+  printf ("%s: Running SHA1 connection test\n", argv[0]);
+  if (!bus_dispatch_sha1_test (&test_data_dir))
+    die ("sha1");
+
+  check_memleaks (argv[0]);
   printf ("%s: Running message dispatch test\n", argv[0]);
-  if (!bus_dispatch_test (&test_data_dir))
+  if (!bus_dispatch_test (&test_data_dir)) 
     die ("dispatch");
 
   check_memleaks (argv[0]);
+
+  printf ("%s: Running service files reloading test\n", argv[0]);
+  if (!bus_activation_service_reload_test (&test_data_dir))
+    die ("service reload");
+
+  check_memleaks (argv[0]);
   
   printf ("%s: Success\n", argv[0]);
+
+  bus_selinux_shutdown ();
   
   return 0;
 #else /* DBUS_BUILD_TESTS */