Coverage report for dbus/dbus-test.c.gcov
-: 0:Source:dbus-test.c
-: 0:Graph:.libs/dbus-test.gcno
-: 0:Data:.libs/dbus-test.gcda
-: 0:Runs:780
-: 0:Programs:1
-: 1:/* -*- mode: C; c-file-style: "gnu" -*- */
-: 2:/* dbus-test.c Program to run all tests
-: 3: *
-: 4: * Copyright (C) 2002, 2003, 2004, 2005 Red Hat Inc.
-: 5: *
-: 6: * Licensed under the Academic Free License version 2.1
-: 7: *
-: 8: * This program is free software; you can redistribute it and/or modify
-: 9: * it under the terms of the GNU General Public License as published by
-: 10: * the Free Software Foundation; either version 2 of the License, or
-: 11: * (at your option) any later version.
-: 12: *
-: 13: * This program is distributed in the hope that it will be useful,
-: 14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
-: 15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-: 16: * GNU General Public License for more details.
-: 17: *
-: 18: * You should have received a copy of the GNU General Public License
-: 19: * along with this program; if not, write to the Free Software
-: 20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-: 21: *
-: 22: */
-: 23:
-: 24:#include <config.h>
-: 25:#include "dbus-test.h"
-: 26:#include "dbus-sysdeps.h"
-: 27:#include "dbus-internals.h"
-: 28:#include <stdio.h>
-: 29:#include <stdlib.h>
-: 30:
-: 31:#ifdef DBUS_BUILD_TESTS
-: 32:static void
-: 33:die (const char *failure)
function die called 0 returned 0% blocks executed 0%
#####: 34:{
#####: 35: fprintf (stderr, "Unit test failed: %s\n", failure);
call 0 never executed
#####: 36: exit (1);
call 0 never executed
-: 37:}
-: 38:
-: 39:static void
-: 40:check_memleaks (void)
function check_memleaks called 22 returned 100% blocks executed 63%
22: 41:{
22: 42: dbus_shutdown ();
call 0 returned 100%
-: 43:
22: 44: printf ("%s: checking for memleaks\n", "dbus-test");
call 0 returned 100%
22: 45: if (_dbus_get_malloc_blocks_outstanding () != 0)
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
-: 46: {
#####: 47: _dbus_warn ("%d dbus_malloc blocks were not freed\n",
call 0 never executed
call 1 never executed
-: 48: _dbus_get_malloc_blocks_outstanding ());
#####: 49: die ("memleaks");
call 0 never executed
-: 50: }
22: 51:}
-: 52:
-: 53:#endif /* DBUS_BUILD_TESTS */
-: 54:
-: 55:typedef dbus_bool_t (*TestFunc)(void);
-: 56:typedef dbus_bool_t (*TestDataFunc)(const char *data);
-: 57:
-: 58:static void
-: 59:run_test (const char *test_name,
-: 60: const char *specific_test,
-: 61: TestFunc test)
function run_test called 16 returned 100% blocks executed 67%
16: 62:{
16: 63: if (!specific_test || strcmp (specific_test, test_name) == 0)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
call 2 never executed
branch 3 never executed
branch 4 never executed
-: 64: {
16: 65: printf ("%s: running %s tests\n", "dbus-test", test_name);
call 0 returned 100%
16: 66: if (!test ())
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 67: die (test_name);
call 0 never executed
-: 68: }
-: 69:
16: 70: check_memleaks ();
call 0 returned 100%
16: 71:}
-: 72:
-: 73:static void
-: 74:run_data_test (const char *test_name,
-: 75: const char *specific_test,
-: 76: TestDataFunc test,
-: 77: const char *test_data_dir)
function run_data_test called 6 returned 100% blocks executed 67%
6: 78:{
6: 79: if (!specific_test || strcmp (specific_test, test_name) == 0)
branch 0 taken 0% (fallthrough)
branch 1 taken 100%
call 2 never executed
branch 3 never executed
branch 4 never executed
-: 80: {
6: 81: printf ("%s: running %s tests\n", "dbus-test", test_name);
call 0 returned 100%
6: 82: if (!test (test_data_dir))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 83: die (test_name);
call 0 never executed
-: 84: }
-: 85:
6: 86: check_memleaks ();
call 0 returned 100%
6: 87:}
-: 88:
-: 89:/**
-: 90: * An exported symbol to be run in order to execute
-: 91: * unit tests. Should not be used by
-: 92: * any app other than our test app, this symbol
-: 93: * won't exist in some builds of the library.
-: 94: * (with --enable-tests=no)
-: 95: *
-: 96: * @param test_data_dir the directory with test data (test/data normally)
-: 97: */
-: 98:void
-: 99:dbus_internal_do_not_use_run_tests (const char *test_data_dir, const char *specific_test)
function dbus_internal_do_not_use_run_tests called 1 returned 100% blocks executed 94%
1: 100:{
-: 101:#ifdef DBUS_BUILD_TESTS
1: 102: if (!_dbus_threads_init_debug ())
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 103: die ("debug threads init");
call 0 never executed
-: 104:
1: 105: if (test_data_dir == NULL)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
1: 106: test_data_dir = _dbus_getenv ("DBUS_TEST_DATA");
call 0 returned 100%
-: 107:
1: 108: if (test_data_dir != NULL)
branch 0 taken 100% (fallthrough)
branch 1 taken 0%
1: 109: printf ("Test data in %s\n", test_data_dir);
call 0 returned 100%
-: 110: else
#####: 111: printf ("No test data!\n");
call 0 never executed
-: 112:
1: 113: run_test ("string", specific_test, _dbus_string_test);
call 0 returned 100%
-: 114:
1: 115: run_test ("sysdeps", specific_test, _dbus_sysdeps_test);
call 0 returned 100%
-: 116:
1: 117: run_test ("data-slot", specific_test, _dbus_data_slot_test);
call 0 returned 100%
-: 118:
1: 119: run_test ("address", specific_test, _dbus_address_test);
call 0 returned 100%
-: 120:
1: 121: run_test ("server", specific_test, _dbus_server_test);
call 0 returned 100%
-: 122:
1: 123: run_test ("object-tree", specific_test, _dbus_object_tree_test);
call 0 returned 100%
-: 124:
1: 125: run_test ("signature", specific_test, _dbus_signature_test);
call 0 returned 100%
-: 126:
1: 127: run_test ("marshalling", specific_test, _dbus_marshal_test);
call 0 returned 100%
-: 128:
-: 129:#if 0
-: 130: printf ("%s: running recursive marshalling tests\n", "dbus-test");
-: 131: if (!_dbus_marshal_recursive_test ())
-: 132: die ("recursive marshal");
-: 133:
-: 134: check_memleaks ();
-: 135:#else
1: 136: _dbus_warn ("recursive marshal tests disabled\n");
call 0 returned 100%
-: 137:#endif
-: 138:
1: 139: run_test ("byteswap", specific_test, _dbus_marshal_byteswap_test);
call 0 returned 100%
-: 140:
1: 141: run_test ("memory", specific_test, _dbus_memory_test);
call 0 returned 100%
-: 142:
-: 143:#if 1
1: 144: run_test ("mem-pool", specific_test, _dbus_mem_pool_test);
call 0 returned 100%
-: 145:#endif
-: 146:
1: 147: run_test ("list", specific_test, _dbus_list_test);
call 0 returned 100%
-: 148:
1: 149: run_test ("marshal-validate", specific_test, _dbus_marshal_validate_test);
call 0 returned 100%
-: 150:
1: 151: run_test ("marshal-header", specific_test, _dbus_marshal_header_test);
call 0 returned 100%
-: 152:
1: 153: run_data_test ("message", specific_test, _dbus_message_test, test_data_dir);
call 0 returned 100%
-: 154:
1: 155: run_test ("hash", specific_test, _dbus_hash_test);
call 0 returned 100%
-: 156:
1: 157: run_data_test ("spawn", specific_test, _dbus_spawn_test, test_data_dir);
call 0 returned 100%
-: 158:
1: 159: run_data_test ("userdb", specific_test, _dbus_userdb_test, test_data_dir);
call 0 returned 100%
-: 160:
1: 161: run_test ("keyring", specific_test, _dbus_keyring_test);
call 0 returned 100%
-: 162:
-: 163:#if 0
-: 164: printf ("%s: running md5 tests\n", "dbus-test");
-: 165: if (!_dbus_md5_test ())
-: 166: die ("md5");
-: 167:
-: 168: check_memleaks ();
-: 169:#endif
-: 170:
1: 171: run_data_test ("sha", specific_test, _dbus_sha_test, test_data_dir);
call 0 returned 100%
-: 172:
1: 173: run_data_test ("auth", specific_test, _dbus_auth_test, test_data_dir);
call 0 returned 100%
-: 174:
1: 175: run_data_test ("pending-call", specific_test, _dbus_pending_call_test, test_data_dir);
call 0 returned 100%
-: 176:
1: 177: printf ("%s: completed successfully\n", "dbus-test");
call 0 returned 100%
-: 178:#else
-: 179: printf ("Not compiled with unit tests, not running any\n");
-: 180:#endif
1: 181:}