00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <config.h>
00025 #include "dbus-gtest.h"
00026 #include <stdio.h>
00027 #include <stdlib.h>
00028 #include <glib.h>
00029
00030 #ifdef DBUS_BUILD_TESTS
00031 static void
00032 die (const char *failure)
00033 {
00034 fprintf (stderr, "Unit test failed: %s\n", failure);
00035 exit (1);
00036 }
00037 #endif
00038
00048 void
00049 dbus_glib_internal_do_not_use_run_tests (const char *test_data_dir)
00050 {
00051 #ifdef DBUS_BUILD_TESTS
00052 if (test_data_dir == NULL)
00053 test_data_dir = g_getenv ("DBUS_TEST_DATA");
00054
00055 if (test_data_dir != NULL)
00056 printf ("Test data in %s\n", test_data_dir);
00057 else
00058 printf ("No test data!\n");
00059
00060 g_type_init ();
00061
00062 printf ("%s: running GValue util tests\n", "dbus-glib-test");
00063 if (!_dbus_gvalue_utils_test (test_data_dir))
00064 die ("gvalue utils");
00065
00066 printf ("%s: running GValue tests\n", "dbus-glib-test");
00067 if (!_dbus_gvalue_test (test_data_dir))
00068 die ("gvalue utils");
00069
00070 printf ("%s: running glib tests\n", "dbus-glib-test");
00071 if (!_dbus_glib_test (test_data_dir))
00072 die ("glib");
00073
00074 printf ("%s: running utils tests\n", "dbus-glib-test");
00075 if (!_dbus_gutils_test (test_data_dir))
00076 die ("gutils");
00077
00078 printf ("%s: running mainloop integration tests\n", "dbus-glib-test");
00079 if (!_dbus_gmain_test (test_data_dir))
00080 die ("gmain");
00081
00082 printf ("%s: running GObject tests\n", "dbus-glib-test");
00083 if (!_dbus_gobject_test (test_data_dir))
00084 die ("gobject");
00085
00086 printf ("%s: completed successfully\n", "dbus-glib-test");
00087 #else
00088 printf ("Not compiled with unit tests, not running any\n");
00089 #endif
00090 }
00091
00092