dbus-gtest.c

00001 /* -*- mode: C; c-file-style: "gnu" -*- */
00002 /* dbus-test.c  Program to run all tests
00003  *
00004  * Copyright (C) 2002, 2003  Red Hat Inc.
00005  *
00006  * Licensed under the Academic Free License version 2.1
00007  * 
00008  * This program is free software; you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or
00011  * (at your option) any later version.
00012  *
00013  * This program is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  * 
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 /* DBUS_BUILD_TESTS */
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 

Generated on Wed Oct 3 10:04:23 2007 for D-BUSGLibBindings by  doxygen 1.5.1