Coverage report for dbus/dbus-message-util.c.gcov

        -:    0:Source:dbus-message-util.c
        -:    0:Graph:.libs/dbus-message-util.gcno
        -:    0:Data:.libs/dbus-message-util.gcda
        -:    0:Runs:767
        -:    0:Programs:1
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* dbus-message-util.c Would be in dbus-message.c, but only used by bus/tests
        -:    3: *
        -:    4: * Copyright (C) 2002, 2003, 2004, 2005  Red Hat Inc.
        -:    5: * Copyright (C) 2002, 2003  CodeFactory AB
        -:    6: *
        -:    7: * Licensed under the Academic Free License version 2.1
        -:    8: *
        -:    9: * This program is free software; you can redistribute it and/or modify
        -:   10: * it under the terms of the GNU General Public License as published by
        -:   11: * the Free Software Foundation; either version 2 of the License, or
        -:   12: * (at your option) any later version.
        -:   13: *
        -:   14: * This program is distributed in the hope that it will be useful,
        -:   15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   17: * GNU General Public License for more details.
        -:   18: *
        -:   19: * You should have received a copy of the GNU General Public License
        -:   20: * along with this program; if not, write to the Free Software
        -:   21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   22: *
        -:   23: */
        -:   24:
        -:   25:#include "dbus-internals.h"
        -:   26:#include "dbus-test.h"
        -:   27:#include "dbus-message-private.h"
        -:   28:#include "dbus-marshal-recursive.h"
        -:   29:#include "dbus-string.h"
        -:   30:
        -:   31:/**
        -:   32: * @addtogroup DBusMessage
        -:   33: * @{
        -:   34: */
        -:   35:
        -:   36:#ifdef DBUS_BUILD_TESTS
        -:   37:/**
        -:   38: * Reads arguments from a message iterator given a variable argument
        -:   39: * list. Only arguments of basic type and arrays of fixed-length
        -:   40: * basic type may be read with this function. See
        -:   41: * dbus_message_get_args() for more details.
        -:   42: *
        -:   43: * @todo this is static for now because there's no corresponding
        -:   44: * iter_append_args() and I'm not sure we need this function to be
        -:   45: * public since dbus_message_get_args() is what you usually want
        -:   46: *
        -:   47: * @param iter the message iterator
        -:   48: * @param error error to be filled in on failure
        -:   49: * @param first_arg_type the first argument type
        -:   50: * @param ... location for first argument value, then list of type-location pairs
        -:   51: * @returns #FALSE if the error was set
        -:   52: */
        -:   53:static dbus_bool_t
        -:   54:dbus_message_iter_get_args (DBusMessageIter *iter,
        -:   55:			    DBusError       *error,
        -:   56:			    int              first_arg_type,
        -:   57:			    ...)
function dbus_message_iter_get_args called 3 returned 100% blocks executed 65%
        3:   58:{
        -:   59:  dbus_bool_t retval;
        -:   60:  va_list var_args;
        -:   61:
        3:   62:  _dbus_return_val_if_fail (iter != NULL, FALSE);
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
call    3 never executed
call    4 never executed
        3:   63:  _dbus_return_val_if_error_is_set (error, FALSE);
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
call    3 returned 100%
branch  4 taken 0% (fallthrough)
branch  5 taken 100%
call    6 never executed
call    7 never executed
        -:   64:
        3:   65:  va_start (var_args, first_arg_type);
call    0 returned 100%
        3:   66:  retval = _dbus_message_iter_get_args_valist (iter, error, first_arg_type, var_args);
call    0 returned 100%
        3:   67:  va_end (var_args);
call    0 returned 100%
        -:   68:
        3:   69:  return retval;
        -:   70:}
        -:   71:#endif /* DBUS_BUILD_TESTS */
        -:   72:
        -:   73:/** @} */
        -:   74:
        -:   75:#ifdef DBUS_BUILD_TESTS
        -:   76:#include "dbus-test.h"
        -:   77:#include "dbus-message-factory.h"
        -:   78:#include <stdio.h>
        -:   79:#include <stdlib.h>
        -:   80:
        -:   81:static int validities_seen[DBUS_VALIDITY_LAST + _DBUS_NEGATIVE_VALIDITY_COUNT];
        -:   82:
        -:   83:static void
        -:   84:reset_validities_seen (void)
function reset_validities_seen called 1 returned 100% blocks executed 100%
        1:   85:{
        -:   86:  int i;
        1:   87:  i = 0;
       62:   88:  while (i < _DBUS_N_ELEMENTS (validities_seen))
branch  0 taken 98%
branch  1 taken 2% (fallthrough)
        -:   89:    {
       60:   90:      validities_seen[i] = 0;
       60:   91:      ++i;
        -:   92:    }
        1:   93:}
        -:   94:
        -:   95:static void
        -:   96:record_validity_seen (DBusValidity validity)
function record_validity_seen called 117633 returned 100% blocks executed 100%
   117633:   97:{
   117633:   98:  validities_seen[validity + _DBUS_NEGATIVE_VALIDITY_COUNT] += 1;
   117633:   99:}
        -:  100:
        -:  101:static void
        -:  102:print_validities_seen (dbus_bool_t not_seen)
function print_validities_seen called 2 returned 100% blocks executed 100%
        2:  103:{
        -:  104:  int i;
        2:  105:  i = 0;
      124:  106:  while (i < _DBUS_N_ELEMENTS (validities_seen))
branch  0 taken 98%
branch  1 taken 2% (fallthrough)
        -:  107:    {
      120:  108:      if ((i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_VALIDITY_UNKNOWN ||
branch  0 taken 98% (fallthrough)
branch  1 taken 2%
branch  2 taken 98% (fallthrough)
branch  3 taken 2%
        -:  109:          (i - _DBUS_NEGATIVE_VALIDITY_COUNT) == DBUS_INVALID_FOR_UNKNOWN_REASON)
        -:  110:        ;
      116:  111:      else if ((not_seen && validities_seen[i] == 0) ||
branch  0 taken 50% (fallthrough)
branch  1 taken 50%
branch  2 taken 86% (fallthrough)
branch  3 taken 14%
branch  4 taken 54% (fallthrough)
branch  5 taken 46%
branch  6 taken 86% (fallthrough)
branch  7 taken 14%
        -:  112:               (!not_seen && validities_seen[i] > 0))
       58:  113:        printf ("validity %3d seen %d times\n",
call    0 returned 100%
        -:  114:                i - _DBUS_NEGATIVE_VALIDITY_COUNT,
        -:  115:                validities_seen[i]);
      120:  116:      ++i;
        -:  117:    }
        2:  118:}
        -:  119:
        -:  120:static void
        -:  121:check_memleaks (void)
function check_memleaks called 5 returned 100% blocks executed 57%
        5:  122:{
        5:  123:  dbus_shutdown ();
call    0 returned 100%
        -:  124:
        5:  125:  if (_dbus_get_malloc_blocks_outstanding () != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  126:    {
    #####:  127:      _dbus_warn ("%d dbus_malloc blocks were not freed in %s\n",
call    0 never executed
call    1 never executed
        -:  128:                  _dbus_get_malloc_blocks_outstanding (), __FILE__);
    #####:  129:      _dbus_assert_not_reached ("memleaks");
call    0 never executed
        -:  130:    }
        5:  131:}
        -:  132:
        -:  133:static dbus_bool_t
        -:  134:check_have_valid_message (DBusMessageLoader *loader)
function check_have_valid_message called 378 returned 100% blocks executed 65%
      378:  135:{
        -:  136:  DBusMessage *message;
        -:  137:  dbus_bool_t retval;
        -:  138:
      378:  139:  message = NULL;
      378:  140:  retval = FALSE;
        -:  141:
      378:  142:  if (_dbus_message_loader_get_is_corrupted (loader))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  143:    {
    #####:  144:      _dbus_warn ("loader corrupted on message that was expected to be valid; invalid reason %d\n",
call    0 never executed
        -:  145:                  loader->corruption_reason);
    #####:  146:      goto failed;
        -:  147:    }
        -:  148:
      378:  149:  message = _dbus_message_loader_pop_message (loader);
call    0 returned 100%
      378:  150:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  151:    {
    #####:  152:      _dbus_warn ("didn't load message that was expected to be valid (message not popped)\n");
call    0 never executed
    #####:  153:      goto failed;
        -:  154:    }
        -:  155:
      378:  156:  if (_dbus_string_get_length (&loader->data) > 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  157:    {
    #####:  158:      _dbus_warn ("had leftover bytes from expected-to-be-valid single message\n");
call    0 never executed
    #####:  159:      goto failed;
        -:  160:    }
        -:  161:
        -:  162:#if 0
        -:  163:  /* FIXME */
        -:  164:  /* Verify that we're able to properly deal with the message.
        -:  165:   * For example, this would detect improper handling of messages
        -:  166:   * in nonstandard byte order.
        -:  167:   */
        -:  168:  if (!check_message_handling (message))
        -:  169:    goto failed;
        -:  170:#endif
        -:  171:
      378:  172:  record_validity_seen (DBUS_VALID);
call    0 returned 100%
        -:  173:  
      378:  174:  retval = TRUE;
        -:  175:
      378:  176: failed:
      378:  177:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      378:  178:    dbus_message_unref (message);
call    0 returned 100%
        -:  179:
      378:  180:  return retval;
        -:  181:}
        -:  182:
        -:  183:static dbus_bool_t
        -:  184:check_invalid_message (DBusMessageLoader *loader,
        -:  185:                       DBusValidity       expected_validity)
function check_invalid_message called 7236 returned 100% blocks executed 64%
     7236:  186:{
        -:  187:  dbus_bool_t retval;
        -:  188:
     7236:  189:  retval = FALSE;
        -:  190:
     7236:  191:  if (!_dbus_message_loader_get_is_corrupted (loader))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  192:    {
    #####:  193:      _dbus_warn ("loader not corrupted on message that was expected to be invalid\n");
call    0 never executed
    #####:  194:      goto failed;
        -:  195:    }
        -:  196:
     7236:  197:  record_validity_seen (loader->corruption_reason);
call    0 returned 100%
        -:  198:  
     7236:  199:  if (expected_validity != DBUS_INVALID_FOR_UNKNOWN_REASON &&
branch  0 taken 60% (fallthrough)
branch  1 taken 40%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
        -:  200:      loader->corruption_reason != expected_validity)
        -:  201:    {
    #####:  202:      _dbus_warn ("expected message to be corrupted for reason %d and was corrupted for %d instead\n",
call    0 never executed
        -:  203:                  expected_validity, loader->corruption_reason);
    #####:  204:      goto failed;
        -:  205:    }
        -:  206:
     7236:  207:  retval = TRUE;
        -:  208:
     7236:  209: failed:
     7236:  210:  return retval;
        -:  211:}
        -:  212:
        -:  213:static dbus_bool_t
        -:  214:check_incomplete_message (DBusMessageLoader *loader)
