+typedef dbus_bool_t (*TestFunc)(void);
+typedef dbus_bool_t (*TestDataFunc)(const char *data);
+
+static void
+run_test (const char *test_name,
+ const char *specific_test,
+ TestFunc test)
+{
+ if (!specific_test || strcmp (specific_test, test_name) == 0)
+ {
+ printf ("%s: running %s tests\n", "dbus-test", test_name);
+ if (!test ())
+ die (test_name);
+ }
+
+ check_memleaks ();
+}
+
+static void
+run_data_test (const char *test_name,
+ const char *specific_test,
+ TestDataFunc test,
+ const char *test_data_dir)
+{
+ if (!specific_test || strcmp (specific_test, test_name) == 0)
+ {
+ printf ("%s: running %s tests\n", "dbus-test", test_name);
+ if (!test (test_data_dir))
+ die (test_name);
+ }
+
+ check_memleaks ();
+}
+