Main Page | Modules | Data Structures | Directories | File List | Data Fields | Related Pages

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 
00029 #ifdef DBUS_BUILD_TESTS
00030 static void
00031 die (const char *failure)
00032 {
00033   fprintf (stderr, "Unit test failed: %s\n", failure);
00034   exit (1);
00035 }
00036 #endif /* DBUS_BUILD_TESTS */
00037 
00047 void
00048 dbus_glib_internal_do_not_use_run_tests (const char *test_data_dir)
00049 {
00050 #ifdef DBUS_BUILD_TESTS  
00051   if (test_data_dir == NULL)
00052     test_data_dir = g_getenv ("DBUS_TEST_DATA");
00053 
00054   if (test_data_dir != NULL)
00055     printf ("Test data in %s\n", test_data_dir);
00056   else
00057     printf ("No test data!\n");
00058 
00059   printf ("%s: running glib tests\n", "dbus-glib-test");
00060   if (!_dbus_glib_test (test_data_dir))
00061     die ("glib");
00062   
00063   printf ("%s: running utils tests\n", "dbus-glib-test");
00064   if (!_dbus_gutils_test (test_data_dir))
00065     die ("gutils");
00066   
00067   printf ("%s: running mainloop integration tests\n", "dbus-glib-test");
00068   if (!_dbus_gmain_test (test_data_dir))
00069     die ("gmain");
00070 
00071   printf ("%s: running GObject tests\n", "dbus-glib-test");
00072   if (!_dbus_gobject_test (test_data_dir))
00073     die ("gobject");
00074   
00075   printf ("%s: completed successfully\n", "dbus-glib-test");
00076 #else
00077   printf ("Not compiled with unit tests, not running any\n");
00078 #endif
00079 }
00080 
00081 

Generated on Wed Mar 30 21:15:20 2005 for D-BUS by  doxygen 1.4.1