function check_incomplete_message called 0 returned 0% blocks executed 0%
    #####:  215:{
        -:  216:  DBusMessage *message;
        -:  217:  dbus_bool_t retval;
        -:  218:
    #####:  219:  message = NULL;
    #####:  220:  retval = FALSE;
        -:  221:
    #####:  222:  if (_dbus_message_loader_get_is_corrupted (loader))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  223:    {
    #####:  224:      _dbus_warn ("loader corrupted on message that was expected to be valid (but incomplete), corruption reason %d\n",
call    0 never executed
        -:  225:                  loader->corruption_reason);
    #####:  226:      goto failed;
        -:  227:    }
        -:  228:
    #####:  229:  message = _dbus_message_loader_pop_message (loader);
call    0 never executed
    #####:  230:  if (message != NULL)
branch  0 never executed
branch  1 never executed
        -:  231:    {
    #####:  232:      _dbus_warn ("loaded message that was expected to be incomplete\n");
call    0 never executed
    #####:  233:      goto failed;
        -:  234:    }
        -:  235:
    #####:  236:  record_validity_seen (DBUS_VALID_BUT_INCOMPLETE);
call    0 never executed
    #####:  237:  retval = TRUE;
        -:  238:
    #####:  239: failed:
    #####:  240:  if (message)
branch  0 never executed
branch  1 never executed
    #####:  241:    dbus_message_unref (message);
call    0 never executed
    #####:  242:  return retval;
        -:  243:}
        -:  244:
        -:  245:static dbus_bool_t
        -:  246:check_loader_results (DBusMessageLoader      *loader,
        -:  247:                      DBusValidity            expected_validity)
function check_loader_results called 154638 returned 100% blocks executed 82%
   154638:  248:{
   154638:  249:  if (!_dbus_message_loader_queue_messages (loader))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  250:    _dbus_assert_not_reached ("no memory to queue messages");
call    0 never executed
        -:  251:
   154638:  252:  if (expected_validity == DBUS_VALID)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
      378:  253:    return check_have_valid_message (loader);
call    0 returned 100%
   154260:  254:  else if (expected_validity == DBUS_VALID_BUT_INCOMPLETE)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  255:    return check_incomplete_message (loader);
call    0 never executed
   154260:  256:  else if (expected_validity == DBUS_VALIDITY_UNKNOWN)
branch  0 taken 95% (fallthrough)
branch  1 taken 5%
        -:  257:    {
        -:  258:      /* here we just know we didn't segfault and that was the
        -:  259:       * only test. Also, we record that we got coverage
        -:  260:       * for the validity reason.
        -:  261:       */
   147024:  262:      if (_dbus_message_loader_get_is_corrupted (loader))
call    0 returned 100%
branch  1 taken 75% (fallthrough)
branch  2 taken 25%
   110019:  263:        record_validity_seen (loader->corruption_reason);
call    0 returned 100%
        -:  264:      
   147024:  265:      return TRUE;
        -:  266:    }
        -:  267:  else
     7236:  268:    return check_invalid_message (loader, expected_validity);
call    0 returned 100%
        -:  269:}
        -:  270:
        -:  271:/**
        -:  272: * Loads the message in the given message file.
        -:  273: *
        -:  274: * @param filename filename to load
        -:  275: * @param data string to load message into
        -:  276: * @returns #TRUE if the message was loaded
        -:  277: */
        -:  278:dbus_bool_t
        -:  279:dbus_internal_do_not_use_load_message_file (const DBusString    *filename,
        -:  280:                                            DBusString          *data)
function dbus_internal_do_not_use_load_message_file called 1 returned 100% blocks executed 64%
        1:  281:{
        -:  282:  dbus_bool_t retval;
        -:  283:  DBusError error;
        -:  284:  
        1:  285:  retval = FALSE;
        -:  286:
        1:  287:  _dbus_verbose ("Loading raw %s\n", _dbus_string_get_const_data (filename));
call    0 returned 100%
call    1 returned 100%
        1:  288:  dbus_error_init (&error);
call    0 returned 100%
        1:  289:  if (!_dbus_file_get_contents (data, filename, &error))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  290:    {
    #####:  291:      _dbus_warn ("Could not load message file %s: %s\n",
call    0 never executed
call    1 never executed
        -:  292:                  _dbus_string_get_const_data (filename),
        -:  293:                  error.message);
    #####:  294:      dbus_error_free (&error);
call    0 never executed
    #####:  295:      goto failed;
        -:  296:    }
        -:  297:
        1:  298:  retval = TRUE;
        -:  299:
        1:  300: failed:
        -:  301:
        1:  302:  return retval;
        -:  303:}
        -:  304:
        -:  305:/**
        -:  306: * Tries loading the message in the given message file
        -:  307: * and verifies that DBusMessageLoader can handle it.
        -:  308: *
        -:  309: * @param filename filename to load
        -:  310: * @param expected_validity what the message has to be like to return #TRUE
        -:  311: * @returns #TRUE if the message has the expected validity
        -:  312: */
        -:  313:dbus_bool_t
        -:  314:dbus_internal_do_not_use_try_message_file (const DBusString    *filename,
        -:  315:                                           DBusValidity         expected_validity)
function dbus_internal_do_not_use_try_message_file called 1 returned 100% blocks executed 53%
        1:  316:{
        -:  317:  DBusString data;
        -:  318:  dbus_bool_t retval;
        -:  319:
        1:  320:  retval = FALSE;
        -:  321:
        1:  322:  if (!_dbus_string_init (&data))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  323:    _dbus_assert_not_reached ("could not allocate string\n");
call    0 never executed
        -:  324:
        1:  325:  if (!dbus_internal_do_not_use_load_message_file (filename, &data))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  326:    goto failed;
        -:  327:
        1:  328:  retval = dbus_internal_do_not_use_try_message_data (&data, expected_validity);
call    0 returned 100%
        -:  329:
        1:  330: failed:
        -:  331:
        1:  332:  if (!retval)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  333:    {
    #####:  334:      if (_dbus_string_get_length (&data) > 0)
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####:  335:        _dbus_verbose_bytes_of_string (&data, 0,
call    0 never executed
call    1 never executed
        -:  336:                                       _dbus_string_get_length (&data));
        -:  337:
    #####:  338:      _dbus_warn ("Failed message loader test on %s\n",
call    0 never executed
call    1 never executed
        -:  339:                  _dbus_string_get_const_data (filename));
        -:  340:    }
        -:  341:
        1:  342:  _dbus_string_free (&data);
call    0 returned 100%
        -:  343:
        1:  344:  return retval;
        -:  345:}
        -:  346:
        -:  347:/**
        -:  348: * Tries loading the given message data.
        -:  349: *
        -:  350: *
        -:  351: * @param data the message data
        -:  352: * @param expected_validity what the message has to be like to return #TRUE
        -:  353: * @returns #TRUE if the message has the expected validity
        -:  354: */
        -:  355:dbus_bool_t
        -:  356:dbus_internal_do_not_use_try_message_data (const DBusString    *data,
        -:  357:                                           DBusValidity         expected_validity)
