dbus: fix 64-bit compiler warnings
[platform/upstream/dbus.git] / dbus / dbus-test.c
index 658d2d8..6c0d71f 100644 (file)
@@ -1,4 +1,4 @@
-/* -*- mode: C; c-file-style: "gnu" -*- */
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
 /* dbus-test.c  Program to run all tests
  *
  * Copyright (C) 2002, 2003, 2004, 2005  Red Hat Inc.
@@ -17,7 +17,7 @@
  * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  *
  */
 
@@ -28,7 +28,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
+static void die (const char *failure) _DBUS_GNUC_NORETURN;
+
 static void
 die (const char *failure)
 {
@@ -41,17 +43,15 @@ check_memleaks (void)
 {
   dbus_shutdown ();
 
-  printf ("%s: checking for memleaks\n", "dbus-test");
+  printf ("%s: checking for memleaks\n", "test-dbus");
   if (_dbus_get_malloc_blocks_outstanding () != 0)
     {
-      _dbus_warn ("%d dbus_malloc blocks were not freed\n",
+      _dbus_warn ("%d dbus_malloc blocks were not freed",
                   _dbus_get_malloc_blocks_outstanding ());
       die ("memleaks");
     }
 }
 
-#endif /* DBUS_BUILD_TESTS */
-
 typedef dbus_bool_t (*TestFunc)(void);
 typedef dbus_bool_t (*TestDataFunc)(const char *data);
 
@@ -62,12 +62,12 @@ run_test (const char             *test_name,
 {
   if (!specific_test || strcmp (specific_test, test_name) == 0)
     {
-      printf ("%s: running %s tests\n", "dbus-test", test_name);
+      printf ("%s: running %s tests\n", "test-dbus", test_name);
       if (!test ())
        die (test_name);
-    }
 
-  check_memleaks ();
+      check_memleaks ();
+    }
 }
 
 static void
@@ -78,14 +78,16 @@ run_data_test (const char             *test_name,
 {
   if (!specific_test || strcmp (specific_test, test_name) == 0)
     {
-      printf ("%s: running %s tests\n", "dbus-test", test_name);
+      printf ("%s: running %s tests\n", "test-dbus", test_name);
       if (!test (test_data_dir))
        die (test_name);
-    }
 
-  check_memleaks ();
+      check_memleaks ();
+    }
 }
 
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */
+
 /**
  * An exported symbol to be run in order to execute
  * unit tests. Should not be used by
@@ -94,11 +96,12 @@ run_data_test (const char             *test_name,
  * (with --enable-tests=no)
  *
  * @param test_data_dir the directory with test data (test/data normally)
+ * @param specific_test run specific test or #NULL to run all tests
  */
 void
 dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *specific_test)
 {
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
   if (!_dbus_threads_init_debug ())
     die ("debug threads init");
   
@@ -115,6 +118,8 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *speci
   run_test ("sysdeps", specific_test, _dbus_sysdeps_test);
   
   run_test ("data-slot", specific_test, _dbus_data_slot_test);
+
+  run_test ("misc", specific_test, _dbus_misc_test);
   
   run_test ("address", specific_test, _dbus_address_test);
 
@@ -126,15 +131,7 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *speci
   
   run_test ("marshalling", specific_test, _dbus_marshal_test);
 
-#if 0
-  printf ("%s: running recursive marshalling tests\n", "dbus-test");
-  if (!_dbus_marshal_recursive_test ())
-    die ("recursive marshal");
-
-  check_memleaks ();
-#else
-  _dbus_warn ("recursive marshal tests disabled\n");
-#endif
+  run_test ("marshal-recursive", specific_test, _dbus_marshal_recursive_test);
 
   run_test ("byteswap", specific_test, _dbus_marshal_byteswap_test);
   
@@ -148,34 +145,31 @@ dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *speci
 
   run_test ("marshal-validate", specific_test, _dbus_marshal_validate_test);
 
-  run_test ("marshal-header", specific_test, _dbus_marshal_header_test);
-  
   run_data_test ("message", specific_test, _dbus_message_test, test_data_dir);
   
   run_test ("hash", specific_test, _dbus_hash_test);
 
+#if !defined(DBUS_WINCE)
   run_data_test ("spawn", specific_test, _dbus_spawn_test, test_data_dir);
+#endif
   
+  run_data_test ("credentials", specific_test, _dbus_credentials_test, test_data_dir);
+
+#ifdef DBUS_UNIX
   run_data_test ("userdb", specific_test, _dbus_userdb_test, test_data_dir);
-  
-  run_test ("keyring", specific_test, _dbus_keyring_test);
-  
-#if 0
-  printf ("%s: running md5 tests\n", "dbus-test");
-  if (!_dbus_md5_test ())
-    die ("md5");
 
-  check_memleaks ();
+  run_test ("transport-unix", specific_test, _dbus_transport_unix_test);
 #endif
   
+  run_test ("keyring", specific_test, _dbus_keyring_test);
+
   run_data_test ("sha", specific_test, _dbus_sha_test, test_data_dir);
   
   run_data_test ("auth", specific_test, _dbus_auth_test, test_data_dir);
 
-  run_data_test ("pending-call", specific_test, _dbus_pending_call_test, test_data_dir);
-  
-  printf ("%s: completed successfully\n", "dbus-test");
+  printf ("%s: completed successfully\n", "test-dbus");
 #else
   printf ("Not compiled with unit tests, not running any\n");
 #endif
 }
+