Coverage report for bus/test-main.c.gcov

        -:    0:Source:test-main.c
        -:    0:Graph:test-main.gcno
        -:    0:Data:test-main.gcda
        -:    0:Runs:10110
        -:    0:Programs:1
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* test-main.c  main() for make check
        -:    3: *
        -:    4: * Copyright (C) 2003 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 "test.h"
        -:   25:#include <stdio.h>
        -:   26:#include <stdlib.h>
        -:   27:#include <dbus/dbus-string.h>
        -:   28:#include <dbus/dbus-sysdeps.h>
        -:   29:#include <dbus/dbus-internals.h>
        -:   30:#include "selinux.h"
        -:   31:
        -:   32:#ifdef DBUS_BUILD_TESTS
        -:   33:static void
        -:   34:die (const char *failure)
function die called 0 returned 0% blocks executed 0%
    #####:   35:{
    #####:   36:  fprintf (stderr, "Unit test failed: %s\n", failure);
call    0 never executed
    #####:   37:  exit (1);
call    0 never executed
        -:   38:}
        -:   39:
        -:   40:static void
        -:   41:check_memleaks (const char *name)
function check_memleaks called 7 returned 100% blocks executed 63%
        7:   42:{
        7:   43:  dbus_shutdown ();
call    0 returned 100%
        -:   44:  
        7:   45:  printf ("%s: checking for memleaks\n", name);
call    0 returned 100%
        7:   46:  if (_dbus_get_malloc_blocks_outstanding () != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:   47:    {
    #####:   48:      _dbus_warn ("%d dbus_malloc blocks were not freed\n",
call    0 never executed
call    1 never executed
        -:   49:                  _dbus_get_malloc_blocks_outstanding ());
    #####:   50:      die ("memleaks");
call    0 never executed
        -:   51:    }
        7:   52:}
        -:   53:#endif /* DBUS_BUILD_TESTS */
        -:   54:
        -:   55:static void
        -:   56:test_pre_hook (void)
function test_pre_hook called 7 returned 100% blocks executed 38%
        7:   57:{
        -:   58:  
        7:   59:  if (_dbus_getenv ("DBUS_TEST_SELINUX")
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
branch  4 never executed
branch  5 never executed
call    6 never executed
branch  7 never executed
branch  8 never executed
        -:   60:      && (!bus_selinux_pre_init ()
        -:   61:	  || !bus_selinux_full_init ()))
    #####:   62:    die ("could not init selinux support");
call    0 never executed
        7:   63:}
        -:   64:
        -:   65:static char *progname = "";
        -:   66:static void
        -:   67:test_post_hook (void)
function test_post_hook called 7 returned 100% blocks executed 80%
        7:   68:{
        7:   69:  if (_dbus_getenv ("DBUS_TEST_SELINUX"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:   70:    bus_selinux_shutdown ();
call    0 never executed
        7:   71:  check_memleaks (progname);
call    0 returned 100%
        7:   72:}
        -:   73:
        -:   74:int
        -:   75:main (int argc, char **argv)
function main called 1 returned 100% blocks executed 81%
        1:   76:{
        -:   77:#ifdef DBUS_BUILD_TESTS
        -:   78:  const char *dir;
        -:   79:  DBusString test_data_dir;
        -:   80:
        1:   81:  progname = argv[0];
        -:   82:
        1:   83:  if (argc > 1)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:   84:    dir = argv[1];
        -:   85:  else
        1:   86:    dir = _dbus_getenv ("DBUS_TEST_DATA");
call    0 returned 100%
        -:   87:
        1:   88:  if (dir == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:   89:    {
    #####:   90:      fprintf (stderr, "Must specify test data directory as argv[1] or in DBUS_TEST_DATA env variable\n");
call    0 never executed
    #####:   91:      return 1;
        -:   92:    }
        -:   93:
        1:   94:  _dbus_string_init_const (&test_data_dir, dir);
call    0 returned 100%
        -:   95:
        -:   96:#if 0
        -:   97:  /* FIXME this is disabled because of thread bugs that need fixing... */
        -:   98:  if (!_dbus_threads_init_debug ())
        -:   99:    die ("initializing debug threads");
        -:  100:#endif
        -:  101: 
        1:  102:  test_pre_hook ();
call    0 returned 100%
        1:  103:  printf ("%s: Running expire list test\n", argv[0]);
call    0 returned 100%
        1:  104:  if (!bus_expire_list_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  105:    die ("expire list");
call    0 never executed
        1:  106:  test_post_hook ();
call    0 returned 100%
        -:  107: 
        1:  108:  test_pre_hook ();
call    0 returned 100%
        1:  109:  printf ("%s: Running config file parser test\n", argv[0]);
call    0 returned 100%
        1:  110:  if (!bus_config_parser_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  111:    die ("parser");
call    0 never executed
        1:  112:  test_post_hook ();
call    0 returned 100%
        -:  113:
        1:  114:  test_pre_hook ();
call    0 returned 100%
        1:  115:  printf ("%s: Running policy test\n", argv[0]);
call    0 returned 100%
        1:  116:  if (!bus_policy_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  117:    die ("policy");
call    0 never executed
        1:  118:  test_post_hook ();
call    0 returned 100%
        -:  119:
        1:  120:  test_pre_hook ();
call    0 returned 100%
        1:  121:  printf ("%s: Running signals test\n", argv[0]);
call    0 returned 100%
        1:  122:  if (!bus_signals_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  123:    die ("signals");
call    0 never executed
        1:  124:  test_post_hook ();
call    0 returned 100%
        -:  125:
        1:  126:  test_pre_hook ();
call    0 returned 100%
        1:  127:  printf ("%s: Running SHA1 connection test\n", argv[0]);
call    0 returned 100%
        1:  128:  if (!bus_dispatch_sha1_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  129:    die ("sha1");
call    0 never executed
        1:  130:  test_post_hook ();
call    0 returned 100%
        -:  131:
        1:  132:  test_pre_hook ();
call    0 returned 100%
        1:  133:  printf ("%s: Running message dispatch test\n", argv[0]);
call    0 returned 100%
        1:  134:  if (!bus_dispatch_test (&test_data_dir)) 
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  135:    die ("dispatch");
call    0 never executed
        1:  136:  test_post_hook ();
call    0 returned 100%
        -:  137:
        1:  138:  test_pre_hook ();
call    0 returned 100%
        1:  139:  printf ("%s: Running service files reloading test\n", argv[0]);
call    0 returned 100%
        1:  140:  if (!bus_activation_service_reload_test (&test_data_dir))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  141:    die ("service reload");
call    0 never executed
        1:  142:  test_post_hook ();
call    0 returned 100%
        -:  143:
        1:  144:  printf ("%s: Success\n", argv[0]);
call    0 returned 100%
        -:  145:
        -:  146:  
        1:  147:  return 0;
        -:  148:#else /* DBUS_BUILD_TESTS */
        -:  149:
        -:  150:  printf ("Not compiled with test support\n");
        -:  151:  
        -:  152:  return 0;
        -:  153:#endif
        -:  154:}