function dbus_internal_do_not_use_try_message_data called 51546 returned 100% blocks executed 91%
    51546:  358:{
        -:  359:  DBusMessageLoader *loader;
        -:  360:  dbus_bool_t retval;
        -:  361:  int len;
        -:  362:  int i;
        -:  363:
    51546:  364:  loader = NULL;
    51546:  365:  retval = FALSE;
        -:  366:
        -:  367:  /* Write the data one byte at a time */
        -:  368:
    51546:  369:  loader = _dbus_message_loader_new ();
call    0 returned 100%
        -:  370:
        -:  371:  /* check some trivial loader functions */
    51546:  372:  _dbus_message_loader_ref (loader);
call    0 returned 100%
    51546:  373:  _dbus_message_loader_unref (loader);
call    0 returned 100%
    51546:  374:  _dbus_message_loader_get_max_message_size (loader);
call    0 returned 100%
        -:  375:
    51546:  376:  len = _dbus_string_get_length (data);
call    0 returned 100%
  5741238:  377:  for (i = 0; i < len; i++)
branch  0 taken 99%
branch  1 taken 1% (fallthrough)
        -:  378:    {
        -:  379:      DBusString *buffer;
        -:  380:
  5689692:  381:      _dbus_message_loader_get_buffer (loader, &buffer);
call    0 returned 100%
  5689692:  382:      _dbus_string_append_byte (buffer,
call    0 returned 100%
call    1 returned 100%
        -:  383:                                _dbus_string_get_byte (data, i));
  5689692:  384:      _dbus_message_loader_return_buffer (loader, buffer, 1);
call    0 returned 100%
        -:  385:    }
        -:  386:
    51546:  387:  if (!check_loader_results (loader, expected_validity))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  388:    goto failed;
        -:  389:
    51546:  390:  _dbus_message_loader_unref (loader);
call    0 returned 100%
    51546:  391:  loader = NULL;
        -:  392:
        -:  393:  /* Write the data all at once */
        -:  394:
    51546:  395:  loader = _dbus_message_loader_new ();
call    0 returned 100%
        -:  396:
        -:  397:  {
        -:  398:    DBusString *buffer;
        -:  399:
    51546:  400:    _dbus_message_loader_get_buffer (loader, &buffer);
call    0 returned 100%
    51546:  401:    _dbus_string_copy (data, 0, buffer,
call    0 returned 100%
call    1 returned 100%
        -:  402:                       _dbus_string_get_length (buffer));
    51546:  403:    _dbus_message_loader_return_buffer (loader, buffer, 1);
call    0 returned 100%
        -:  404:  }
        -:  405:
    51546:  406:  if (!check_loader_results (loader, expected_validity))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  407:    goto failed;
        -:  408:
    51546:  409:  _dbus_message_loader_unref (loader);
call    0 returned 100%
    51546:  410:  loader = NULL;
        -:  411:
        -:  412:  /* Write the data 2 bytes at a time */
        -:  413:
    51546:  414:  loader = _dbus_message_loader_new ();
call    0 returned 100%
        -:  415:
    51546:  416:  len = _dbus_string_get_length (data);
call    0 returned 100%
  2901163:  417:  for (i = 0; i < len; i += 2)
branch  0 taken 98%
branch  1 taken 2% (fallthrough)
        -:  418:    {
        -:  419:      DBusString *buffer;
        -:  420:
  2849617:  421:      _dbus_message_loader_get_buffer (loader, &buffer);
call    0 returned 100%
  2849617:  422:      _dbus_string_append_byte (buffer,
call    0 returned 100%
call    1 returned 100%
        -:  423:                                _dbus_string_get_byte (data, i));
  2849617:  424:      if ((i+1) < len)
branch  0 taken 99% (fallthrough)
branch  1 taken 1%
  2840075:  425:        _dbus_string_append_byte (buffer,
call    0 returned 100%
call    1 returned 100%
        -:  426:                                  _dbus_string_get_byte (data, i+1));
  2849617:  427:      _dbus_message_loader_return_buffer (loader, buffer, 1);
call    0 returned 100%
        -:  428:    }
        -:  429:
    51546:  430:  if (!check_loader_results (loader, expected_validity))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  431:    goto failed;
        -:  432:
    51546:  433:  _dbus_message_loader_unref (loader);
call    0 returned 100%
    51546:  434:  loader = NULL;
        -:  435:
    51546:  436:  retval = TRUE;
        -:  437:
    51546:  438: failed:
        -:  439:
    51546:  440:  if (loader)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  441:    _dbus_message_loader_unref (loader);
call    0 never executed
        -:  442:
    51546:  443:  return retval;
        -:  444:}
        -:  445:
        -:  446:static dbus_bool_t
        -:  447:process_test_subdir (const DBusString          *test_base_dir,
        -:  448:                     const char                *subdir,
        -:  449:                     DBusValidity               expected_validity,
        -:  450:                     DBusForeachMessageFileFunc function,
        -:  451:                     void                      *user_data)
function process_test_subdir called 3 returned 100% blocks executed 73%
        3:  452:{
        -:  453:  DBusString test_directory;
        -:  454:  DBusString filename;
        -:  455:  DBusDirIter *dir;
        -:  456:  dbus_bool_t retval;
        -:  457:  DBusError error;
        -:  458:
        3:  459:  retval = FALSE;
        3:  460:  dir = NULL;
        -:  461:
        3:  462:  if (!_dbus_string_init (&test_directory))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  463:    _dbus_assert_not_reached ("didn't allocate test_directory\n");
call    0 never executed
        -:  464:
        3:  465:  _dbus_string_init_const (&filename, subdir);
call    0 returned 100%
        -:  466:
        3:  467:  if (!_dbus_string_copy (test_base_dir, 0,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  468:                          &test_directory, 0))
    #####:  469:    _dbus_assert_not_reached ("couldn't copy test_base_dir to test_directory");
call    0 never executed
        -:  470:
        3:  471:  if (!_dbus_concat_dir_and_file (&test_directory, &filename))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  472:    _dbus_assert_not_reached ("couldn't allocate full path");
call    0 never executed
        -:  473:
        3:  474:  _dbus_string_free (&filename);
call    0 returned 100%
        3:  475:  if (!_dbus_string_init (&filename))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  476:    _dbus_assert_not_reached ("didn't allocate filename string\n");
call    0 never executed
        -:  477:
        3:  478:  dbus_error_init (&error);
call    0 returned 100%
        3:  479:  dir = _dbus_directory_open (&test_directory, &error);
call    0 returned 100%
        3:  480:  if (dir == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  481:    {
    #####:  482:      _dbus_warn ("Could not open %s: %s\n",
call    0 never executed
call    1 never executed
        -:  483:                  _dbus_string_get_const_data (&test_directory),
        -:  484:                  error.message);
    #####:  485:      dbus_error_free (&error);
call    0 never executed
    #####:  486:      goto failed;
        -:  487:    }
        -:  488:
        3:  489:  printf ("Testing %s:\n", subdir);
call    0 returned 100%
        -:  490:
       36:  491: next:
       73:  492:  while (_dbus_directory_get_next_file (dir, &filename, &error))
call    0 returned 100%
branch  1 taken 92%
branch  2 taken 8% (fallthrough)
        -:  493:    {
        -:  494:      DBusString full_path;
        -:  495:
       34:  496:      if (!_dbus_string_init (&full_path))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  497:        _dbus_assert_not_reached ("couldn't init string");
call    0 never executed
        -:  498:
       34:  499:      if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  500:        _dbus_assert_not_reached ("couldn't copy dir to full_path");
call    0 never executed
        -:  501:
       34:  502:      if (!_dbus_concat_dir_and_file (&full_path, &filename))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  503:        _dbus_assert_not_reached ("couldn't concat file to dir");
call    0 never executed
        -:  504:
       34:  505:      if (_dbus_string_ends_with_c_str (&filename, ".message-raw"))
call    0 returned 100%
branch  1 taken 97% (fallthrough)
branch  2 taken 3%
        -:  506:        ;
        -:  507:      else
        -:  508:        {
       33:  509:          if (_dbus_string_ends_with_c_str (&filename, ".message"))
call    0 returned 100%
branch  1 taken 91% (fallthrough)
branch  2 taken 9%
        -:  510:            {
       30:  511:              _dbus_warn ("Could not load %s, message builder language no longer supported\n",
call    0 returned 100%
call    1 returned 100%
        -:  512:                          _dbus_string_get_const_data (&filename));
        -:  513:            }
        -:  514:          
       33:  515:          _dbus_verbose ("Skipping non-.message file %s\n",
call    0 returned 100%
call    1 returned 100%
        -:  516:                         _dbus_string_get_const_data (&filename));
       33:  517:	  _dbus_string_free (&full_path);
call    0 returned 100%
       33:  518:          goto next;
        -:  519:        }
        -:  520:
        1:  521:      printf ("    %s\n",
call    0 returned 100%
call    1 returned 100%
        -:  522:              _dbus_string_get_const_data (&filename));
        -:  523:
        1:  524:      if (! (*function) (&full_path,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  525:                         expected_validity, user_data))
        -:  526:        {
    #####:  527:          _dbus_string_free (&full_path);
call    0 never executed
    #####:  528:          goto failed;
        -:  529:        }
        -:  530:      else
        1:  531:        _dbus_string_free (&full_path);
call    0 returned 100%
        -:  532:    }
        -:  533:
        3:  534:  if (dbus_error_is_set (&error))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  535:    {
    #####:  536:      _dbus_warn ("Could not get next file in %s: %s\n",
call    0 never executed
call    1 never executed
        -:  537:                  _dbus_string_get_const_data (&test_directory),
        -:  538:                  error.message);
    #####:  539:      dbus_error_free (&error);
call    0 never executed
    #####:  540:      goto failed;
        -:  541:    }
        -:  542:
        3:  543:  retval = TRUE;
        -:  544:
        3:  545: failed:
        -:  546:
        3:  547:  if (dir)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        3:  548:    _dbus_directory_close (dir);
call    0 returned 100%
        3:  549:  _dbus_string_free (&test_directory);
call    0 returned 100%
        3:  550:  _dbus_string_free (&filename);
call    0 returned 100%
        -:  551:
        3:  552:  return retval;
        -:  553:}
        -:  554:
        -:  555:/**
        -:  556: * Runs the given function on every message file in the test suite.
        -:  557: * The function should return #FALSE on test failure or fatal error.
        -:  558: *
        -:  559: * @param test_data_dir root dir of the test suite data files (top_srcdir/test/data)
        -:  560: * @param func the function to run
        -:  561: * @param user_data data for function
        -:  562: * @returns #FALSE if there's a failure
        -:  563: */
        -:  564:dbus_bool_t
        -:  565:dbus_internal_do_not_use_foreach_message_file (const char                *test_data_dir,
        -:  566:                                               DBusForeachMessageFileFunc func,
        -:  567:                                               void                      *user_data)
function dbus_internal_do_not_use_foreach_message_file called 1 returned 100% blocks executed 81%
        1:  568:{
        -:  569:  DBusString test_directory;
        -:  570:  dbus_bool_t retval;
        -:  571:
        1:  572:  retval = FALSE;
        -:  573:
        1:  574:  _dbus_string_init_const (&test_directory, test_data_dir);
call    0 returned 100%
        -:  575:  
        1:  576:  if (!process_test_subdir (&test_directory, "valid-messages",
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  577:                            DBUS_VALID, func, user_data))
    #####:  578:    goto failed;
        -:  579:
        1:  580:  check_memleaks ();
call    0 returned 100%
        -:  581:  
        1:  582:  if (!process_test_subdir (&test_directory, "invalid-messages",
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  583:                            DBUS_INVALID_FOR_UNKNOWN_REASON, func, user_data))
    #####:  584:    goto failed;
        -:  585:
        1:  586:  check_memleaks ();
call    0 returned 100%
        -:  587:  
        1:  588:  if (!process_test_subdir (&test_directory, "incomplete-messages",
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  589:                            DBUS_VALID_BUT_INCOMPLETE, func, user_data))
    #####:  590:    goto failed;
        -:  591:
        1:  592:  check_memleaks ();
call    0 returned 100%
        -:  593:  
        1:  594:  retval = TRUE;
        -:  595:  
        1:  596: failed:
        -:  597:
        1:  598:  _dbus_string_free (&test_directory);
call    0 returned 100%
        -:  599:
        1:  600:  return retval;
        -:  601:}
        -:  602:
        -:  603:#if 0
        -:  604:#define GET_AND_CHECK(iter, typename, literal)                                  \
        -:  605:  do {                                                                          \
        -:  606:    if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename)         \
        -:  607:      _dbus_assert_not_reached ("got wrong argument type from message iter");   \
        -:  608:    dbus_message_iter_get_basic (&iter, &v_##typename);                         \
        -:  609:    if (v_##typename != literal)                                                \
        -:  610:      _dbus_assert_not_reached ("got wrong value from message iter");           \
        -:  611:  } while (0)
        -:  612:
        -:  613:#define GET_AND_CHECK_STRCMP(iter, typename, literal)                           \
        -:  614:  do {                                                                          \
        -:  615:    if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_##typename)         \
        -:  616:      _dbus_assert_not_reached ("got wrong argument type from message iter");   \
        -:  617:    dbus_message_iter_get_basic (&iter, &v_##typename);                         \
        -:  618:    if (strcmp (v_##typename, literal) != 0)                                    \
        -:  619:      _dbus_assert_not_reached ("got wrong value from message iter");           \
        -:  620:  } while (0)
        -:  621:
        -:  622:#define GET_AND_CHECK_AND_NEXT(iter, typename, literal)         \
        -:  623:  do {                                                          \
        -:  624:    GET_AND_CHECK(iter, typename, literal);                     \
        -:  625:    if (!dbus_message_iter_next (&iter))                        \
        -:  626:      _dbus_assert_not_reached ("failed to move iter to next"); \
        -:  627:  } while (0)
        -:  628:
        -:  629:#define GET_AND_CHECK_STRCMP_AND_NEXT(iter, typename, literal)  \
        -:  630:  do {                                                          \
        -:  631:    GET_AND_CHECK_STRCMP(iter, typename, literal);              \
        -:  632:    if (!dbus_message_iter_next (&iter))                        \
        -:  633:      _dbus_assert_not_reached ("failed to move iter to next"); \
        -:  634:  } while (0)
        -:  635:
        -:  636:static void
        -:  637:message_iter_test (DBusMessage *message)
        -:  638:{
        -:  639:  DBusMessageIter iter, array, array2;
        -:  640:  const char *v_STRING;
        -:  641:  double v_DOUBLE;
        -:  642:  dbus_int16_t v_INT16;
        -:  643:  dbus_uint16_t v_UINT16;
        -:  644:  dbus_int32_t v_INT32;
        -:  645:  dbus_uint32_t v_UINT32;
        -:  646:#ifdef DBUS_HAVE_INT64
        -:  647:  dbus_int64_t v_INT64;
        -:  648:  dbus_uint64_t v_UINT64;
        -:  649:#endif
        -:  650:  unsigned char v_BYTE;
        -:  651:  dbus_bool_t v_BOOLEAN;
        -:  652:
        -:  653:  const dbus_int32_t *our_int_array;
        -:  654:  int len;
        -:  655:
        -:  656:  dbus_message_iter_init (message, &iter);
        -:  657:
        -:  658:  GET_AND_CHECK_STRCMP_AND_NEXT (iter, STRING, "Test string");
        -:  659:  GET_AND_CHECK_AND_NEXT (iter, INT32, -0x12345678);
        -:  660:  GET_AND_CHECK_AND_NEXT (iter, UINT32, 0xedd1e);
        -:  661:  GET_AND_CHECK_AND_NEXT (iter, DOUBLE, 3.14159);
        -:  662:
        -:  663:  if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY)
        -:  664:    _dbus_assert_not_reached ("Argument type not an array");
        -:  665:
        -:  666:  if (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_DOUBLE)
        -:  667:    _dbus_assert_not_reached ("Array type not double");
        -:  668:
        -:  669:  dbus_message_iter_recurse (&iter, &array);
        -:  670:
        -:  671:  GET_AND_CHECK_AND_NEXT (array, DOUBLE, 1.5);
        -:  672:  GET_AND_CHECK (array, DOUBLE, 2.5);
        -:  673:
        -:  674:  if (dbus_message_iter_next (&array))
        -:  675:    _dbus_assert_not_reached ("Didn't reach end of array");
        -:  676:
        -:  677:  if (!dbus_message_iter_next (&iter))
        -:  678:    _dbus_assert_not_reached ("Reached end of arguments");
        -:  679:
        -:  680:  GET_AND_CHECK_AND_NEXT (iter, BYTE, 0xF0);
        -:  681:
        -:  682:  if (dbus_message_iter_get_arg_type (&iter) != DBUS_TYPE_ARRAY)
        -:  683:    _dbus_assert_not_reached ("no array");
        -:  684:
        -:  685:  if (dbus_message_iter_get_element_type (&iter) != DBUS_TYPE_INT32)
        -:  686:    _dbus_assert_not_reached ("Array type not int32");
        -:  687:
        -:  688:  /* Empty array */
        -:  689:  dbus_message_iter_recurse (&iter, &array);
        -:  690:
        -:  691:  if (dbus_message_iter_next (&array))
        -:  692:    _dbus_assert_not_reached ("Didn't reach end of array");
        -:  693:
        -:  694:  if (!dbus_message_iter_next (&iter))
        -:  695:    _dbus_assert_not_reached ("Reached end of arguments");
        -:  696:
        -:  697:  GET_AND_CHECK (iter, BYTE, 0xF0);
        -:  698:
        -:  699:  if (dbus_message_iter_next (&iter))
        -:  700:    _dbus_assert_not_reached ("Didn't reach end of arguments");
        -:  701:}
        -:  702:#endif
        -:  703:
        -:  704:static void
        -:  705:verify_test_message (DBusMessage *message)
function verify_test_message called 3 returned 100% blocks executed 75%
        3:  706:{
        -:  707:  DBusMessageIter iter;
        -:  708:  DBusError error;
        -:  709:  dbus_int16_t our_int16;
        -:  710:  dbus_uint16_t our_uint16;
        -:  711:  dbus_int32_t our_int;
        -:  712:  dbus_uint32_t our_uint;
        -:  713:  const char *our_str;
        -:  714:  double our_double;
        -:  715:  double v_DOUBLE;
        -:  716:  dbus_bool_t our_bool;
        -:  717:  unsigned char our_byte_1, our_byte_2;
        3:  718:  const dbus_uint32_t *our_uint32_array = (void*)0xdeadbeef;
        -:  719:  int our_uint32_array_len;
        3:  720:  dbus_int32_t *our_int32_array = (void*)0xdeadbeef;
        -:  721:  int our_int32_array_len;
        -:  722:#ifdef DBUS_HAVE_INT64
        -:  723:  dbus_int64_t our_int64;
        -:  724:  dbus_uint64_t our_uint64;
        3:  725:  dbus_int64_t *our_uint64_array = (void*)0xdeadbeef;
        -:  726:  int our_uint64_array_len;
        3:  727:  const dbus_int64_t *our_int64_array = (void*)0xdeadbeef;
        -:  728:  int our_int64_array_len;
        -:  729:#endif
        3:  730:  const double *our_double_array = (void*)0xdeadbeef;
        -:  731:  int our_double_array_len;
        3:  732:  const unsigned char *our_byte_array = (void*)0xdeadbeef;
        -:  733:  int our_byte_array_len;
        3:  734:  const dbus_bool_t *our_boolean_array = (void*)0xdeadbeef;
        -:  735:  int our_boolean_array_len;
        -:  736:  char **our_string_array;
        -:  737:  int our_string_array_len;
        -:  738:
        3:  739:  dbus_message_iter_init (message, &iter);
call    0 returned 100%
        -:  740:
        3:  741:  dbus_error_init (&error);
call    0 returned 100%
        3:  742:  if (!dbus_message_iter_get_args (&iter, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  743:                                   DBUS_TYPE_INT16, &our_int16,
        -:  744:                                   DBUS_TYPE_UINT16, &our_uint16,
        -:  745:				   DBUS_TYPE_INT32, &our_int,
        -:  746:                                   DBUS_TYPE_UINT32, &our_uint,
        -:  747:#ifdef DBUS_HAVE_INT64
        -:  748:                                   DBUS_TYPE_INT64, &our_int64,
        -:  749:                                   DBUS_TYPE_UINT64, &our_uint64,
        -:  750:#endif
        -:  751:				   DBUS_TYPE_STRING, &our_str,
        -:  752:				   DBUS_TYPE_DOUBLE, &our_double,
        -:  753:				   DBUS_TYPE_BOOLEAN, &our_bool,
        -:  754:				   DBUS_TYPE_BYTE, &our_byte_1,
        -:  755:				   DBUS_TYPE_BYTE, &our_byte_2,
        -:  756:				   DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32,
        -:  757:                                   &our_uint32_array, &our_uint32_array_len,
        -:  758:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_INT32,
        -:  759:                                   &our_int32_array, &our_int32_array_len,
        -:  760:#ifdef DBUS_HAVE_INT64
        -:  761:				   DBUS_TYPE_ARRAY, DBUS_TYPE_UINT64,
        -:  762:                                   &our_uint64_array, &our_uint64_array_len,
        -:  763:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_INT64,
        -:  764:                                   &our_int64_array, &our_int64_array_len,
        -:  765:#endif
        -:  766:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_DOUBLE,
        -:  767:                                   &our_double_array, &our_double_array_len,
        -:  768:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
        -:  769:                                   &our_byte_array, &our_byte_array_len,
        -:  770:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN,
        -:  771:                                   &our_boolean_array, &our_boolean_array_len,
        -:  772:                                   DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
        -:  773:                                   &our_string_array, &our_string_array_len,
        -:  774:				   0))
        -:  775:    {
    #####:  776:      _dbus_warn ("error: %s - %s\n", error.name,
branch  0 never executed
branch  1 never executed
call    2 never executed
        -:  777:                  (error.message != NULL) ? error.message : "no message");
    #####:  778:      _dbus_assert_not_reached ("Could not get arguments");
call    0 never executed
        -:  779:    }
        -:  780:
        3:  781:  if (our_int16 != -0x123)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  782:    _dbus_assert_not_reached ("16-bit integers differ!");
call    0 never executed
        -:  783:
        3:  784:  if (our_uint16 != 0x123)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  785:    _dbus_assert_not_reached ("16-bit uints differ!");
call    0 never executed
        -:  786:  
        3:  787:  if (our_int != -0x12345678)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  788:    _dbus_assert_not_reached ("integers differ!");
call    0 never executed
        -:  789:
        3:  790:  if (our_uint != 0x12300042)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  791:    _dbus_assert_not_reached ("uints differ!");
call    0 never executed
        -:  792:
        -:  793:#ifdef DBUS_HAVE_INT64
        3:  794:  if (our_int64 != DBUS_INT64_CONSTANT (-0x123456789abcd))
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  795:    _dbus_assert_not_reached ("64-bit integers differ!");
call    0 never executed
        3:  796:  if (our_uint64 != DBUS_UINT64_CONSTANT (0x123456789abcd))
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  797:    _dbus_assert_not_reached ("64-bit unsigned integers differ!");
call    0 never executed
        -:  798:#endif
        -:  799:
        3:  800:  v_DOUBLE = 3.14159;
        3:  801:  if (! _DBUS_DOUBLES_BITWISE_EQUAL (our_double, v_DOUBLE))
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 100% (fallthrough)
branch  9 taken 0%
branch 10 taken 100% (fallthrough)
branch 11 taken 0%
branch 12 taken 100% (fallthrough)
branch 13 taken 0%
branch 14 taken 0% (fallthrough)
branch 15 taken 100%
    #####:  802:    _dbus_assert_not_reached ("doubles differ!");
call    0 never executed
        -:  803:
        3:  804:  if (strcmp (our_str, "Test string") != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  805:    _dbus_assert_not_reached ("strings differ!");
call    0 never executed
        -:  806:
        3:  807:  if (!our_bool)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  808:    _dbus_assert_not_reached ("booleans differ");
call    0 never executed
        -:  809:
        3:  810:  if (our_byte_1 != 42)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  811:    _dbus_assert_not_reached ("bytes differ!");
call    0 never executed
        -:  812:
        3:  813:  if (our_byte_2 != 24)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  814:    _dbus_assert_not_reached ("bytes differ!");
call    0 never executed
        -:  815:
        3:  816:  if (our_uint32_array_len != 4 ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
        -:  817:      our_uint32_array[0] != 0x12345678 ||
        -:  818:      our_uint32_array[1] != 0x23456781 ||
        -:  819:      our_uint32_array[2] != 0x34567812 ||
        -:  820:      our_uint32_array[3] != 0x45678123)
    #####:  821:    _dbus_assert_not_reached ("uint array differs");
call    0 never executed
        -:  822:
        3:  823:  if (our_int32_array_len != 4 ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
        -:  824:      our_int32_array[0] != 0x12345678 ||
        -:  825:      our_int32_array[1] != -0x23456781 ||
        -:  826:      our_int32_array[2] != 0x34567812 ||
        -:  827:      our_int32_array[3] != -0x45678123)
    #####:  828:    _dbus_assert_not_reached ("int array differs");
call    0 never executed
        -:  829:
        -:  830:#ifdef DBUS_HAVE_INT64
        3:  831:  if (our_uint64_array_len != 4 ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
        -:  832:      our_uint64_array[0] != 0x12345678 ||
        -:  833:      our_uint64_array[1] != 0x23456781 ||
        -:  834:      our_uint64_array[2] != 0x34567812 ||
        -:  835:      our_uint64_array[3] != 0x45678123)
    #####:  836:    _dbus_assert_not_reached ("uint64 array differs");
call    0 never executed
        -:  837:
        3:  838:  if (our_int64_array_len != 4 ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
        -:  839:      our_int64_array[0] != 0x12345678 ||
        -:  840:      our_int64_array[1] != -0x23456781 ||
        -:  841:      our_int64_array[2] != 0x34567812 ||
        -:  842:      our_int64_array[3] != -0x45678123)
    #####:  843:    _dbus_assert_not_reached ("int64 array differs");
call    0 never executed
        -:  844:#endif /* DBUS_HAVE_INT64 */
        -:  845:
        3:  846:  if (our_double_array_len != 3)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  847:    _dbus_assert_not_reached ("double array had wrong length");
call    0 never executed
        -:  848:
        -:  849:  /* On all IEEE machines (i.e. everything sane) exact equality
        -:  850:   * should be preserved over the wire
        -:  851:   */
        3:  852:  v_DOUBLE = 0.1234;
        3:  853:  if (! _DBUS_DOUBLES_BITWISE_EQUAL (our_double_array[0], v_DOUBLE))
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 100% (fallthrough)
branch  9 taken 0%
branch 10 taken 100% (fallthrough)
branch 11 taken 0%
branch 12 taken 100% (fallthrough)
branch 13 taken 0%
branch 14 taken 0% (fallthrough)
branch 15 taken 100%
    #####:  854:    _dbus_assert_not_reached ("double array had wrong values");
call    0 never executed
        3:  855:  v_DOUBLE = 9876.54321;
        3:  856:  if (! _DBUS_DOUBLES_BITWISE_EQUAL (our_double_array[1], v_DOUBLE))
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 100% (fallthrough)
branch  9 taken 0%
branch 10 taken 100% (fallthrough)
branch 11 taken 0%
branch 12 taken 100% (fallthrough)
branch 13 taken 0%
branch 14 taken 0% (fallthrough)
branch 15 taken 100%
    #####:  857:    _dbus_assert_not_reached ("double array had wrong values");
call    0 never executed
        3:  858:  v_DOUBLE = -300.0;
        3:  859:  if (! _DBUS_DOUBLES_BITWISE_EQUAL (our_double_array[2], v_DOUBLE))
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 100% (fallthrough)
branch  9 taken 0%
branch 10 taken 100% (fallthrough)
branch 11 taken 0%
branch 12 taken 100% (fallthrough)
branch 13 taken 0%
branch 14 taken 0% (fallthrough)
branch 15 taken 100%
    #####:  860:    _dbus_assert_not_reached ("double array had wrong values");
call    0 never executed
        -:  861:
        3:  862:  if (our_byte_array_len != 4)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  863:    _dbus_assert_not_reached ("byte array had wrong length");
call    0 never executed
        -:  864:
        3:  865:  if (our_byte_array[0] != 'a' ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 0% (fallthrough)
branch  7 taken 100%
        -:  866:      our_byte_array[1] != 'b' ||
        -:  867:      our_byte_array[2] != 'c' ||
        -:  868:      our_byte_array[3] != 234)
    #####:  869:    _dbus_assert_not_reached ("byte array had wrong values");
call    0 never executed
        -:  870:
        3:  871:  if (our_boolean_array_len != 5)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  872:    _dbus_assert_not_reached ("bool array had wrong length");
call    0 never executed
        -:  873:
        3:  874:  if (our_boolean_array[0] != TRUE ||
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
branch  8 taken 0% (fallthrough)
branch  9 taken 100%
        -:  875:      our_boolean_array[1] != FALSE ||
        -:  876:      our_boolean_array[2] != TRUE ||
        -:  877:      our_boolean_array[3] != TRUE ||
        -:  878:      our_boolean_array[4] != FALSE)
    #####:  879:    _dbus_assert_not_reached ("bool array had wrong values");
call    0 never executed
        -:  880:
        3:  881:  if (our_string_array_len != 4)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  882:    _dbus_assert_not_reached ("string array was wrong length");
call    0 never executed
        -:  883:
        3:  884:  if (strcmp (our_string_array[0], "Foo") != 0 ||
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
call    3 returned 100%
branch  4 taken 100% (fallthrough)
branch  5 taken 0%
branch  6 taken 100% (fallthrough)
branch  7 taken 0%
call    8 returned 100%
branch  9 taken 0% (fallthrough)
branch 10 taken 100%
        -:  885:      strcmp (our_string_array[1], "bar") != 0 ||
        -:  886:      strcmp (our_string_array[2], "") != 0 ||
        -:  887:      strcmp (our_string_array[3], "woo woo woo woo") != 0)
    #####:  888:    _dbus_assert_not_reached ("string array had wrong values");
call    0 never executed
        -:  889:
        3:  890:  dbus_free_string_array (our_string_array);
call    0 returned 100%
        -:  891:  
        3:  892:  if (dbus_message_iter_next (&iter))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  893:    _dbus_assert_not_reached ("Didn't reach end of arguments");
call    0 never executed
        3:  894:}
        -:  895:
        -:  896:/**
        -:  897: * @ingroup DBusMessageInternals
        -:  898: * Unit test for DBusMessage.
        -:  899: *
        -:  900: * @returns #TRUE on success.
        -:  901: */
        -:  902:dbus_bool_t
        -:  903:_dbus_message_test (const char *test_data_dir)
function _dbus_message_test called 1 returned 100% blocks executed 91%
        1:  904:{
        -:  905:  DBusMessage *message;
        -:  906:  DBusMessageLoader *loader;
        -:  907:  int i;
        -:  908:  const char *data;
        -:  909:  DBusMessage *copy;
        -:  910:  const char *name1;
        -:  911:  const char *name2;
        -:  912:  const dbus_uint32_t our_uint32_array[] =
        -:  913:    { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
        -:  914:  const dbus_int32_t our_int32_array[] =
        -:  915:    { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
        1:  916:  const dbus_uint32_t *v_ARRAY_UINT32 = our_uint32_array;
        1:  917:  const dbus_int32_t *v_ARRAY_INT32 = our_int32_array;
        -:  918:#ifdef DBUS_HAVE_INT64
        -:  919:  const dbus_uint64_t our_uint64_array[] =
        -:  920:    { 0x12345678, 0x23456781, 0x34567812, 0x45678123 };
        -:  921:  const dbus_int64_t our_int64_array[] =
        -:  922:    { 0x12345678, -0x23456781, 0x34567812, -0x45678123 };
        1:  923:  const dbus_uint64_t *v_ARRAY_UINT64 = our_uint64_array;
        1:  924:  const dbus_int64_t *v_ARRAY_INT64 = our_int64_array;
        -:  925:#endif
        1:  926:  const char *our_string_array[] = { "Foo", "bar", "", "woo woo woo woo" };
        1:  927:  const char **v_ARRAY_STRING = our_string_array;
        -:  928:  const double our_double_array[] = { 0.1234, 9876.54321, -300.0 };
        1:  929:  const double *v_ARRAY_DOUBLE = our_double_array;
        -:  930:  const unsigned char our_byte_array[] = { 'a', 'b', 'c', 234 };
        1:  931:  const unsigned char *v_ARRAY_BYTE = our_byte_array;
        -:  932:  const dbus_bool_t our_boolean_array[] = { TRUE, FALSE, TRUE, TRUE, FALSE };
        1:  933:  const dbus_bool_t *v_ARRAY_BOOLEAN = our_boolean_array;
        -:  934:  char sig[64];
        -:  935:  const char *s;
        -:  936:  const char *v_STRING;
        -:  937:  double v_DOUBLE;
        -:  938:  dbus_int16_t v_INT16;
        -:  939:  dbus_uint16_t v_UINT16;
        -:  940:  dbus_int32_t v_INT32;
        -:  941:  dbus_uint32_t v_UINT32;
        -:  942:#ifdef DBUS_HAVE_INT64
        -:  943:  dbus_int64_t v_INT64;
        -:  944:  dbus_uint64_t v_UINT64;
        -:  945:#endif
        -:  946:  unsigned char v_BYTE;
        -:  947:  unsigned char v2_BYTE;
        -:  948:  dbus_bool_t v_BOOLEAN;
        -:  949:
        1:  950:  message = dbus_message_new_method_call ("org.freedesktop.DBus.TestService",
call    0 returned 100%
        -:  951:                                          "/org/freedesktop/TestPath",
        -:  952:                                          "Foo.TestInterface",
        -:  953:                                          "TestMethod");
        1:  954:  _dbus_assert (dbus_message_has_destination (message, "org.freedesktop.DBus.TestService"));
call    0 returned 100%
call    1 returned 100%
        1:  955:  _dbus_assert (dbus_message_is_method_call (message, "Foo.TestInterface",
call    0 returned 100%
call    1 returned 100%
        -:  956:                                             "TestMethod"));
        1:  957:  _dbus_assert (strcmp (dbus_message_get_path (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  958:                        "/org/freedesktop/TestPath") == 0);
        1:  959:  _dbus_message_set_serial (message, 1234);
call    0 returned 100%
        -:  960:
        -:  961:  /* string length including nul byte not a multiple of 4 */
        1:  962:  if (!dbus_message_set_sender (message, "org.foo.bar1"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  963:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        -:  964:
        1:  965:  _dbus_assert (dbus_message_has_sender (message, "org.foo.bar1"));
call    0 returned 100%
call    1 returned 100%
        1:  966:  dbus_message_set_reply_serial (message, 5678);
call    0 returned 100%
        -:  967:
        1:  968:  _dbus_verbose_bytes_of_string (&message->header.data, 0,
call    0 returned 100%
call    1 returned 100%
        -:  969:                                 _dbus_string_get_length (&message->header.data));
        1:  970:  _dbus_verbose_bytes_of_string (&message->body, 0,
call    0 returned 100%
call    1 returned 100%
        -:  971:                                 _dbus_string_get_length (&message->body));
        -:  972:
        1:  973:  if (!dbus_message_set_sender (message, NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  974:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        -:  975:
        -:  976:
        1:  977:  _dbus_verbose_bytes_of_string (&message->header.data, 0,
call    0 returned 100%
call    1 returned 100%
        -:  978:                                 _dbus_string_get_length (&message->header.data));
        1:  979:  _dbus_verbose_bytes_of_string (&message->body, 0,
call    0 returned 100%
call    1 returned 100%
        -:  980:                                 _dbus_string_get_length (&message->body));
        -:  981:
        -:  982:
        1:  983:  _dbus_assert (!dbus_message_has_sender (message, "org.foo.bar1"));
call    0 returned 100%
call    1 returned 100%
        1:  984:  _dbus_assert (dbus_message_get_serial (message) == 1234);
call    0 returned 100%
call    1 returned 100%
        1:  985:  _dbus_assert (dbus_message_get_reply_serial (message) == 5678);
call    0 returned 100%
call    1 returned 100%
        1:  986:  _dbus_assert (dbus_message_has_destination (message, "org.freedesktop.DBus.TestService"));
call    0 returned 100%
call    1 returned 100%
        -:  987:
        1:  988:  _dbus_assert (dbus_message_get_no_reply (message) == FALSE);
call    0 returned 100%
call    1 returned 100%
        1:  989:  dbus_message_set_no_reply (message, TRUE);
call    0 returned 100%
        1:  990:  _dbus_assert (dbus_message_get_no_reply (message) == TRUE);
call    0 returned 100%
call    1 returned 100%
        1:  991:  dbus_message_set_no_reply (message, FALSE);
call    0 returned 100%
        1:  992:  _dbus_assert (dbus_message_get_no_reply (message) == FALSE);
call    0 returned 100%
call    1 returned 100%
        -:  993:
        -:  994:  /* Set/get some header fields */
        -:  995:
        1:  996:  if (!dbus_message_set_path (message, "/foo"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  997:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1:  998:  _dbus_assert (strcmp (dbus_message_get_path (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -:  999:                        "/foo") == 0);
        -: 1000:
        1: 1001:  if (!dbus_message_set_interface (message, "org.Foo"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1002:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1003:  _dbus_assert (strcmp (dbus_message_get_interface (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1004:                        "org.Foo") == 0);
        -: 1005:
        1: 1006:  if (!dbus_message_set_member (message, "Bar"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1007:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1008:  _dbus_assert (strcmp (dbus_message_get_member (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1009:                        "Bar") == 0);
        -: 1010:
        -: 1011:  /* Set/get them with longer values */
        1: 1012:  if (!dbus_message_set_path (message, "/foo/bar"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1013:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1014:  _dbus_assert (strcmp (dbus_message_get_path (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1015:                        "/foo/bar") == 0);
        -: 1016:
        1: 1017:  if (!dbus_message_set_interface (message, "org.Foo.Bar"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1018:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1019:  _dbus_assert (strcmp (dbus_message_get_interface (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1020:                        "org.Foo.Bar") == 0);
        -: 1021:
        1: 1022:  if (!dbus_message_set_member (message, "BarFoo"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1023:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1024:  _dbus_assert (strcmp (dbus_message_get_member (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1025:                        "BarFoo") == 0);
        -: 1026:
        -: 1027:  /* Realloc shorter again */
        -: 1028:
        1: 1029:  if (!dbus_message_set_path (message, "/foo"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1030:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1031:  _dbus_assert (strcmp (dbus_message_get_path (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1032:                        "/foo") == 0);
        -: 1033:
        1: 1034:  if (!dbus_message_set_interface (message, "org.Foo"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1035:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1036:  _dbus_assert (strcmp (dbus_message_get_interface (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1037:                        "org.Foo") == 0);
        -: 1038:
        1: 1039:  if (!dbus_message_set_member (message, "Bar"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1040:    _dbus_assert_not_reached ("out of memory");
call    0 never executed
        1: 1041:  _dbus_assert (strcmp (dbus_message_get_member (message),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1042:                        "Bar") == 0);
        -: 1043:
        1: 1044:  dbus_message_unref (message);
call    0 returned 100%
        -: 1045:
        -: 1046:  /* Test the vararg functions */
        1: 1047:  message = dbus_message_new_method_call ("org.freedesktop.DBus.TestService",
call    0 returned 100%
        -: 1048:                                          "/org/freedesktop/TestPath",
        -: 1049:                                          "Foo.TestInterface",
        -: 1050:                                          "TestMethod");
        1: 1051:  _dbus_message_set_serial (message, 1);
call    0 returned 100%
        1: 1052:  dbus_message_set_reply_serial (message, 5678);
call    0 returned 100%
        -: 1053:
        1: 1054:  v_INT16 = -0x123;
        1: 1055:  v_UINT16 = 0x123;
        1: 1056:  v_INT32 = -0x12345678;
        1: 1057:  v_UINT32 = 0x12300042;
        -: 1058:#ifdef DBUS_HAVE_INT64
        1: 1059:  v_INT64 = DBUS_INT64_CONSTANT (-0x123456789abcd);
        1: 1060:  v_UINT64 = DBUS_UINT64_CONSTANT (0x123456789abcd);
        -: 1061:#endif
        1: 1062:  v_STRING = "Test string";
        1: 1063:  v_DOUBLE = 3.14159;
        1: 1064:  v_BOOLEAN = TRUE;
        1: 1065:  v_BYTE = 42;
        1: 1066:  v2_BYTE = 24;
        -: 1067:
        1: 1068:  dbus_message_append_args (message,
call    0 returned 100%
        -: 1069:                            DBUS_TYPE_INT16, &v_INT16,
        -: 1070:                            DBUS_TYPE_UINT16, &v_UINT16,
        -: 1071:			    DBUS_TYPE_INT32, &v_INT32,
        -: 1072:                            DBUS_TYPE_UINT32, &v_UINT32,
        -: 1073:#ifdef DBUS_HAVE_INT64
        -: 1074:                            DBUS_TYPE_INT64, &v_INT64,
        -: 1075:                            DBUS_TYPE_UINT64, &v_UINT64,
        -: 1076:#endif
        -: 1077:			    DBUS_TYPE_STRING, &v_STRING,
        -: 1078:			    DBUS_TYPE_DOUBLE, &v_DOUBLE,
        -: 1079:			    DBUS_TYPE_BOOLEAN, &v_BOOLEAN,
        -: 1080:			    DBUS_TYPE_BYTE, &v_BYTE,
        -: 1081:			    DBUS_TYPE_BYTE, &v2_BYTE,
        -: 1082:			    DBUS_TYPE_ARRAY, DBUS_TYPE_UINT32, &v_ARRAY_UINT32,
        -: 1083:                            _DBUS_N_ELEMENTS (our_uint32_array),
        -: 1084:                            DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &v_ARRAY_INT32,
        -: 1085:                            _DBUS_N_ELEMENTS (our_int32_array),
        -: 1086:#ifdef DBUS_HAVE_INT64
        -: 1087:                            DBUS_TYPE_ARRAY, DBUS_TYPE_UINT64, &v_ARRAY_UINT64,
        -: 1088:                            _DBUS_N_ELEMENTS (our_uint64_array),
        -: 1089:                            DBUS_TYPE_ARRAY, DBUS_TYPE_INT64, &v_ARRAY_INT64,
        -: 1090:                            _DBUS_N_ELEMENTS (our_int64_array),
        -: 1091:#endif
        -: 1092:                            DBUS_TYPE_ARRAY, DBUS_TYPE_DOUBLE, &v_ARRAY_DOUBLE,
        -: 1093:                            _DBUS_N_ELEMENTS (our_double_array),
        -: 1094:                            DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &v_ARRAY_BYTE,
        -: 1095:                            _DBUS_N_ELEMENTS (our_byte_array),
        -: 1096:                            DBUS_TYPE_ARRAY, DBUS_TYPE_BOOLEAN, &v_ARRAY_BOOLEAN,
        -: 1097:                            _DBUS_N_ELEMENTS (our_boolean_array),
        -: 1098:                            DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &v_ARRAY_STRING,
        -: 1099:                            _DBUS_N_ELEMENTS (our_string_array),
        -: 1100:			    DBUS_TYPE_INVALID);
        -: 1101:
        1: 1102:  i = 0;
        1: 1103:  sig[i++] = DBUS_TYPE_INT16;
        1: 1104:  sig[i++] = DBUS_TYPE_UINT16;
        1: 1105:  sig[i++] = DBUS_TYPE_INT32;
        1: 1106:  sig[i++] = DBUS_TYPE_UINT32;
        -: 1107:#ifdef DBUS_HAVE_INT64
        1: 1108:  sig[i++] = DBUS_TYPE_INT64;
        1: 1109:  sig[i++] = DBUS_TYPE_UINT64;
        -: 1110:#endif
        1: 1111:  sig[i++] = DBUS_TYPE_STRING;
        1: 1112:  sig[i++] = DBUS_TYPE_DOUBLE;
        1: 1113:  sig[i++] = DBUS_TYPE_BOOLEAN;
        1: 1114:  sig[i++] = DBUS_TYPE_BYTE;
        1: 1115:  sig[i++] = DBUS_TYPE_BYTE;
        1: 1116:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1117:  sig[i++] = DBUS_TYPE_UINT32;
        1: 1118:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1119:  sig[i++] = DBUS_TYPE_INT32;
        -: 1120:#ifdef DBUS_HAVE_INT64
        1: 1121:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1122:  sig[i++] = DBUS_TYPE_UINT64;
        1: 1123:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1124:  sig[i++] = DBUS_TYPE_INT64;
        -: 1125:#endif
        1: 1126:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1127:  sig[i++] = DBUS_TYPE_DOUBLE;
        1: 1128:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1129:  sig[i++] = DBUS_TYPE_BYTE;
        1: 1130:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1131:  sig[i++] = DBUS_TYPE_BOOLEAN;
        1: 1132:  sig[i++] = DBUS_TYPE_ARRAY;
        1: 1133:  sig[i++] = DBUS_TYPE_STRING;
        1: 1134:  sig[i++] = DBUS_TYPE_INVALID;  
        -: 1135:
        1: 1136:  _dbus_assert (i < (int) _DBUS_N_ELEMENTS (sig));
call    0 returned 100%
        -: 1137:
        1: 1138:  _dbus_verbose ("HEADER\n");
call    0 returned 100%
        1: 1139:  _dbus_verbose_bytes_of_string (&message->header.data, 0,
call    0 returned 100%
call    1 returned 100%
        -: 1140:                                 _dbus_string_get_length (&message->header.data));
        1: 1141:  _dbus_verbose ("BODY\n");
call    0 returned 100%
        1: 1142:  _dbus_verbose_bytes_of_string (&message->body, 0,
call    0 returned 100%
call    1 returned 100%
        -: 1143:                                 _dbus_string_get_length (&message->body));
        -: 1144:
        1: 1145:  _dbus_verbose ("Signature expected \"%s\" actual \"%s\"\n",
call    0 returned 100%
call    1 returned 100%
        -: 1146:                 sig, dbus_message_get_signature (message));
        -: 1147:
        1: 1148:  s = dbus_message_get_signature (message);
call    0 returned 100%
        -: 1149:
        1: 1150:  _dbus_assert (dbus_message_has_signature (message, sig));
call    0 returned 100%
call    1 returned 100%
        1: 1151:  _dbus_assert (strcmp (s, sig) == 0);
call    0 returned 100%
call    1 returned 100%
        -: 1152:
        1: 1153:  verify_test_message (message);
call    0 returned 100%
        -: 1154:
        1: 1155:  copy = dbus_message_copy (message);
call    0 returned 100%
        -: 1156:
        1: 1157:  _dbus_assert (dbus_message_get_reply_serial (message) ==
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1158:                dbus_message_get_reply_serial (copy));
        1: 1159:  _dbus_assert (message->header.padding == copy->header.padding);
call    0 returned 100%
        -: 1160:
        1: 1161:  _dbus_assert (_dbus_string_get_length (&message->header.data) ==
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1162:                _dbus_string_get_length (&copy->header.data));
        -: 1163:
        1: 1164:  _dbus_assert (_dbus_string_get_length (&message->body) ==
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
        -: 1165:                _dbus_string_get_length (&copy->body));
        -: 1166:
        1: 1167:  verify_test_message (copy);
call    0 returned 100%
        -: 1168:
        1: 1169:  name1 = dbus_message_get_interface (message);
call    0 returned 100%
        1: 1170:  name2 = dbus_message_get_interface (copy);
call    0 returned 100%
        -: 1171:
        1: 1172:  _dbus_assert (strcmp (name1, name2) == 0);
call    0 returned 100%
call    1 returned 100%
        -: 1173:
        1: 1174:  name1 = dbus_message_get_member (message);
call    0 returned 100%
        1: 1175:  name2 = dbus_message_get_member (copy);
call    0 returned 100%
        -: 1176:
        1: 1177:  _dbus_assert (strcmp (name1, name2) == 0);
call    0 returned 100%
call    1 returned 100%
        -: 1178:
        1: 1179:  dbus_message_unref (copy);
call    0 returned 100%
        -: 1180:
        -: 1181:  /* Message loader test */
        1: 1182:  _dbus_message_lock (message);
call    0 returned 100%
        1: 1183:  loader = _dbus_message_loader_new ();
call    0 returned 100%
        -: 1184:  
        -: 1185:  /* check ref/unref */
        1: 1186:  _dbus_message_loader_ref (loader);
call    0 returned 100%
        1: 1187:  _dbus_message_loader_unref (loader);
call    0 returned 100%
        -: 1188:
        -: 1189:  /* Write the header data one byte at a time */
        1: 1190:  data = _dbus_string_get_const_data (&message->header.data);
call    0 returned 100%
      209: 1191:  for (i = 0; i < _dbus_string_get_length (&message->header.data); i++)
call    0 returned 100%
branch  1 taken 99%
branch  2 taken 1% (fallthrough)
        -: 1192:    {
        -: 1193:      DBusString *buffer;
        -: 1194:
      208: 1195:      _dbus_message_loader_get_buffer (loader, &buffer);
call    0 returned 100%
      208: 1196:      _dbus_string_append_byte (buffer, data[i]);
call    0 returned 100%
      208: 1197:      _dbus_message_loader_return_buffer (loader, buffer, 1);
call    0 returned 100%
        -: 1198:    }
        -: 1199:
        -: 1200:  /* Write the body data one byte at a time */
        1: 1201:  data = _dbus_string_get_const_data (&message->body);
call    0 returned 100%
      297: 1202:  for (i = 0; i < _dbus_string_get_length (&message->body); i++)
call    0 returned 100%
branch  1 taken 99%
branch  2 taken 1% (fallthrough)
        -: 1203:    {
        -: 1204:      DBusString *buffer;
        -: 1205:
      296: 1206:      _dbus_message_loader_get_buffer (loader, &buffer);
call    0 returned 100%
      296: 1207:      _dbus_string_append_byte (buffer, data[i]);
call    0 returned 100%
      296: 1208:      _dbus_message_loader_return_buffer (loader, buffer, 1);
call    0 returned 100%
        -: 1209:    }
        -: 1210:
        1: 1211:  dbus_message_unref (message);
call    0 returned 100%
        -: 1212:
        -: 1213:  /* Now pop back the message */
        1: 1214:  if (!_dbus_message_loader_queue_messages (loader))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1215:    _dbus_assert_not_reached ("no memory to queue messages");
call    0 never executed
        -: 1216:
        1: 1217:  if (_dbus_message_loader_get_is_corrupted (loader))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1218:    _dbus_assert_not_reached ("message loader corrupted");
call    0 never executed
        -: 1219:
        1: 1220:  message = _dbus_message_loader_pop_message (loader);
call    0 returned 100%
        1: 1221:  if (!message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1222:    _dbus_assert_not_reached ("received a NULL message");
call    0 never executed
        -: 1223:
        1: 1224:  if (dbus_message_get_reply_serial (message) != 5678)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1225:    _dbus_assert_not_reached ("reply serial fields differ");
call    0 never executed
        -: 1226:
        1: 1227:  verify_test_message (message);
call    0 returned 100%
        -: 1228:
        1: 1229:  dbus_message_unref (message);
call    0 returned 100%
        1: 1230:  _dbus_message_loader_unref (loader);
call    0 returned 100%
        -: 1231:
        1: 1232:  check_memleaks ();
call    0 returned 100%
        -: 1233:
        -: 1234:  /* Load all the sample messages from the message factory */
        -: 1235:  {
        -: 1236:    DBusMessageDataIter diter;
        -: 1237:    DBusMessageData mdata;
        -: 1238:    int count;
        -: 1239:
        1: 1240:    reset_validities_seen ();
call    0 returned 100%
        -: 1241:    
        1: 1242:    count = 0;
        1: 1243:    _dbus_message_data_iter_init (&diter);
call    0 returned 100%
        -: 1244:    
    51547: 1245:    while (_dbus_message_data_iter_get_and_next (&diter,
call    0 returned 100%
branch  1 taken 99%
branch  2 taken 1% (fallthrough)
        -: 1246:                                                 &mdata))
        -: 1247:      {
    51545: 1248:        if (!dbus_internal_do_not_use_try_message_data (&mdata.data,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1249:                                                        mdata.expected_validity))
        -: 1250:          {
    #####: 1251:            _dbus_warn ("expected validity %d and did not get it\n",
call    0 never executed
        -: 1252:                        mdata.expected_validity);
    #####: 1253:            _dbus_assert_not_reached ("message data failed");
call    0 never executed
        -: 1254:          }
        -: 1255:
    51545: 1256:        _dbus_message_data_free (&mdata);
call    0 returned 100%
        -: 1257:
    51545: 1258:        count += 1;
        -: 1259:      }
        -: 1260:
        1: 1261:    printf ("%d sample messages tested\n", count);
call    0 returned 100%
        -: 1262:
        1: 1263:    print_validities_seen (FALSE);
call    0 returned 100%
        1: 1264:    print_validities_seen (TRUE);
call    0 returned 100%
        -: 1265:  }
        -: 1266:  
        1: 1267:  check_memleaks ();
call    0 returned 100%
        -: 1268:  
        -: 1269:  /* Now load every message in test_data_dir if we have one */
        1: 1270:  if (test_data_dir == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1271:    return TRUE;
        -: 1272:
        1: 1273:  return dbus_internal_do_not_use_foreach_message_file (test_data_dir,
call    0 returned 100%
        -: 1274:                                                        (DBusForeachMessageFileFunc)
        -: 1275:                                                        dbus_internal_do_not_use_try_message_file,
        -: 1276:                                                        NULL);  
        -: 1277:}
        -: 1278:
        -: 1279:#endif /* DBUS_BUILD_TESTS */