Coverage report for bus/dispatch.c.gcov

        -:    0:Source:dispatch.c
        -:    0:Graph:dispatch.gcno
        -:    0:Data:dispatch.gcda
        -:    0:Runs:10118
        -:    0:Programs:2
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* dispatch.c  Message dispatcher
        -:    3: *
        -:    4: * Copyright (C) 2003  CodeFactory AB
        -:    5: * Copyright (C) 2003, 2004, 2005  Red Hat, Inc.
        -:    6: * Copyright (C) 2004  Imendio HB
        -:    7: *
        -:    8: * Licensed under the Academic Free License version 2.1
        -:    9: * 
        -:   10: * This program is free software; you can redistribute it and/or modify
        -:   11: * it under the terms of the GNU General Public License as published by
        -:   12: * the Free Software Foundation; either version 2 of the License, or
        -:   13: * (at your option) any later version.
        -:   14: *
        -:   15: * This program is distributed in the hope that it will be useful,
        -:   16: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   17: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   18: * GNU General Public License for more details.
        -:   19: * 
        -:   20: * You should have received a copy of the GNU General Public License
        -:   21: * along with this program; if not, write to the Free Software
        -:   22: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   23: *
        -:   24: */
        -:   25:
        -:   26:#include "dispatch.h"
        -:   27:#include "connection.h"
        -:   28:#include "driver.h"
        -:   29:#include "services.h"
        -:   30:#include "activation.h"
        -:   31:#include "utils.h"
        -:   32:#include "bus.h"
        -:   33:#include "signals.h"
        -:   34:#include "test.h"
        -:   35:#include <dbus/dbus-internals.h>
        -:   36:#include <string.h>
        -:   37:
        -:   38:static dbus_bool_t
        -:   39:send_one_message (DBusConnection *connection,
        -:   40:                  BusContext     *context,
        -:   41:                  DBusConnection *sender,
        -:   42:                  DBusConnection *addressed_recipient,
        -:   43:                  DBusMessage    *message,
        -:   44:                  BusTransaction *transaction,
        -:   45:                  DBusError      *error)
function send_one_message called 71590 returned 100% blocks executed 100%
    71590:   46:{
    71590:   47:  if (!bus_context_check_security_policy (context, transaction,
call    0 returned 100%
branch  1 taken 52% (fallthrough)
branch  2 taken 48%
        -:   48:                                          sender,
        -:   49:                                          addressed_recipient,
        -:   50:                                          connection,
        -:   51:                                          message,
        -:   52:                                          NULL))
    37180:   53:    return TRUE; /* silently don't send it */
        -:   54:  
    34410:   55:  if (!bus_transaction_send (transaction,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:   56:                             connection,
        -:   57:                             message))
        -:   58:    {
      264:   59:      BUS_SET_OOM (error);
call    0 returned 100%
      264:   60:      return FALSE;
        -:   61:    }
        -:   62:
    34146:   63:  return TRUE;
        -:   64:}
        -:   65:
        -:   66:dbus_bool_t
        -:   67:bus_dispatch_matches (BusTransaction *transaction,
        -:   68:                      DBusConnection *sender,
        -:   69:                      DBusConnection *addressed_recipient,
        -:   70:                      DBusMessage    *message,
        -:   71:                      DBusError      *error)
function bus_dispatch_matches called 29069 returned 100% blocks executed 95%
    29069:   72:{
        -:   73:  DBusError tmp_error;
        -:   74:  BusConnections *connections;
        -:   75:  DBusList *recipients;
        -:   76:  BusMatchmaker *matchmaker;
        -:   77:  DBusList *link;
        -:   78:  BusContext *context;
        -:   79:
    29069:   80:  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
        -:   81:
        -:   82:  /* sender and recipient can both be NULL for the bus driver,
        -:   83:   * or for signals with no particular recipient
        -:   84:   */
        -:   85:
    29069:   86:  _dbus_assert (sender == NULL || bus_connection_is_active (sender));
branch  0 taken 50% (fallthrough)
branch  1 taken 50%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
call    5 returned 100%
    29069:   87:  _dbus_assert (dbus_message_get_sender (message) != NULL);
call    0 returned 100%
call    1 returned 100%
        -:   88:
    29069:   89:  connections = bus_transaction_get_connections (transaction);
call    0 returned 100%
        -:   90:  
    29069:   91:  dbus_error_init (&tmp_error);
call    0 returned 100%
    29069:   92:  context = bus_transaction_get_context (transaction);
call    0 returned 100%
    29069:   93:  matchmaker = bus_context_get_matchmaker (context);
call    0 returned 100%
        -:   94:
    29069:   95:  recipients = NULL;
    29069:   96:  if (!bus_matchmaker_get_recipients (matchmaker, connections,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:   97:                                      sender, addressed_recipient, message,
        -:   98:                                      &recipients))
        -:   99:    {
      140:  100:      BUS_SET_OOM (error);
call    0 returned 100%
      140:  101:      return FALSE;
        -:  102:    }
        -:  103:
    28929:  104:  link = _dbus_list_get_first_link (&recipients);
call    0 returned 100%
   129184:  105:  while (link != NULL)
branch  0 taken 71%
branch  1 taken 29% (fallthrough)
        -:  106:    {
        -:  107:      DBusConnection *dest;
        -:  108:
    71590:  109:      dest = link->data;
        -:  110:
    71590:  111:      if (!send_one_message (dest, context, sender, addressed_recipient,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  112:                             message, transaction, &tmp_error))
      264:  113:        break;
        -:  114:
    71326:  115:      link = _dbus_list_get_next_link (&recipients, link);
branch  0 taken 60% (fallthrough)
branch  1 taken 40%
        -:  116:    }
        -:  117:
    28929:  118:  _dbus_list_clear (&recipients);
call    0 returned 100%
        -:  119:  
    28929:  120:  if (dbus_error_is_set (&tmp_error))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  121:    {
      264:  122:      dbus_move_error (&tmp_error, error);
call    0 returned 100%
      264:  123:      return FALSE;
        -:  124:    }
        -:  125:  else
    28665:  126:    return TRUE;
        -:  127:}
        -:  128:
        -:  129:static DBusHandlerResult
        -:  130:bus_dispatch (DBusConnection *connection,
        -:  131:              DBusMessage    *message)
function bus_dispatch called 26136 returned 100% blocks executed 90%
    26136:  132:{
        -:  133:  const char *sender, *service_name;
        -:  134:  DBusError error;
        -:  135:  BusTransaction *transaction;
        -:  136:  BusContext *context;
        -:  137:  DBusHandlerResult result;
        -:  138:  DBusConnection *addressed_recipient;
        -:  139:  
    26136:  140:  result = DBUS_HANDLER_RESULT_HANDLED;
        -:  141:  
    26136:  142:  transaction = NULL;
    26136:  143:  addressed_recipient = NULL;
    26136:  144:  dbus_error_init (&error);
call    0 returned 100%
        -:  145:  
    26136:  146:  context = bus_connection_get_context (connection);
call    0 returned 100%
    26136:  147:  _dbus_assert (context != NULL);
call    0 returned 100%
        -:  148:  
        -:  149:  /* If we can't even allocate an OOM error, we just go to sleep
        -:  150:   * until we can.
        -:  151:   */
    52354:  152:  while (!bus_connection_preallocate_oom_error (connection))
call    0 returned 100%
branch  1 taken 1%
branch  2 taken 99% (fallthrough)
       82:  153:    _dbus_wait_for_memory ();
call    0 returned 100%
        -:  154:  
        -:  155:  /* Ref connection in case we disconnect it at some point in here */
    26136:  156:  dbus_connection_ref (connection);
call    0 returned 100%
        -:  157:  
    26136:  158:  service_name = dbus_message_get_destination (message);
call    0 returned 100%
        -:  159:
        -:  160:#ifdef DBUS_ENABLE_VERBOSE_MODE
        -:  161:  {
        -:  162:    const char *interface_name, *member_name, *error_name;
        -:  163:
    26136:  164:    interface_name = dbus_message_get_interface (message);
call    0 returned 100%
    26136:  165:    member_name = dbus_message_get_member (message);
call    0 returned 100%
    26136:  166:    error_name = dbus_message_get_error_name (message);
call    0 returned 100%
        -:  167:    
    26136:  168:    _dbus_verbose ("DISPATCH: %s %s %s to %s\n",
branch  0 taken 70% (fallthrough)
branch  1 taken 30%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
branch  4 taken 99% (fallthrough)
branch  5 taken 1%
branch  6 taken 99% (fallthrough)
branch  7 taken 1%
call    8 returned 100%
        -:  169:                   interface_name ? interface_name : "(no interface)",
        -:  170:                   member_name ? member_name : "(no member)",
        -:  171:                   error_name ? error_name : "(no error name)",
        -:  172:                   service_name ? service_name : "peer");
        -:  173:  }
        -:  174:#endif /* DBUS_ENABLE_VERBOSE_MODE */
        -:  175:  
        -:  176:  /* If service_name is NULL, if it's a signal we send it to all
        -:  177:   * connections with a match rule. If it's not a signal, there
        -:  178:   * are some special cases here but mostly we just bail out.
        -:  179:   */
    26136:  180:  if (service_name == NULL)
branch  0 taken 30% (fallthrough)
branch  1 taken 70%
        -:  181:    {
     7807:  182:      if (dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -:  183:                                  DBUS_INTERFACE_LOCAL,
        -:  184:                                  "Disconnected"))
        -:  185:        {
     7807:  186:          bus_connection_disconnected (connection);
call    0 returned 100%
     7807:  187:          goto out;
        -:  188:        }
        -:  189:
    #####:  190:      if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  191:        {
        -:  192:          /* DBusConnection also handles some of these automatically, we leave
        -:  193:           * it to do so.
        -:  194:           */
    #####:  195:          result = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
    #####:  196:          goto out;
        -:  197:        }
        -:  198:    }
        -:  199:  
        -:  200:  /* Create our transaction */
    18329:  201:  transaction = bus_transaction_new (context);
call    0 returned 100%
    18329:  202:  if (transaction == NULL)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        -:  203:    {
       41:  204:      BUS_SET_OOM (&error);
call    0 returned 100%
       41:  205:      goto out;
        -:  206:    }
        -:  207:  
        -:  208:  /* Assign a sender to the message */
    18288:  209:  if (bus_connection_is_active (connection))
call    0 returned 100%
branch  1 taken 66% (fallthrough)
branch  2 taken 34%
        -:  210:    {
    12104:  211:      sender = bus_connection_get_name (connection);
call    0 returned 100%
    12104:  212:      _dbus_assert (sender != NULL);
call    0 returned 100%
        -:  213:
    12104:  214:      if (!dbus_message_set_sender (message, sender))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  215:        {
        4:  216:          BUS_SET_OOM (&error);
call    0 returned 100%
        4:  217:          goto out;
        -:  218:        }
        -:  219:
        -:  220:      /* We need to refetch the service name here, because
        -:  221:       * dbus_message_set_sender can cause the header to be
        -:  222:       * reallocated, and thus the service_name pointer will become
        -:  223:       * invalid.
        -:  224:       */
    12100:  225:      service_name = dbus_message_get_destination (message);
call    0 returned 100%
        -:  226:    }
        -:  227:  
    31129:  228:  if (service_name &&
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
call    2 returned 100%
branch  3 taken 84% (fallthrough)
branch  4 taken 16%
        -:  229:      strcmp (service_name, DBUS_SERVICE_DBUS) == 0) /* to bus driver */
        -:  230:    {
    15270:  231:      if (!bus_context_check_security_policy (context, transaction,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  232:                                              connection, NULL, NULL, message, &error))
        -:  233:        {
    #####:  234:          _dbus_verbose ("Security policy rejected message\n");
call    0 never executed
    #####:  235:          goto out;
        -:  236:        }
        -:  237:
    15270:  238:      _dbus_verbose ("Giving message to %s\n", DBUS_SERVICE_DBUS);
call    0 returned 100%
    15270:  239:      if (!bus_driver_handle_message (connection, transaction, message, &error))
call    0 returned 100%
branch  1 taken 16% (fallthrough)
branch  2 taken 84%
     2425:  240:        goto out;
        -:  241:    }
     3014:  242:  else if (!bus_connection_is_active (connection)) /* clients must talk to bus driver first */
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  243:    {
    #####:  244:      _dbus_verbose ("Received message from non-registered client. Disconnecting.\n");
call    0 never executed
    #####:  245:      dbus_connection_close (connection);
call    0 never executed
    #####:  246:      goto out;
        -:  247:    }
     3014:  248:  else if (service_name != NULL) /* route to named service */
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  249:    {
        -:  250:      DBusString service_string;
        -:  251:      BusService *service;
        -:  252:      BusRegistry *registry;
        -:  253:
     3014:  254:      _dbus_assert (service_name != NULL);
call    0 returned 100%
        -:  255:      
     3014:  256:      registry = bus_connection_get_registry (connection);
call    0 returned 100%
        -:  257:      
     3014:  258:      _dbus_string_init_const (&service_string, service_name);
call    0 returned 100%
     3014:  259:      service = bus_registry_lookup (registry, &service_string);
call    0 returned 100%
        -:  260:
     3014:  261:      if (service == NULL && dbus_message_get_auto_start (message))
branch  0 taken 48% (fallthrough)
branch  1 taken 52%
call    2 returned 100%
branch  3 taken 100% (fallthrough)
branch  4 taken 0%
        -:  262:        {
        -:  263:          BusActivation *activation;
        -:  264:          /* We can't do the security policy check here, since the addressed
        -:  265:           * recipient service doesn't exist yet. We do it before sending the
        -:  266:           * message after the service has been created.
        -:  267:           */
     1433:  268:          activation = bus_connection_get_activation (connection);
call    0 returned 100%
        -:  269:
     1433:  270:          if (!bus_activation_activate_service (activation, connection, transaction, TRUE,
call    0 returned 100%
branch  1 taken 87% (fallthrough)
branch  2 taken 13%
        -:  271:                                                message, service_name, &error))
        -:  272:            {
     1241:  273:              _DBUS_ASSERT_ERROR_IS_SET (&error);
call    0 returned 100%
call    1 returned 100%
     1241:  274:              _dbus_verbose ("bus_activation_activate_service() failed: %s\n", error.name);
call    0 returned 100%
     1241:  275:              goto out;
        -:  276:            }
        -:  277:          
      192:  278:          goto out;
        -:  279:        }
     1581:  280:      else if (service == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  281:        {
    #####:  282:          dbus_set_error (&error,
call    0 never executed
        -:  283:                          DBUS_ERROR_NAME_HAS_NO_OWNER,
        -:  284:                          "Name \"%s\" does not exist",
        -:  285:                          service_name);
    #####:  286:          goto out;
        -:  287:        }
        -:  288:      else
        -:  289:        {
     1581:  290:          addressed_recipient = bus_service_get_primary_owners_connection (service);
call    0 returned 100%
     1581:  291:          _dbus_assert (addressed_recipient != NULL);
call    0 returned 100%
        -:  292:          
     1581:  293:          if (!bus_context_check_security_policy (context, transaction,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  294:                                                  connection, addressed_recipient,
        -:  295:                                                  addressed_recipient,
        -:  296:                                                  message, &error))
       15:  297:            goto out;
        -:  298:          
        -:  299:          /* Dispatch the message */
     1566:  300:          if (!bus_transaction_send (transaction, addressed_recipient, message))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  301:            {
       13:  302:              BUS_SET_OOM (&error);
call    0 returned 100%
       13:  303:              goto out;
        -:  304:            }
        -:  305:        }
        -:  306:    }
        -:  307:
        -:  308:  /* Now match the messages against any match rules, which will send
        -:  309:   * out signals and such. addressed_recipient may == NULL.
        -:  310:   */
    14398:  311:  if (!bus_dispatch_matches (transaction, connection, addressed_recipient, message, &error))
call    0 returned 100%
    14398:  312:    goto out;
        -:  313:  
    26136:  314: out:
    26136:  315:  if (dbus_error_is_set (&error))
call    0 returned 100%
branch  1 taken 15% (fallthrough)
branch  2 taken 85%
        -:  316:    {
     3820:  317:      if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  318:        {
        -:  319:          /* If we disconnected it, we won't bother to send it any error
        -:  320:           * messages.
        -:  321:           */
    #####:  322:          _dbus_verbose ("Not sending error to connection we disconnected\n");
call    0 never executed
        -:  323:        }
     3820:  324:      else if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 returned 100%
branch  1 taken 86% (fallthrough)
branch  2 taken 14%
        -:  325:        {
     3270:  326:          bus_connection_send_oom_error (connection, message);
call    0 returned 100%
        -:  327:
        -:  328:          /* cancel transaction due to OOM */
     3270:  329:          if (transaction != NULL)
branch  0 taken 99% (fallthrough)
branch  1 taken 1%
        -:  330:            {
     3229:  331:              bus_transaction_cancel_and_free (transaction);
call    0 returned 100%
     3229:  332:              transaction = NULL;
        -:  333:            }
        -:  334:        }
        -:  335:      else
        -:  336:        {
        -:  337:          /* Try to send the real error, if no mem to do that, send
        -:  338:           * the OOM error
        -:  339:           */
      550:  340:          _dbus_assert (transaction != NULL);
call    0 returned 100%
      550:  341:          if (!bus_transaction_send_error_reply (transaction, connection,
call    0 returned 100%
branch  1 taken 31% (fallthrough)
branch  2 taken 69%
        -:  342:                                                 &error, message))
        -:  343:            {
      171:  344:              bus_connection_send_oom_error (connection, message);
call    0 returned 100%
        -:  345:              
        -:  346:              /* cancel transaction due to OOM */
      171:  347:              if (transaction != NULL)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  348:                {
      171:  349:                  bus_transaction_cancel_and_free (transaction);
call    0 returned 100%
      171:  350:                  transaction = NULL;
        -:  351:                }
        -:  352:            }
        -:  353:        }
        -:  354:     
        -:  355:      
     3820:  356:      dbus_error_free (&error);
call    0 returned 100%
        -:  357:    }
        -:  358:
    26136:  359:  if (transaction != NULL)
branch  0 taken 57% (fallthrough)
branch  1 taken 43%
        -:  360:    {
    14888:  361:      bus_transaction_execute_and_free (transaction);
call    0 returned 100%
        -:  362:    }
        -:  363:
    26136:  364:  dbus_connection_unref (connection);
call    0 returned 100%
        -:  365:
    26136:  366:  return result;
        -:  367:}
        -:  368:
        -:  369:static DBusHandlerResult
        -:  370:bus_dispatch_message_filter (DBusConnection     *connection,
        -:  371:                             DBusMessage        *message,
        -:  372:                             void               *user_data)
function bus_dispatch_message_filter called 26136 returned 100% blocks executed 100%
    26136:  373:{
    26136:  374:  return bus_dispatch (connection, message);
call    0 returned 100%
        -:  375:}
        -:  376:
        -:  377:dbus_bool_t
        -:  378:bus_dispatch_add_connection (DBusConnection *connection)
function bus_dispatch_add_connection called 7833 returned 100% blocks executed 100%
     7833:  379:{  
     7833:  380:  if (!dbus_connection_add_filter (connection,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  381:                                   bus_dispatch_message_filter,
        -:  382:                                   NULL, NULL))
       22:  383:    return FALSE;
        -:  384:  
     7811:  385:  return TRUE;
        -:  386:}
        -:  387:
        -:  388:void
        -:  389:bus_dispatch_remove_connection (DBusConnection *connection)
function bus_dispatch_remove_connection called 7811 returned 100% blocks executed 100%
     7811:  390:{
        -:  391:  /* Here we tell the bus driver that we want to get off. */
     7811:  392:  bus_driver_remove_connection (connection);
call    0 returned 100%
        -:  393:
     7811:  394:  dbus_connection_remove_filter (connection,
call    0 returned 100%
        -:  395:                                 bus_dispatch_message_filter,
        -:  396:                                 NULL);
     7811:  397:}
        -:  398:
        -:  399:#ifdef DBUS_BUILD_TESTS
        -:  400:
        -:  401:#include <stdio.h>
        -:  402:
        -:  403:/* This is used to know whether we need to block in order to finish
        -:  404: * sending a message, or whether the initial dbus_connection_send()
        -:  405: * already flushed the queue.
        -:  406: */
        -:  407:#define SEND_PENDING(connection) (dbus_connection_has_messages_to_send (connection))
        -:  408:
        -:  409:typedef dbus_bool_t (* Check1Func) (BusContext     *context);
        -:  410:typedef dbus_bool_t (* Check2Func) (BusContext     *context,
        -:  411:                                    DBusConnection *connection);
        -:  412:
        -:  413:static dbus_bool_t check_no_leftovers (BusContext *context);
        -:  414:
        -:  415:static void
        -:  416:block_connection_until_message_from_bus (BusContext     *context,
        -:  417:                                         DBusConnection *connection,
        -:  418:                                         const char     *what_is_expected)
function block_connection_until_message_from_bus called 16354 returned 100% blocks executed 100%
    16354:  419:{
    16354:  420:  _dbus_verbose ("expecting: %s\n", what_is_expected);
call    0 returned 100%
        -:  421:  
   401001:  422:  while (dbus_connection_get_dispatch_status (connection) ==
call    0 returned 100%
branch  1 taken 96% (fallthrough)
branch  2 taken 4%
call    3 returned 100%
branch  4 taken 100%
branch  5 taken 0% (fallthrough)
        -:  423:         DBUS_DISPATCH_COMPLETE &&
        -:  424:         dbus_connection_get_is_connected (connection))
        -:  425:    {
   368293:  426:      bus_test_run_bus_loop (context, TRUE);
call    0 returned 100%
   368293:  427:      bus_test_run_clients_loop (FALSE);
call    0 returned 100%
        -:  428:    }
    16354:  429:}
        -:  430:
        -:  431:static void
        -:  432:spin_connection_until_authenticated (BusContext     *context,
        -:  433:                                     DBusConnection *connection)
function spin_connection_until_authenticated called 5399 returned 100% blocks executed 100%
     5399:  434:{
     5399:  435:  _dbus_verbose ("Spinning to auth connection %p\n", connection);
call    0 returned 100%
    28404:  436:  while (!dbus_connection_get_is_authenticated (connection) &&
call    0 returned 100%
branch  1 taken 83% (fallthrough)
branch  2 taken 17%
call    3 returned 100%
branch  4 taken 92%
branch  5 taken 8% (fallthrough)
        -:  437:         dbus_connection_get_is_connected (connection))
        -:  438:    {
    17606:  439:      bus_test_run_bus_loop (context, FALSE);
call    0 returned 100%
    17606:  440:      bus_test_run_clients_loop (FALSE);
call    0 returned 100%
        -:  441:    }
     5399:  442:  _dbus_verbose (" ... done spinning to auth connection %p\n", connection);
call    0 returned 100%
     5399:  443:}
        -:  444:
        -:  445:/* compensate for fact that pop_message() can return #NULL due to OOM */
        -:  446:static DBusMessage*
        -:  447:pop_message_waiting_for_memory (DBusConnection *connection)
function pop_message_waiting_for_memory called 113933 returned 100% blocks executed 100%
   113933:  448:{
   227938:  449:  while (dbus_connection_get_dispatch_status (connection) ==
call    0 returned 100%
branch  1 taken 1%
branch  2 taken 99% (fallthrough)
        -:  450:         DBUS_DISPATCH_NEED_MEMORY)
       72:  451:    _dbus_wait_for_memory ();
call    0 returned 100%
        -:  452:
   113933:  453:  return dbus_connection_pop_message (connection);
call    0 returned 100%
        -:  454:}
        -:  455:
        -:  456:static DBusMessage*
        -:  457:borrow_message_waiting_for_memory (DBusConnection *connection)
function borrow_message_waiting_for_memory called 1579 returned 100% blocks executed 83%
     1579:  458:{
     3158:  459:  while (dbus_connection_get_dispatch_status (connection) ==
call    0 returned 100%
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
        -:  460:         DBUS_DISPATCH_NEED_MEMORY)
    #####:  461:    _dbus_wait_for_memory ();
call    0 never executed
        -:  462:
     1579:  463:  return dbus_connection_borrow_message (connection);
call    0 returned 100%
        -:  464:}
        -:  465:
        -:  466:static void
        -:  467:warn_unexpected_real (DBusConnection *connection,
        -:  468:                      DBusMessage    *message,
        -:  469:                      const char     *expected,
        -:  470:                      const char     *function,
        -:  471:                      int             line)
function warn_unexpected_real called 0 returned 0% blocks executed 0%
    #####:  472:{
    #####:  473:  if (message)
branch  0 never executed
branch  1 never executed
    #####:  474:    _dbus_warn ("%s:%d received message interface \"%s\" member \"%s\" error name \"%s\" on %p, expecting %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
branch  5 never executed
branch  6 never executed
call    7 never executed
call    8 never executed
branch  9 never executed
branch 10 never executed
call   11 never executed
call   12 never executed
        -:  475:                function, line,
        -:  476:                dbus_message_get_interface (message) ?
        -:  477:                dbus_message_get_interface (message) : "(unset)",
        -:  478:                dbus_message_get_member (message) ?
        -:  479:                dbus_message_get_member (message) : "(unset)",
        -:  480:                dbus_message_get_error_name (message) ?
        -:  481:                dbus_message_get_error_name (message) : "(unset)",
        -:  482:                connection,
        -:  483:                expected);
        -:  484:  else
    #####:  485:    _dbus_warn ("%s:%d received no message on %p, expecting %s\n",
call    0 never executed
        -:  486:                function, line, connection, expected);
    #####:  487:}
        -:  488:
        -:  489:#define warn_unexpected(connection, message, expected) \
        -:  490:  warn_unexpected_real (connection, message, expected, _DBUS_FUNCTION_NAME, __LINE__)
        -:  491:
        -:  492:static void
        -:  493:verbose_message_received (DBusConnection *connection,
        -:  494:                          DBusMessage    *message)
function verbose_message_received called 12438 returned 100% blocks executed 100%
    12438:  495:{
    12438:  496:  _dbus_verbose ("Received message interface \"%s\" member \"%s\" error name \"%s\" on %p\n",
call    0 returned 100%
branch  1 taken 31% (fallthrough)
branch  2 taken 69%
call    3 returned 100%
call    4 returned 100%
branch  5 taken 16% (fallthrough)
branch  6 taken 84%
call    7 returned 100%
call    8 returned 100%
branch  9 taken 16% (fallthrough)
branch 10 taken 84%
call   11 returned 100%
call   12 returned 100%
        -:  497:                 dbus_message_get_interface (message) ?
        -:  498:                 dbus_message_get_interface (message) : "(unset)",
        -:  499:                 dbus_message_get_member (message) ?
        -:  500:                 dbus_message_get_member (message) : "(unset)",
        -:  501:                 dbus_message_get_error_name (message) ?
        -:  502:                 dbus_message_get_error_name (message) : "(unset)",
        -:  503:                 connection);
    12438:  504:}
        -:  505:
        -:  506:typedef enum
        -:  507:{
        -:  508:  SERVICE_CREATED,
        -:  509:  OWNER_CHANGED,
        -:  510:  SERVICE_DELETED
        -:  511:} ServiceInfoKind;
        -:  512:
        -:  513:typedef struct
        -:  514:{
        -:  515:  ServiceInfoKind expected_kind;
        -:  516:  const char *expected_service_name;
        -:  517:  dbus_bool_t failed;
        -:  518:  DBusConnection *skip_connection;
        -:  519:} CheckServiceOwnerChangedData;
        -:  520:
        -:  521:static dbus_bool_t
        -:  522:check_service_owner_changed_foreach (DBusConnection *connection,
        -:  523:                                     void           *data)
function check_service_owner_changed_foreach called 35331 returned 100% blocks executed 61%
    35331:  524:{
    35331:  525:  CheckServiceOwnerChangedData *d = data;
        -:  526:  DBusMessage *message;
        -:  527:  DBusError error;
        -:  528:  const char *service_name, *old_owner, *new_owner;
        -:  529:
    35331:  530:  if (d->expected_kind == SERVICE_CREATED 
branch  0 taken 55% (fallthrough)
branch  1 taken 45%
branch  2 taken 35% (fallthrough)
branch  3 taken 65%
        -:  531:      && connection == d->skip_connection)
     6840:  532:    return TRUE;
        -:  533:
    28491:  534:  dbus_error_init (&error);
call    0 returned 100%
    28491:  535:  d->failed = TRUE;
        -:  536:  
    28491:  537:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
    28491:  538:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  539:    {
    #####:  540:      _dbus_warn ("Did not receive a message on %p, expecting %s\n",
call    0 never executed
        -:  541:                  connection, "NameOwnerChanged");
    #####:  542:      goto out;
        -:  543:    }
    28491:  544:  else if (!dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  545:                                    DBUS_INTERFACE_DBUS,
        -:  546:                                    "NameOwnerChanged"))
        -:  547:    {
    #####:  548:      warn_unexpected (connection, message, "NameOwnerChanged");
call    0 never executed
        -:  549:
    #####:  550:      goto out;
        -:  551:    }
        -:  552:  else
        -:  553:    {
    28491:  554:    reget_service_info_data:
    28491:  555:      service_name = NULL;
    28491:  556:      old_owner = NULL;
    28491:  557:      new_owner = NULL;
        -:  558:
    28491:  559:      dbus_message_get_args (message, &error,
call    0 returned 100%
        -:  560:                             DBUS_TYPE_STRING, &service_name,
        -:  561:                             DBUS_TYPE_STRING, &old_owner,
        -:  562:                             DBUS_TYPE_STRING, &new_owner,
        -:  563:                             DBUS_TYPE_INVALID);
        -:  564:
    28491:  565:      if (dbus_error_is_set (&error))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  566:        {
    #####:  567:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  568:            {
    #####:  569:              dbus_error_free (&error);
call    0 never executed
    #####:  570:              _dbus_wait_for_memory ();              
call    0 never executed
    #####:  571:              goto reget_service_info_data;
        -:  572:            }
        -:  573:          else
        -:  574:            {
    #####:  575:              _dbus_warn ("Did not get the expected arguments\n");
call    0 never executed
    #####:  576:              goto out;
        -:  577:            }
        -:  578:        }
        -:  579:
    28491:  580:      if ((d->expected_kind == SERVICE_CREATED    && ( old_owner[0] || !new_owner[0]))
branch  0 taken 44% (fallthrough)
branch  1 taken 56%
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%
branch  8 never executed
branch  9 never executed
branch 10 never executed
branch 11 never executed
branch 12 taken 56% (fallthrough)
branch 13 taken 44%
branch 14 taken 100% (fallthrough)
branch 15 taken 0%
branch 16 taken 0% (fallthrough)
branch 17 taken 100%
        -:  581:          || (d->expected_kind == OWNER_CHANGED   && (!old_owner[0] || !new_owner[0]))
        -:  582:          || (d->expected_kind == SERVICE_DELETED && (!old_owner[0] ||  new_owner[0])))
        -:  583:        {
    #####:  584:          _dbus_warn ("inconsistent NameOwnerChanged arguments");
call    0 never executed
    #####:  585:          goto out;
        -:  586:        }
        -:  587:
    28491:  588:      if (strcmp (service_name, d->expected_service_name) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  589:        {
    #####:  590:          _dbus_warn ("expected info on service %s, got info on %s\n",
call    0 never executed
        -:  591:                      d->expected_service_name,
        -:  592:                      service_name);
    #####:  593:          goto out;
        -:  594:        }
        -:  595:
    28491:  596:      if (*service_name == ':' && new_owner[0] 
branch  0 taken 73% (fallthrough)
branch  1 taken 27%
branch  2 taken 45% (fallthrough)
branch  3 taken 55%
call    4 returned 100%
branch  5 taken 0% (fallthrough)
branch  6 taken 100%
        -:  597:          && strcmp (service_name, new_owner) != 0)
        -:  598:        {
    #####:  599:          _dbus_warn ("inconsistent ServiceOwnedChanged message (\"%s\" [ %s -> %s ])\n",
call    0 never executed
        -:  600:                      service_name, old_owner, new_owner);
    #####:  601:          goto out;
        -:  602:        }
        -:  603:    }
        -:  604:
    28491:  605:  d->failed = FALSE;
        -:  606:  
    28491:  607: out:
    28491:  608:  dbus_error_free (&error);
call    0 returned 100%
        -:  609:  
    28491:  610:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
    28491:  611:    dbus_message_unref (message);
call    0 returned 100%
        -:  612:
    28491:  613:  return !d->failed;
        -:  614:}
        -:  615:
        -:  616:
        -:  617:static void
        -:  618:kill_client_connection (BusContext     *context,
        -:  619:                        DBusConnection *connection)
function kill_client_connection called 3344 returned 100% blocks executed 89%
     3344:  620:{
        -:  621:  char *base_service;
        -:  622:  const char *s;
        -:  623:  CheckServiceOwnerChangedData socd;
        -:  624:
     3344:  625:  _dbus_verbose ("killing connection %p\n", connection);
call    0 returned 100%
        -:  626:  
     3344:  627:  s = dbus_bus_get_unique_name (connection);
call    0 returned 100%
     3344:  628:  _dbus_assert (s != NULL);
call    0 returned 100%
        -:  629:
     6704:  630:  while ((base_service = _dbus_strdup (s)) == NULL)
call    0 returned 100%
branch  1 taken 1%
branch  2 taken 99% (fallthrough)
       16:  631:    _dbus_wait_for_memory ();
call    0 returned 100%
        -:  632:
     3344:  633:  dbus_connection_ref (connection);
call    0 returned 100%
        -:  634:  
        -:  635:  /* kick in the disconnect handler that unrefs the connection */
     3344:  636:  dbus_connection_close (connection);
call    0 returned 100%
        -:  637:
     3344:  638:  bus_test_run_everything (context);
call    0 returned 100%
        -:  639:  
     3344:  640:  _dbus_assert (bus_test_client_listed (connection));
call    0 returned 100%
call    1 returned 100%
        -:  641:  
        -:  642:  /* Run disconnect handler in test.c */
     3344:  643:  if (bus_connection_dispatch_one_message (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  644:    _dbus_assert_not_reached ("something received on connection being killed other than the disconnect");
call    0 never executed
        -:  645:  
     3344:  646:  _dbus_assert (!dbus_connection_get_is_connected (connection));
call    0 returned 100%
call    1 returned 100%
     3344:  647:  dbus_connection_unref (connection);
call    0 returned 100%
     3344:  648:  connection = NULL;
     3344:  649:  _dbus_assert (!bus_test_client_listed (connection));
call    0 returned 100%
call    1 returned 100%
        -:  650:  
     3344:  651:  socd.expected_kind = SERVICE_DELETED;
     3344:  652:  socd.expected_service_name = base_service;
     3344:  653:  socd.failed = FALSE;
     3344:  654:  socd.skip_connection = NULL;
        -:  655:  
     3344:  656:  bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -:  657:                            &socd);
        -:  658:
     3344:  659:  dbus_free (base_service);
call    0 returned 100%
        -:  660:  
     3344:  661:  if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  662:    _dbus_assert_not_reached ("didn't get the expected NameOwnerChanged (deletion) messages");
call    0 never executed
        -:  663:  
     3344:  664:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  665:    _dbus_assert_not_reached ("stuff left in message queues after disconnecting a client");
call    0 never executed
     3344:  666:}
        -:  667:
        -:  668:static void
        -:  669:kill_client_connection_unchecked (DBusConnection *connection)
function kill_client_connection_unchecked called 2055 returned 100% blocks executed 90%
     2055:  670:{
        -:  671:  /* This kills the connection without expecting it to affect
        -:  672:   * the rest of the bus.
        -:  673:   */  
     2055:  674:  _dbus_verbose ("Unchecked kill of connection %p\n", connection);
call    0 returned 100%
        -:  675:
     2055:  676:  dbus_connection_ref (connection);
call    0 returned 100%
     2055:  677:  dbus_connection_close (connection);
call    0 returned 100%
        -:  678:  /* dispatching disconnect handler will unref once */
     2055:  679:  if (bus_connection_dispatch_one_message (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  680:    _dbus_assert_not_reached ("message other than disconnect dispatched after failure to register");
call    0 never executed
        -:  681:
     2055:  682:  _dbus_assert (!bus_test_client_listed (connection));
call    0 returned 100%
call    1 returned 100%
     2055:  683:  dbus_connection_unref (connection);
call    0 returned 100%
     2055:  684:}
        -:  685:
        -:  686:typedef struct
        -:  687:{
        -:  688:  dbus_bool_t failed;
        -:  689:} CheckNoMessagesData;
        -:  690:
        -:  691:static dbus_bool_t
        -:  692:check_no_messages_foreach (DBusConnection *connection,
        -:  693:                           void           *data)
function check_no_messages_foreach called 64583 returned 100% blocks executed 57%
    64583:  694:{
    64583:  695:  CheckNoMessagesData *d = data;
        -:  696:  DBusMessage *message;
        -:  697:
    64583:  698:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
    64583:  699:  if (message != NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  700:    {
    #####:  701:      warn_unexpected (connection, message, "no messages");
call    0 never executed
        -:  702:
    #####:  703:      d->failed = TRUE;
        -:  704:    }
        -:  705:
    64583:  706:  if (message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  707:    dbus_message_unref (message);
call    0 never executed
    64583:  708:  return !d->failed;
        -:  709:}
        -:  710:
        -:  711:static dbus_bool_t
        -:  712:check_no_leftovers (BusContext *context)
function check_no_leftovers called 26553 returned 100% blocks executed 67%
    26553:  713:{
        -:  714:  CheckNoMessagesData nmd;
        -:  715:
    26553:  716:  nmd.failed = FALSE;
    26553:  717:  bus_test_clients_foreach (check_no_messages_foreach,
call    0 returned 100%
        -:  718:                            &nmd);
        -:  719:  
    26553:  720:  if (nmd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  721:    {
    #####:  722:      _dbus_verbose ("%s: leftover message found\n",
call    0 never executed
        -:  723:                     _DBUS_FUNCTION_NAME);
    #####:  724:      return FALSE;
        -:  725:    }
        -:  726:  else
    26553:  727:    return TRUE;
        -:  728:}
        -:  729:
        -:  730:/* returns TRUE if the correct thing happens,
        -:  731: * but the correct thing may include OOM errors.
        -:  732: */
        -:  733:static dbus_bool_t
        -:  734:check_hello_message (BusContext     *context,
        -:  735:                     DBusConnection *connection)
function check_hello_message called 5399 returned 100% blocks executed 61%
     5399:  736:{
        -:  737:  DBusMessage *message;
        -:  738:  DBusMessage *name_message;
        -:  739:  dbus_uint32_t serial;
        -:  740:  dbus_bool_t retval;
        -:  741:  DBusError error;
        -:  742:  const char *name;
        -:  743:  const char *acquired;
        -:  744:
     5399:  745:  retval = FALSE;
     5399:  746:  dbus_error_init (&error);
call    0 returned 100%
     5399:  747:  name = NULL;
     5399:  748:  acquired = NULL;
     5399:  749:  message = NULL;
     5399:  750:  name_message = NULL;
        -:  751:
     5399:  752:  _dbus_verbose ("check_hello_message for %p\n", connection);
call    0 returned 100%
        -:  753:  
     5399:  754:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -:  755:                                          DBUS_PATH_DBUS,
        -:  756:                                          DBUS_INTERFACE_DBUS,
        -:  757:                                          "Hello");
        -:  758:
     5399:  759:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  760:    return TRUE;
        -:  761:
     5399:  762:  dbus_connection_ref (connection); /* because we may get disconnected */
call    0 returned 100%
        -:  763:  
     5399:  764:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  765:    {
        8:  766:      dbus_message_unref (message);
call    0 returned 100%
        8:  767:      dbus_connection_unref (connection);
call    0 returned 100%
        8:  768:      return TRUE;
        -:  769:    }
        -:  770:
     5391:  771:  _dbus_assert (dbus_message_has_signature (message, ""));
call    0 returned 100%
call    1 returned 100%
        -:  772:  
     5391:  773:  dbus_message_unref (message);
call    0 returned 100%
     5391:  774:  message = NULL;
        -:  775:
     5391:  776:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 29% (fallthrough)
branch  2 taken 71%
        -:  777:    {
     1543:  778:      _dbus_verbose ("connection was disconnected (presumably auth failed)\n");
call    0 returned 100%
        -:  779:      
     1543:  780:      dbus_connection_unref (connection);
call    0 returned 100%
        -:  781:      
     1543:  782:      return TRUE;
        -:  783:    }
        -:  784:  
        -:  785:  /* send our message */
     3848:  786:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -:  787:
     3848:  788:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  789:    {
    #####:  790:      _dbus_verbose ("connection was disconnected (presumably auth failed)\n");
call    0 never executed
        -:  791:      
    #####:  792:      dbus_connection_unref (connection);
call    0 never executed
        -:  793:      
    #####:  794:      return TRUE;
        -:  795:    }
        -:  796:  
     3848:  797:  block_connection_until_message_from_bus (context, connection, "reply to Hello");
call    0 returned 100%
        -:  798:
     3848:  799:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -:  800:    {
        4:  801:      _dbus_verbose ("connection was disconnected (presumably auth failed)\n");
call    0 returned 100%
        -:  802:      
        4:  803:      dbus_connection_unref (connection);
call    0 returned 100%
        -:  804:      
        4:  805:      return TRUE;
        -:  806:    }
        -:  807:
     3844:  808:  dbus_connection_unref (connection);
call    0 returned 100%
        -:  809:  
     3844:  810:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     3844:  811:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  812:    {
    #####:  813:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -:  814:                  "Hello", serial, connection);
    #####:  815:      goto out;
        -:  816:    }
        -:  817:
     3844:  818:  verbose_message_received (connection, message);
call    0 returned 100%
        -:  819:
     3844:  820:  if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  821:    {
    #####:  822:      _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -:  823:                  dbus_message_get_sender (message) ?
        -:  824:                  dbus_message_get_sender (message) : "(none)");
    #####:  825:      goto out;
        -:  826:    }
        -:  827:  
     3844:  828:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 13% (fallthrough)
branch  2 taken 87%
        -:  829:    {
      496:  830:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  831:                                 DBUS_ERROR_NO_MEMORY))
        -:  832:        {
        -:  833:          ; /* good, this is a valid response */
        -:  834:        }
        -:  835:      else
        -:  836:        {
    #####:  837:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -:  838:
    #####:  839:          goto out;
        -:  840:        }
        -:  841:    }
        -:  842:  else
        -:  843:    {
        -:  844:      CheckServiceOwnerChangedData socd;
        -:  845:      
     3348:  846:      if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  847:        {
        -:  848:          ; /* good, expected */
        -:  849:        }
        -:  850:      else
        -:  851:        {
    #####:  852:          warn_unexpected (connection, message, "method return for Hello");
call    0 never executed
        -:  853:
    #####:  854:          goto out;
        -:  855:        }
        -:  856:
     3348:  857:    retry_get_hello_name:
     3348:  858:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  859:                                  DBUS_TYPE_STRING, &name,
        -:  860:                                  DBUS_TYPE_INVALID))
        -:  861:        {
    #####:  862:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  863:            {
    #####:  864:              _dbus_verbose ("no memory to get service name arg from hello\n");
call    0 never executed
    #####:  865:              dbus_error_free (&error);
call    0 never executed
    #####:  866:              _dbus_wait_for_memory ();
call    0 never executed
    #####:  867:              goto retry_get_hello_name;
        -:  868:            }
        -:  869:          else
        -:  870:            {
    #####:  871:              _dbus_assert (dbus_error_is_set (&error));
call    0 never executed
call    1 never executed
    #####:  872:              _dbus_warn ("Did not get the expected single string argument to hello\n");
call    0 never executed
    #####:  873:              goto out;
        -:  874:            }
        -:  875:        }
        -:  876:
     3348:  877:      _dbus_verbose ("Got hello name: %s\n", name);
call    0 returned 100%
        -:  878:
     6720:  879:      while (!dbus_bus_set_unique_name (connection, name))
call    0 returned 100%
branch  1 taken 1%
branch  2 taken 99% (fallthrough)
       24:  880:        _dbus_wait_for_memory ();
call    0 returned 100%
        -:  881:      
     3348:  882:      socd.expected_kind = SERVICE_CREATED;
     3348:  883:      socd.expected_service_name = name;
     3348:  884:      socd.failed = FALSE;
     3348:  885:      socd.skip_connection = connection; /* we haven't done AddMatch so won't get it ourselves */
     3348:  886:      bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -:  887:                                &socd);
        -:  888:      
     3348:  889:      if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  890:        goto out;
        -:  891:
     3348:  892:      name_message = message;
        -:  893:      /* Client should also have gotten ServiceAcquired */
        -:  894:
     3348:  895:      message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     3348:  896:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -:  897:        {
    #####:  898:          _dbus_warn ("Expecting %s, got nothing\n",
call    0 never executed
        -:  899:                      "NameAcquired");
    #####:  900:          goto out;
        -:  901:        }
     3348:  902:      if (! dbus_message_is_signal (message, DBUS_INTERFACE_DBUS,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  903:                                    "NameAcquired"))
        -:  904:        {
    #####:  905:          _dbus_warn ("Expecting %s, got smthg else\n",
call    0 never executed
        -:  906:                      "NameAcquired");
    #####:  907:          goto out;
        -:  908:        }
        -:  909:      
     3348:  910:    retry_get_acquired_name:
     3348:  911:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  912:                                  DBUS_TYPE_STRING, &acquired,
        -:  913:                                  DBUS_TYPE_INVALID))
        -:  914:        {
    #####:  915:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -:  916:            {
    #####:  917:              _dbus_verbose ("no memory to get service name arg from acquired\n");
call    0 never executed
    #####:  918:              dbus_error_free (&error);
call    0 never executed
    #####:  919:              _dbus_wait_for_memory ();
call    0 never executed
    #####:  920:              goto retry_get_acquired_name;
        -:  921:            }
        -:  922:          else
        -:  923:            {
    #####:  924:              _dbus_assert (dbus_error_is_set (&error));
call    0 never executed
call    1 never executed
    #####:  925:              _dbus_warn ("Did not get the expected single string argument to ServiceAcquired\n");
call    0 never executed
    #####:  926:              goto out;
        -:  927:            }
        -:  928:        }
        -:  929:
     3348:  930:      _dbus_verbose ("Got acquired name: %s\n", acquired);
call    0 returned 100%
        -:  931:
     3348:  932:      if (strcmp (acquired, name) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  933:        {
    #####:  934:          _dbus_warn ("Acquired name is %s but expected %s\n",
call    0 never executed
        -:  935:                      acquired, name);
    #####:  936:          goto out;
        -:  937:        }
     3348:  938:      acquired = NULL;
        -:  939:    }
        -:  940:
     3844:  941:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  942:    goto out;
        -:  943:  
     3844:  944:  retval = TRUE;
        -:  945:  
     3844:  946: out:
     3844:  947:  _dbus_verbose ("ending %s retval = %d\n", _DBUS_FUNCTION_NAME, retval);
call    0 returned 100%
        -:  948:  
     3844:  949:  dbus_error_free (&error);
call    0 returned 100%
        -:  950:  
     3844:  951:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     3844:  952:    dbus_message_unref (message);
call    0 returned 100%
        -:  953:
     3844:  954:  if (name_message)
branch  0 taken 87% (fallthrough)
branch  1 taken 13%
     3348:  955:    dbus_message_unref (name_message);
call    0 returned 100%
        -:  956:  
     3844:  957:  return retval;
        -:  958:}
        -:  959:
        -:  960:/* returns TRUE if the correct thing happens,
        -:  961: * but the correct thing may include OOM errors.
        -:  962: */
        -:  963:static dbus_bool_t
        -:  964:check_double_hello_message (BusContext     *context,
        -:  965:                            DBusConnection *connection)
function check_double_hello_message called 1 returned 100% blocks executed 62%
        1:  966:{
        -:  967:  DBusMessage *message;
        -:  968:  dbus_uint32_t serial;
        -:  969:  dbus_bool_t retval;
        -:  970:  DBusError error;
        -:  971:
        1:  972:  retval = FALSE;
        1:  973:  dbus_error_init (&error);
call    0 returned 100%
        1:  974:  message = NULL;
        -:  975:
        1:  976:  _dbus_verbose ("check_double_hello_message for %p\n", connection);
call    0 returned 100%
        -:  977:  
        1:  978:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -:  979:                                          DBUS_PATH_DBUS,
        -:  980:                                          DBUS_INTERFACE_DBUS,
        -:  981:                                          "Hello");
        -:  982:
        1:  983:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:  984:    return TRUE;
        -:  985:  
        1:  986:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  987:    {
    #####:  988:      dbus_message_unref (message);
call    0 never executed
    #####:  989:      return TRUE;
        -:  990:    }
        -:  991:
        1:  992:  dbus_message_unref (message);
call    0 returned 100%
        1:  993:  message = NULL;
        -:  994:
        -:  995:  /* send our message */
        1:  996:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -:  997:
        1:  998:  dbus_connection_ref (connection); /* because we may get disconnected */
call    0 returned 100%
        1:  999:  block_connection_until_message_from_bus (context, connection, "reply to Hello");
call    0 returned 100%
        -: 1000:
        1: 1001:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1002:    {
    #####: 1003:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
        -: 1004:      
    #####: 1005:      dbus_connection_unref (connection);
call    0 never executed
        -: 1006:      
    #####: 1007:      return TRUE;
        -: 1008:    }
        -: 1009:
        1: 1010:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 1011:  
        1: 1012:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 1013:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1014:    {
    #####: 1015:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1016:                  "Hello", serial, connection);
    #####: 1017:      goto out;
        -: 1018:    }
        -: 1019:
        1: 1020:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1021:
        1: 1022:  if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1023:    {
    #####: 1024:      _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 1025:                  dbus_message_get_sender (message) ?
        -: 1026:                  dbus_message_get_sender (message) : "(none)");
    #####: 1027:      goto out;
        -: 1028:    }
        -: 1029:  
        1: 1030:  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1031:    {
    #####: 1032:      warn_unexpected (connection, message, "method return for Hello");
call    0 never executed
    #####: 1033:      goto out;
        -: 1034:    }
        -: 1035:
        1: 1036:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1037:    goto out;
        -: 1038:  
        1: 1039:  retval = TRUE;
        -: 1040:  
        1: 1041: out:
        1: 1042:  dbus_error_free (&error);
call    0 returned 100%
        -: 1043:  
        1: 1044:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1: 1045:    dbus_message_unref (message);
call    0 returned 100%
        -: 1046:  
        1: 1047:  return retval;
        -: 1048:}
        -: 1049:
        -: 1050:/* returns TRUE if the correct thing happens,
        -: 1051: * but the correct thing may include OOM errors.
        -: 1052: */
        -: 1053:static dbus_bool_t
        -: 1054:check_get_connection_unix_user (BusContext     *context,
        -: 1055:                                DBusConnection *connection)
function check_get_connection_unix_user called 1 returned 100% blocks executed 55%
        1: 1056:{
        -: 1057:  DBusMessage *message;
        -: 1058:  dbus_uint32_t serial;
        -: 1059:  dbus_bool_t retval;
        -: 1060:  DBusError error;
        -: 1061:  const char *base_service_name;
        -: 1062:  dbus_uint32_t uid;
        -: 1063:
        1: 1064:  retval = FALSE;
        1: 1065:  dbus_error_init (&error);
call    0 returned 100%
        1: 1066:  message = NULL;
        -: 1067:
        1: 1068:  _dbus_verbose ("check_get_connection_unix_user for %p\n", connection);
call    0 returned 100%
        -: 1069:  
        1: 1070:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 1071:                                          DBUS_PATH_DBUS,
        -: 1072:                                          DBUS_INTERFACE_DBUS,
        -: 1073:                                          "GetConnectionUnixUser");
        -: 1074:
        1: 1075:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1076:    return TRUE;
        -: 1077:
        1: 1078:  base_service_name = dbus_bus_get_unique_name (connection);
call    0 returned 100%
        -: 1079:
        1: 1080:  if (!dbus_message_append_args (message, 
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1081:                                 DBUS_TYPE_STRING, &base_service_name,
        -: 1082:                                 DBUS_TYPE_INVALID))
        -: 1083:    {
    #####: 1084:      dbus_message_unref (message);
call    0 never executed
    #####: 1085:      return TRUE;
        -: 1086:    }
        -: 1087:
        1: 1088:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1089:    {
    #####: 1090:      dbus_message_unref (message);
call    0 never executed
    #####: 1091:      return TRUE;
        -: 1092:    }
        -: 1093:
        -: 1094:  /* send our message */
        1: 1095:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -: 1096:
        1: 1097:  dbus_message_unref (message);
call    0 returned 100%
        1: 1098:  message = NULL;
        -: 1099:
        1: 1100:  dbus_connection_ref (connection); /* because we may get disconnected */
call    0 returned 100%
        1: 1101:  block_connection_until_message_from_bus (context, connection, "reply to GetConnectionUnixUser");
call    0 returned 100%
        -: 1102:
        1: 1103:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1104:    {
    #####: 1105:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
        -: 1106:      
    #####: 1107:      dbus_connection_unref (connection);
call    0 never executed
        -: 1108:      
    #####: 1109:      return TRUE;
        -: 1110:    }
        -: 1111:
        1: 1112:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 1113:
        1: 1114:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 1115:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1116:    {
    #####: 1117:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1118:                  "GetConnectionUnixUser", serial, connection);
    #####: 1119:      goto out;
        -: 1120:    }
        -: 1121:
        1: 1122:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1123:
        1: 1124:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1125:    {
    #####: 1126:      if (dbus_message_is_error (message, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1127:        {
        -: 1128:          ; /* good, this is a valid response */
        -: 1129:        }
        -: 1130:      else
        -: 1131:        {
    #####: 1132:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 1133:
    #####: 1134:          goto out;
        -: 1135:        }
        -: 1136:    }
        -: 1137:  else
        -: 1138:    {
        1: 1139:      if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1140:        {
        -: 1141:          ; /* good, expected */
        -: 1142:        }
        -: 1143:      else
        -: 1144:        {
    #####: 1145:          warn_unexpected (connection, message,
call    0 never executed
        -: 1146:                           "method_return for GetConnectionUnixUser");
        -: 1147:
    #####: 1148:          goto out;
        -: 1149:        }
        -: 1150:
        1: 1151:    retry_get_property:
        -: 1152:
        1: 1153:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1154:                                  DBUS_TYPE_UINT32, &uid,
        -: 1155:                                  DBUS_TYPE_INVALID))
        -: 1156:        {
    #####: 1157:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1158:            {
    #####: 1159:              _dbus_verbose ("no memory to get uid by GetConnectionUnixUser\n");
call    0 never executed
    #####: 1160:              dbus_error_free (&error);
call    0 never executed
    #####: 1161:              _dbus_wait_for_memory ();
call    0 never executed
    #####: 1162:              goto retry_get_property;
        -: 1163:            }
        -: 1164:          else
        -: 1165:            {
    #####: 1166:              _dbus_assert (dbus_error_is_set (&error));
call    0 never executed
call    1 never executed
    #####: 1167:              _dbus_warn ("Did not get the expected DBUS_TYPE_UINT32 from GetConnectionUnixUser\n");
call    0 never executed
    #####: 1168:              goto out;
        -: 1169:            }
        -: 1170:        }
        -: 1171:    }
        -: 1172:
        1: 1173:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1174:    goto out;
        -: 1175:
        1: 1176:  retval = TRUE;
        -: 1177:
        1: 1178: out:
        1: 1179:  dbus_error_free (&error);
call    0 returned 100%
        -: 1180:  
        1: 1181:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1: 1182:    dbus_message_unref (message);
call    0 returned 100%
        -: 1183:  
        1: 1184:  return retval;
        -: 1185:}
        -: 1186:
        -: 1187:/* returns TRUE if the correct thing happens,
        -: 1188: * but the correct thing may include OOM errors.
        -: 1189: */
        -: 1190:static dbus_bool_t
        -: 1191:check_get_connection_unix_process_id (BusContext     *context,
        -: 1192:                                      DBusConnection *connection)
function check_get_connection_unix_process_id called 1 returned 100% blocks executed 53%
        1: 1193:{
        -: 1194:  DBusMessage *message;
        -: 1195:  dbus_uint32_t serial;
        -: 1196:  dbus_bool_t retval;
        -: 1197:  DBusError error;
        -: 1198:  const char *base_service_name;
        -: 1199:  dbus_uint32_t pid;
        -: 1200:
        1: 1201:  retval = FALSE;
        1: 1202:  dbus_error_init (&error);
call    0 returned 100%
        1: 1203:  message = NULL;
        -: 1204:
        1: 1205:  _dbus_verbose ("check_get_connection_unix_process_id for %p\n", connection);
call    0 returned 100%
        -: 1206:  
        1: 1207:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 1208:                                          DBUS_PATH_DBUS,
        -: 1209:                                          DBUS_INTERFACE_DBUS,
        -: 1210:                                          "GetConnectionUnixProcessID");
        -: 1211:
        1: 1212:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1213:    return TRUE;
        -: 1214:
        1: 1215:  base_service_name = dbus_bus_get_unique_name (connection);
call    0 returned 100%
        -: 1216:
        1: 1217:  if (!dbus_message_append_args (message, 
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1218:                                 DBUS_TYPE_STRING, &base_service_name,
        -: 1219:                                 DBUS_TYPE_INVALID))
        -: 1220:    {
    #####: 1221:      dbus_message_unref (message);
call    0 never executed
    #####: 1222:      return TRUE;
        -: 1223:    }
        -: 1224:
        1: 1225:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1226:    {
    #####: 1227:      dbus_message_unref (message);
call    0 never executed
    #####: 1228:      return TRUE;
        -: 1229:    }
        -: 1230:
        -: 1231:  /* send our message */
        1: 1232:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -: 1233:
        1: 1234:  dbus_message_unref (message);
call    0 returned 100%
        1: 1235:  message = NULL;
        -: 1236:
        1: 1237:  dbus_connection_ref (connection); /* because we may get disconnected */
call    0 returned 100%
        1: 1238:  block_connection_until_message_from_bus (context, connection, "reply to GetConnectionUnixProcessID");
call    0 returned 100%
        -: 1239:
        1: 1240:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1241:    {
    #####: 1242:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
        -: 1243:      
    #####: 1244:      dbus_connection_unref (connection);
call    0 never executed
        -: 1245:      
    #####: 1246:      return TRUE;
        -: 1247:    }
        -: 1248:
        1: 1249:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 1250:
        1: 1251:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 1252:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1253:    {
    #####: 1254:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1255:                  "GetConnectionUnixProcessID", serial, connection);
    #####: 1256:      goto out;
        -: 1257:    }
        -: 1258:
        1: 1259:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1260:
        1: 1261:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1262:    {
    #####: 1263:      if (dbus_message_is_error (message, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1264:        {
        -: 1265:          ; /* good, this is a valid response */
        -: 1266:        }
        -: 1267:      else
        -: 1268:        {
    #####: 1269:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 1270:
    #####: 1271:          goto out;
        -: 1272:        }
        -: 1273:    }
        -: 1274:  else
        -: 1275:    {
        1: 1276:      if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1277:        {
        -: 1278:          ; /* good, expected */
        -: 1279:        }
        -: 1280:      else
        -: 1281:        {
    #####: 1282:          warn_unexpected (connection, message,
call    0 never executed
        -: 1283:                           "method_return for GetConnectionUnixProcessID");
        -: 1284:
    #####: 1285:          goto out;
        -: 1286:        }
        -: 1287:
        1: 1288:    retry_get_property:
        -: 1289:
        1: 1290:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1291:                                  DBUS_TYPE_UINT32, &pid,
        -: 1292:                                  DBUS_TYPE_INVALID))
        -: 1293:        {
    #####: 1294:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1295:            {
    #####: 1296:              _dbus_verbose ("no memory to get pid by GetConnectionUnixProcessID\n");
call    0 never executed
    #####: 1297:              dbus_error_free (&error);
call    0 never executed
    #####: 1298:              _dbus_wait_for_memory ();
call    0 never executed
    #####: 1299:              goto retry_get_property;
        -: 1300:            }
        -: 1301:          else
        -: 1302:            {
    #####: 1303:              _dbus_assert (dbus_error_is_set (&error));
call    0 never executed
call    1 never executed
    #####: 1304:              _dbus_warn ("Did not get the expected DBUS_TYPE_UINT32 from GetConnectionUnixProcessID\n");
call    0 never executed
    #####: 1305:              goto out;
        -: 1306:            }
        -: 1307:        } else {
        -: 1308:
        -: 1309:          /* test if returned pid is the same as our own pid
        -: 1310:           *
        -: 1311:           * @todo It would probably be good to restructure the tests
        -: 1312:           *       in a way so our parent is the bus that we're testing
        -: 1313:           *       cause then we can test that the pid returned matches
        -: 1314:           *       getppid()
        -: 1315:           */
        1: 1316:          if (pid != (dbus_uint32_t) _dbus_getpid ())
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1317:            {
    #####: 1318:              _dbus_assert (dbus_error_is_set (&error));
call    0 never executed
call    1 never executed
    #####: 1319:              _dbus_warn ("Result from GetConnectionUnixProcessID is not our own pid\n");
call    0 never executed
    #####: 1320:              goto out;
        -: 1321:            }
        -: 1322:        }
        -: 1323:    }
        -: 1324:
        1: 1325:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1326:    goto out;
        -: 1327:
        1: 1328:  retval = TRUE;
        -: 1329:
        1: 1330: out:
        1: 1331:  dbus_error_free (&error);
call    0 returned 100%
        -: 1332:  
        1: 1333:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1: 1334:    dbus_message_unref (message);
call    0 returned 100%
        -: 1335:  
        1: 1336:  return retval;
        -: 1337:}
        -: 1338:
        -: 1339:/* returns TRUE if the correct thing happens,
        -: 1340: * but the correct thing may include OOM errors.
        -: 1341: */
        -: 1342:static dbus_bool_t
        -: 1343:check_add_match_all (BusContext     *context,
        -: 1344:                     DBusConnection *connection)
function check_add_match_all called 3348 returned 100% blocks executed 68%
     3348: 1345:{
        -: 1346:  DBusMessage *message;
        -: 1347:  dbus_bool_t retval;
        -: 1348:  dbus_uint32_t serial;
        -: 1349:  DBusError error;
     3348: 1350:  const char *empty = "";
        -: 1351:
     3348: 1352:  retval = FALSE;
     3348: 1353:  dbus_error_init (&error);
call    0 returned 100%
     3348: 1354:  message = NULL;
        -: 1355:
     3348: 1356:  _dbus_verbose ("check_add_match_all for %p\n", connection);
call    0 returned 100%
        -: 1357:  
     3348: 1358:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 1359:                                          DBUS_PATH_DBUS,
        -: 1360:                                          DBUS_INTERFACE_DBUS,
        -: 1361:                                          "AddMatch");
        -: 1362:
     3348: 1363:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1364:    return TRUE;
        -: 1365:
        -: 1366:  /* empty string match rule matches everything */
     3348: 1367:  if (!dbus_message_append_args (message, DBUS_TYPE_STRING, &empty,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1368:                                 DBUS_TYPE_INVALID))
        -: 1369:    {
        8: 1370:      dbus_message_unref (message);
call    0 returned 100%
        8: 1371:      return TRUE;
        -: 1372:    }
        -: 1373:  
     3340: 1374:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1375:    {
        4: 1376:      dbus_message_unref (message);
call    0 returned 100%
        4: 1377:      return TRUE;
        -: 1378:    }
        -: 1379:
     3336: 1380:  dbus_message_unref (message);
call    0 returned 100%
     3336: 1381:  message = NULL;
        -: 1382:
     3336: 1383:  dbus_connection_ref (connection); /* because we may get disconnected */
call    0 returned 100%
        -: 1384:  
        -: 1385:  /* send our message */
     3336: 1386:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -: 1387:
     3336: 1388:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1389:    {
    #####: 1390:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
        -: 1391:      
    #####: 1392:      dbus_connection_unref (connection);
call    0 never executed
        -: 1393:      
    #####: 1394:      return TRUE;
        -: 1395:    }
        -: 1396:  
     3336: 1397:  block_connection_until_message_from_bus (context, connection, "reply to AddMatch");
call    0 returned 100%
        -: 1398:
     3336: 1399:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1400:    {
    #####: 1401:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
        -: 1402:      
    #####: 1403:      dbus_connection_unref (connection);
call    0 never executed
        -: 1404:      
    #####: 1405:      return TRUE;
        -: 1406:    }
        -: 1407:
     3336: 1408:  dbus_connection_unref (connection);
call    0 returned 100%
        -: 1409:  
     3336: 1410:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     3336: 1411:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1412:    {
    #####: 1413:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1414:                  "AddMatch", serial, connection);
    #####: 1415:      goto out;
        -: 1416:    }
        -: 1417:
     3336: 1418:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1419:
     3336: 1420:  if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1421:    {
    #####: 1422:      _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 1423:                  dbus_message_get_sender (message) ?
        -: 1424:                  dbus_message_get_sender (message) : "(none)");
    #####: 1425:      goto out;
        -: 1426:    }
        -: 1427:  
     3336: 1428:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 3% (fallthrough)
branch  2 taken 97%
        -: 1429:    {
       94: 1430:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1431:                                 DBUS_ERROR_NO_MEMORY))
        -: 1432:        {
        -: 1433:          ; /* good, this is a valid response */
        -: 1434:        }
        -: 1435:      else
        -: 1436:        {
    #####: 1437:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 1438:
    #####: 1439:          goto out;
        -: 1440:        }
        -: 1441:    }
        -: 1442:  else
        -: 1443:    {
     3242: 1444:      if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 1445:        {
        -: 1446:          ; /* good, expected */
     3242: 1447:          _dbus_assert (dbus_message_get_reply_serial (message) == serial);
call    0 returned 100%
call    1 returned 100%
        -: 1448:        }
        -: 1449:      else
        -: 1450:        {
    #####: 1451:          warn_unexpected (connection, message, "method return for AddMatch");
call    0 never executed
        -: 1452:
    #####: 1453:          goto out;
        -: 1454:        }
        -: 1455:    }
        -: 1456:
     3336: 1457:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1458:    goto out;
        -: 1459:  
     3336: 1460:  retval = TRUE;
        -: 1461:  
     3336: 1462: out:
     3336: 1463:  dbus_error_free (&error);
call    0 returned 100%
        -: 1464:  
     3336: 1465:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     3336: 1466:    dbus_message_unref (message);
call    0 returned 100%
        -: 1467:  
     3336: 1468:  return retval;
        -: 1469:}
        -: 1470:
        -: 1471:/* returns TRUE if the correct thing happens,
        -: 1472: * but the correct thing may include OOM errors.
        -: 1473: */
        -: 1474:static dbus_bool_t
        -: 1475:check_hello_connection (BusContext *context)
function check_hello_connection called 6053 returned 100% blocks executed 92%
     6053: 1476:{
        -: 1477:  DBusConnection *connection;
        -: 1478:  DBusError error;
        -: 1479:
     6053: 1480:  dbus_error_init (&error);
call    0 returned 100%
        -: 1481:
     6053: 1482:  connection = dbus_connection_open ("debug-pipe:name=test-server", &error);
call    0 returned 100%
     6053: 1483:  if (connection == NULL)
branch  0 taken 10% (fallthrough)
branch  1 taken 90%
        -: 1484:    {
      634: 1485:      _DBUS_ASSERT_ERROR_IS_SET (&error);
call    0 returned 100%
call    1 returned 100%
      634: 1486:      dbus_error_free (&error);
call    0 returned 100%
      634: 1487:      return TRUE;
        -: 1488:    }
        -: 1489:
     5419: 1490:  if (!bus_setup_debug_client (connection))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1491:    {
       24: 1492:      dbus_connection_close (connection);
call    0 returned 100%
       24: 1493:      dbus_connection_unref (connection);
call    0 returned 100%
       24: 1494:      return TRUE;
        -: 1495:    }
        -: 1496:
     5395: 1497:  spin_connection_until_authenticated (context, connection);
call    0 returned 100%
        -: 1498:  
     5395: 1499:  if (!check_hello_message (context, connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1500:    return FALSE;
        -: 1501:  
     5395: 1502:  if (dbus_bus_get_unique_name (connection) == NULL)
call    0 returned 100%
branch  1 taken 38% (fallthrough)
branch  2 taken 62%
        -: 1503:    {
        -: 1504:      /* We didn't successfully register, so we can't
        -: 1505:       * do the usual kill_client_connection() checks
        -: 1506:       */
     2051: 1507:      kill_client_connection_unchecked (connection);
call    0 returned 100%
        -: 1508:    }
        -: 1509:  else
        -: 1510:    {
     3344: 1511:      if (!check_add_match_all (context, connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 1512:        return FALSE;
        -: 1513:      
     3344: 1514:      kill_client_connection (context, connection);
call    0 returned 100%
        -: 1515:    }
        -: 1516:
     5395: 1517:  return TRUE;
        -: 1518:}
        -: 1519:
        -: 1520:#define NONEXISTENT_SERVICE_NAME "test.this.service.does.not.exist.ewuoiurjdfxcvn"
        -: 1521:
        -: 1522:/* returns TRUE if the correct thing happens,
        -: 1523: * but the correct thing may include OOM errors.
        -: 1524: */
        -: 1525:static dbus_bool_t
        -: 1526:check_nonexistent_service_no_auto_start (BusContext     *context,
        -: 1527:                                         DBusConnection *connection)
function check_nonexistent_service_no_auto_start called 334 returned 100% blocks executed 67%
      334: 1528:{
        -: 1529:  DBusMessage *message;
        -: 1530:  dbus_uint32_t serial;
        -: 1531:  dbus_bool_t retval;
      334: 1532:  const char *nonexistent = NONEXISTENT_SERVICE_NAME;
        -: 1533:  dbus_uint32_t flags;
        -: 1534:  
      334: 1535:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 1536:                                          DBUS_PATH_DBUS,
        -: 1537:                                          DBUS_INTERFACE_DBUS,
        -: 1538:                                          "StartServiceByName");
        -: 1539:  
      334: 1540:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1541:    return TRUE;
        -: 1542:
      334: 1543:  dbus_message_set_auto_start (message, FALSE);
call    0 returned 100%
        -: 1544:  
      334: 1545:  flags = 0;
      334: 1546:  if (!dbus_message_append_args (message,
call    0 returned 100%
branch  1 taken 9% (fallthrough)
branch  2 taken 91%
        -: 1547:                                 DBUS_TYPE_STRING, &nonexistent,
        -: 1548:                                 DBUS_TYPE_UINT32, &flags,
        -: 1549:                                 DBUS_TYPE_INVALID))
        -: 1550:    {
       30: 1551:      dbus_message_unref (message);
call    0 returned 100%
       30: 1552:      return TRUE;
        -: 1553:    }
        -: 1554:  
      304: 1555:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1556:    {
        3: 1557:      dbus_message_unref (message);
call    0 returned 100%
        3: 1558:      return TRUE;
        -: 1559:    }
        -: 1560:
      301: 1561:  dbus_message_unref (message);
call    0 returned 100%
      301: 1562:  message = NULL;
        -: 1563:
      301: 1564:  bus_test_run_everything (context);
call    0 returned 100%
      301: 1565:  block_connection_until_message_from_bus (context, connection, "reply to ActivateService on nonexistent");
call    0 returned 100%
      301: 1566:  bus_test_run_everything (context);
call    0 returned 100%
        -: 1567:
      301: 1568:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1569:    {
    #####: 1570:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 1571:      return TRUE;
        -: 1572:    }
        -: 1573:  
      301: 1574:  retval = FALSE;
        -: 1575:  
      301: 1576:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
      301: 1577:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1578:    {
    #####: 1579:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1580:                  "StartServiceByName", serial, connection);
    #####: 1581:      goto out;
        -: 1582:    }
        -: 1583:
      301: 1584:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1585:
      301: 1586:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 1587:    {
      301: 1588:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1589:        {
    #####: 1590:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 1591:                      dbus_message_get_sender (message) ?
        -: 1592:                      dbus_message_get_sender (message) : "(none)");
    #####: 1593:          goto out;
        -: 1594:        }
        -: 1595:      
      301: 1596:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 47% (fallthrough)
branch  2 taken 53%
        -: 1597:                                 DBUS_ERROR_NO_MEMORY))
        -: 1598:        {
        -: 1599:          ; /* good, this is a valid response */
        -: 1600:        }
      142: 1601:      else if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1602:                                      DBUS_ERROR_SERVICE_UNKNOWN))
        -: 1603:        {
        -: 1604:          ; /* good, this is expected also */
        -: 1605:        }
        -: 1606:      else
        -: 1607:        {
    #####: 1608:          warn_unexpected (connection, message, "not this error");
call    0 never executed
    #####: 1609:          goto out;
        -: 1610:        }
        -: 1611:    }
        -: 1612:  else
        -: 1613:    {
    #####: 1614:      _dbus_warn ("Did not expect to successfully activate %s\n",
call    0 never executed
        -: 1615:                  NONEXISTENT_SERVICE_NAME);
    #####: 1616:      goto out;
        -: 1617:    }
        -: 1618:
      301: 1619:  retval = TRUE;
        -: 1620:  
      301: 1621: out:
      301: 1622:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      301: 1623:    dbus_message_unref (message);
call    0 returned 100%
        -: 1624:  
      301: 1625:  return retval;
        -: 1626:}
        -: 1627:
        -: 1628:/* returns TRUE if the correct thing happens,
        -: 1629: * but the correct thing may include OOM errors.
        -: 1630: */
        -: 1631:static dbus_bool_t
        -: 1632:check_nonexistent_service_auto_start (BusContext     *context,
        -: 1633:                                      DBusConnection *connection)
function check_nonexistent_service_auto_start called 283 returned 100% blocks executed 64%
      283: 1634:{
        -: 1635:  DBusMessage *message;
        -: 1636:  dbus_uint32_t serial;
        -: 1637:  dbus_bool_t retval;
        -: 1638:    
      283: 1639:  message = dbus_message_new_method_call (NONEXISTENT_SERVICE_NAME,
call    0 returned 100%
        -: 1640:                                          "/org/freedesktop/TestSuite",
        -: 1641:                                          "org.freedesktop.TestSuite",
        -: 1642:                                          "Echo");
        -: 1643:  
      283: 1644:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1645:    return TRUE;
        -: 1646: 
      283: 1647:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 1648:    {
        3: 1649:      dbus_message_unref (message);
call    0 returned 100%
        3: 1650:      return TRUE;
        -: 1651:    }
        -: 1652:
      280: 1653:  dbus_message_unref (message);
call    0 returned 100%
      280: 1654:  message = NULL;
        -: 1655:
      280: 1656:  bus_test_run_everything (context);
call    0 returned 100%
      280: 1657:  block_connection_until_message_from_bus (context, connection, "reply to Echo");
call    0 returned 100%
      280: 1658:  bus_test_run_everything (context);
call    0 returned 100%
        -: 1659:
      280: 1660:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1661:    {
    #####: 1662:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 1663:      return TRUE;
        -: 1664:    }
        -: 1665:  
      280: 1666:  retval = FALSE;
        -: 1667:  
      280: 1668:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        -: 1669:
      280: 1670:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1671:    {
    #####: 1672:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 1673:                  "Echo message (auto activation)", serial, connection);
    #####: 1674:      goto out;
        -: 1675:    }
        -: 1676:
      280: 1677:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 1678:
      280: 1679:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 1680:    {
      280: 1681:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1682:        {
    #####: 1683:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 1684:                      dbus_message_get_sender (message) ?
        -: 1685:                      dbus_message_get_sender (message) : "(none)");
    #####: 1686:          goto out;
        -: 1687:        }
        -: 1688:      
      280: 1689:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 43% (fallthrough)
branch  2 taken 57%
        -: 1690:                                 DBUS_ERROR_NO_MEMORY))
        -: 1691:        {
        -: 1692:          ; /* good, this is a valid response */
        -: 1693:        }
      121: 1694:      else if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1695:                                      DBUS_ERROR_SERVICE_UNKNOWN))
        -: 1696:        {
        -: 1697:          ; /* good, this is expected also */
        -: 1698:        }
        -: 1699:      else
        -: 1700:        {
    #####: 1701:          warn_unexpected (connection, message, "not this error");
call    0 never executed
    #####: 1702:          goto out;
        -: 1703:        }
        -: 1704:    }
        -: 1705:  else
        -: 1706:    {
    #####: 1707:      _dbus_warn ("Did not expect to successfully activate %s\n",
call    0 never executed
        -: 1708:                  NONEXISTENT_SERVICE_NAME);
    #####: 1709:      goto out;
        -: 1710:    }
        -: 1711:
      280: 1712:  retval = TRUE;
        -: 1713:  
      280: 1714: out:
      280: 1715:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      280: 1716:    dbus_message_unref (message);
call    0 returned 100%
        -: 1717:  
      280: 1718:  return retval;
        -: 1719:}
        -: 1720:
        -: 1721:static dbus_bool_t
        -: 1722:check_base_service_activated (BusContext     *context,
        -: 1723:                              DBusConnection *connection,
        -: 1724:                              DBusMessage    *initial_message,
        -: 1725:                              const char    **base_service_p)
function check_base_service_activated called 1954 returned 100% blocks executed 54%
     1954: 1726:{
        -: 1727:  DBusMessage *message;
        -: 1728:  dbus_bool_t retval;
        -: 1729:  DBusError error;
        -: 1730:  const char *base_service, *base_service_from_bus, *old_owner;
        -: 1731:  
     1954: 1732:  retval = FALSE;
        -: 1733:  
     1954: 1734:  dbus_error_init (&error);
call    0 returned 100%
     1954: 1735:  base_service = NULL;
     1954: 1736:  old_owner = NULL;
     1954: 1737:  base_service_from_bus = NULL;
        -: 1738:
     1954: 1739:  message = initial_message;
     1954: 1740:  dbus_message_ref (message);  
call    0 returned 100%
        -: 1741:
     1954: 1742:  if (dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 1743:                              DBUS_INTERFACE_DBUS,
        -: 1744:                              "NameOwnerChanged"))
        -: 1745:    {
        -: 1746:      CheckServiceOwnerChangedData socd;
        -: 1747:
     1954: 1748:    reget_service_name_arg:
     1954: 1749:      base_service = NULL;
     1954: 1750:      old_owner = NULL;
     1954: 1751:      base_service_from_bus = NULL;
        -: 1752:
     1954: 1753:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1754:                                  DBUS_TYPE_STRING, &base_service,
        -: 1755:                                  DBUS_TYPE_STRING, &old_owner,
        -: 1756:                                  DBUS_TYPE_STRING, &base_service_from_bus,
        -: 1757:                                  DBUS_TYPE_INVALID))
        -: 1758:        {
    #####: 1759:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1760:            {
    #####: 1761:              dbus_error_free (&error);
call    0 never executed
    #####: 1762:              _dbus_wait_for_memory ();
call    0 never executed
    #####: 1763:              goto reget_service_name_arg;
        -: 1764:            }
        -: 1765:          else
        -: 1766:            {
    #####: 1767:              _dbus_warn ("Message %s doesn't have a service name: %s\n",
call    0 never executed
        -: 1768:                          "NameOwnerChanged (creation)",
        -: 1769:                          error.message);
    #####: 1770:              goto out;
        -: 1771:            }
        -: 1772:        }
        -: 1773:
     1954: 1774:      if (*base_service != ':')
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1775:        {
    #####: 1776:          _dbus_warn ("Expected base service activation, got \"%s\" instead\n",
call    0 never executed
        -: 1777:                      base_service);
    #####: 1778:          goto out;
        -: 1779:        }
        -: 1780:         
     1954: 1781:      if (strcmp (base_service, base_service_from_bus) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1782:        {
    #####: 1783:          _dbus_warn ("Expected base service activation, got \"%s\" instead with owner \"%s\"\n",
call    0 never executed
        -: 1784:                      base_service, base_service_from_bus);
    #####: 1785:          goto out;
        -: 1786:        }
        -: 1787:
     1954: 1788:      if (old_owner[0])
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1789:        {
    #####: 1790:          _dbus_warn ("Received an old_owner argument during base service activation, \"%s\"\n",
call    0 never executed
        -: 1791:                      old_owner);
    #####: 1792:          goto out;
        -: 1793:        }
        -: 1794:     
     1954: 1795:      socd.expected_kind = SERVICE_CREATED;
     1954: 1796:      socd.expected_service_name = base_service;
     1954: 1797:      socd.failed = FALSE;
     1954: 1798:      socd.skip_connection = connection;
     1954: 1799:      bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 1800:                                &socd);
        -: 1801:      
     1954: 1802:      if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1803:        goto out;
        -: 1804:    }
        -: 1805:  else
        -: 1806:    {
    #####: 1807:      warn_unexpected (connection, message, "NameOwnerChanged (creation) for base service");
call    0 never executed
        -: 1808:
    #####: 1809:      goto out;
        -: 1810:    }
        -: 1811:
     1954: 1812:  if (base_service_p)
branch  0 taken 100%
branch  1 taken 0%
     1954: 1813:    *base_service_p = base_service;
        -: 1814:
     1954: 1815:  retval = TRUE;
        -: 1816:  
     1954: 1817: out:
     1954: 1818:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1954: 1819:    dbus_message_unref (message);
call    0 returned 100%
     1954: 1820:  dbus_error_free (&error);
call    0 returned 100%
        -: 1821:
     1954: 1822:  return retval;
        -: 1823:}
        -: 1824:
        -: 1825:static dbus_bool_t
        -: 1826:check_service_activated (BusContext     *context,
        -: 1827:                         DBusConnection *connection,
        -: 1828:                         const char     *activated_name,
        -: 1829:                         const char     *base_service_name,
        -: 1830:                         DBusMessage    *initial_message)
function check_service_activated called 1536 returned 100% blocks executed 47%
     1536: 1831:{
        -: 1832:  DBusMessage *message;
        -: 1833:  dbus_bool_t retval;
        -: 1834:  DBusError error;
        -: 1835:  dbus_uint32_t activation_result;
        -: 1836:  
     1536: 1837:  retval = FALSE;
        -: 1838:  
     1536: 1839:  dbus_error_init (&error);
call    0 returned 100%
        -: 1840:
     1536: 1841:  message = initial_message;
     1536: 1842:  dbus_message_ref (message);
call    0 returned 100%
        -: 1843:
     1536: 1844:  if (dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 1845:                              DBUS_INTERFACE_DBUS,
        -: 1846:                              "NameOwnerChanged"))
        -: 1847:    {
        -: 1848:      CheckServiceOwnerChangedData socd;
        -: 1849:      const char *service_name, *base_service_from_bus, *old_owner;
        -: 1850:
     1536: 1851:    reget_service_name_arg:
     1536: 1852:      service_name = NULL;
     1536: 1853:      old_owner = NULL;
     1536: 1854:      base_service_from_bus = NULL;
        -: 1855:
     1536: 1856:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1857:                                  DBUS_TYPE_STRING, &service_name,
        -: 1858:                                   DBUS_TYPE_STRING, &old_owner,
        -: 1859:                                  DBUS_TYPE_STRING, &base_service_from_bus,
        -: 1860:                                  DBUS_TYPE_INVALID))
        -: 1861:        {
    #####: 1862:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1863:            {
    #####: 1864:              dbus_error_free (&error);
call    0 never executed
    #####: 1865:              _dbus_wait_for_memory ();
call    0 never executed
    #####: 1866:              goto reget_service_name_arg;
        -: 1867:            }
        -: 1868:          else
        -: 1869:            {
    #####: 1870:              _dbus_warn ("Message %s doesn't have a service name: %s\n",
call    0 never executed
        -: 1871:                          "NameOwnerChanged (creation)",
        -: 1872:                          error.message);
    #####: 1873:              goto out;
        -: 1874:            }
        -: 1875:        }
        -: 1876:
     1536: 1877:      if (strcmp (service_name, activated_name) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1878:        {
    #####: 1879:          _dbus_warn ("Expected to see service %s created, saw %s instead\n",
call    0 never executed
        -: 1880:                      activated_name, service_name);
    #####: 1881:          goto out;
        -: 1882:        }
        -: 1883:
     1536: 1884:      if (strcmp (base_service_name, base_service_from_bus) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1885:        {
    #####: 1886:          _dbus_warn ("NameOwnerChanged reports wrong base service: %s owner, expected %s instead\n",
call    0 never executed
        -: 1887:                      base_service_from_bus, base_service_name);
    #####: 1888:          goto out;
        -: 1889:        }
        -: 1890:
     1536: 1891:      if (old_owner[0])
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1892:        {
    #####: 1893:          _dbus_warn ("expected a %s, got a %s\n",
call    0 never executed
        -: 1894:                      "NameOwnerChanged (creation)",
        -: 1895:                      "NameOwnerChanged (change)");
    #####: 1896:          goto out;
        -: 1897:        }
        -: 1898:
     1536: 1899:      socd.expected_kind = SERVICE_CREATED;
     1536: 1900:      socd.skip_connection = connection;
     1536: 1901:      socd.failed = FALSE;
     1536: 1902:      socd.expected_service_name = service_name;
     1536: 1903:      bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 1904:                                &socd);
        -: 1905:          
     1536: 1906:      if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1907:        goto out;
        -: 1908:          
     1536: 1909:      dbus_message_unref (message);
call    0 returned 100%
     1536: 1910:      service_name = NULL;
     1536: 1911:      old_owner = NULL;
     1536: 1912:      base_service_from_bus = NULL;
        -: 1913:      
     1536: 1914:      message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     1536: 1915:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1916:        {
    #####: 1917:          _dbus_warn ("Expected a reply to %s, got nothing\n",
call    0 never executed
        -: 1918:                      "StartServiceByName");
    #####: 1919:          goto out;
        -: 1920:        }
        -: 1921:    }
        -: 1922:  else
        -: 1923:    {
    #####: 1924:      warn_unexpected (connection, message, "NameOwnerChanged for the activated name");
call    0 never executed
        -: 1925:      
    #####: 1926:      goto out;
        -: 1927:    }
        -: 1928:  
     1536: 1929:  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 0%
branch  2 taken 100%
        -: 1930:    {
    #####: 1931:      warn_unexpected (connection, message, "reply to StartServiceByName");
call    0 never executed
        -: 1932:
    #####: 1933:      goto out;
        -: 1934:    }
        -: 1935:
     1536: 1936:  activation_result = 0;
     1536: 1937:  if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1938:                              DBUS_TYPE_UINT32, &activation_result,
        -: 1939:                              DBUS_TYPE_INVALID))
        -: 1940:    {
    #####: 1941:      if (!dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 1942:        {
    #####: 1943:          _dbus_warn ("Did not have activation result first argument to %s: %s\n",
call    0 never executed
        -: 1944:                      "StartServiceByName", error.message);
    #####: 1945:          goto out;
        -: 1946:        }
        -: 1947:
    #####: 1948:      dbus_error_free (&error);
call    0 never executed
        -: 1949:    }
        -: 1950:  else
        -: 1951:    {
     1536: 1952:      if (activation_result == DBUS_START_REPLY_SUCCESS)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 1953:        ; /* Good */
    #####: 1954:      else if (activation_result == DBUS_START_REPLY_ALREADY_RUNNING)
branch  0 never executed
branch  1 never executed
        -: 1955:        ; /* Good also */
        -: 1956:      else
        -: 1957:        {
    #####: 1958:          _dbus_warn ("Activation result was %u, no good.\n",
call    0 never executed
        -: 1959:                      activation_result);
    #####: 1960:          goto out;
        -: 1961:        }
        -: 1962:    }
        -: 1963:
     1536: 1964:  dbus_message_unref (message);
call    0 returned 100%
     1536: 1965:  message = NULL;
        -: 1966:      
     1536: 1967:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 1968:    {
    #####: 1969:      _dbus_warn ("Messages were left over after verifying existent activation results\n");
call    0 never executed
    #####: 1970:      goto out;
        -: 1971:    }
        -: 1972:
     1536: 1973:  retval = TRUE;
        -: 1974:  
     1536: 1975: out:
     1536: 1976:  if (message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 1977:    dbus_message_unref (message);
call    0 never executed
     1536: 1978:  dbus_error_free (&error);
call    0 returned 100%
        -: 1979:  
     1536: 1980:  return retval;
        -: 1981:}
        -: 1982:
        -: 1983:static dbus_bool_t
        -: 1984:check_service_auto_activated (BusContext     *context,
        -: 1985:                              DBusConnection *connection,
        -: 1986:                              const char     *activated_name,
        -: 1987:                              const char     *base_service_name,
        -: 1988:                              DBusMessage    *initial_message)
function check_service_auto_activated called 2 returned 100% blocks executed 50%
        2: 1989:{
        -: 1990:  DBusMessage *message;
        -: 1991:  dbus_bool_t retval;
        -: 1992:  DBusError error;
        -: 1993:  
        2: 1994:  retval = FALSE;
        -: 1995:  
        2: 1996:  dbus_error_init (&error);
call    0 returned 100%
        -: 1997:
        2: 1998:  message = initial_message;
        2: 1999:  dbus_message_ref (message);
call    0 returned 100%
        -: 2000:
        2: 2001:  if (dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2002:                              DBUS_INTERFACE_DBUS,
        -: 2003:                              "NameOwnerChanged"))
        -: 2004:    {
        -: 2005:      const char *service_name;
        -: 2006:      CheckServiceOwnerChangedData socd;
        -: 2007:      
        2: 2008:    reget_service_name_arg:
        2: 2009:      if (!dbus_message_get_args (message, &error,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2010:                                  DBUS_TYPE_STRING, &service_name,
        -: 2011:                                  DBUS_TYPE_INVALID))
        -: 2012:        {
    #####: 2013:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 2014:            {
    #####: 2015:              dbus_error_free (&error);
call    0 never executed
    #####: 2016:              _dbus_wait_for_memory ();
call    0 never executed
    #####: 2017:              goto reget_service_name_arg;
        -: 2018:            }
        -: 2019:          else
        -: 2020:            {
    #####: 2021:              _dbus_warn ("Message %s doesn't have a service name: %s\n",
call    0 never executed
        -: 2022:                          "NameOwnerChanged",
        -: 2023:                          error.message);
    #####: 2024:              dbus_error_free (&error);
call    0 never executed
    #####: 2025:              goto out;
        -: 2026:            }
        -: 2027:        }
        -: 2028:      
        2: 2029:      if (strcmp (service_name, activated_name) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2030:        {
    #####: 2031:          _dbus_warn ("Expected to see service %s created, saw %s instead\n",
call    0 never executed
        -: 2032:                      activated_name, service_name);
    #####: 2033:          goto out;
        -: 2034:        }
        -: 2035:      
        2: 2036:      socd.expected_kind = SERVICE_CREATED;
        2: 2037:      socd.expected_service_name = service_name;
        2: 2038:      socd.failed = FALSE;
        2: 2039:      socd.skip_connection = connection; 
        2: 2040:      bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 2041:                                &socd);
        -: 2042:      
        2: 2043:      if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2044:        goto out;
        -: 2045:      
        -: 2046:      /* Note that this differs from regular activation in that we don't get a
        -: 2047:       * reply to ActivateService here.
        -: 2048:       */
        -: 2049:      
        2: 2050:      dbus_message_unref (message);
call    0 returned 100%
        2: 2051:      message = NULL;
        2: 2052:      service_name = NULL;
        -: 2053:    }
        -: 2054:  else
        -: 2055:    {
    #####: 2056:      warn_unexpected (connection, message, "NameOwnerChanged for the activated name");
call    0 never executed
        -: 2057:      
    #####: 2058:      goto out;
        -: 2059:    }
        -: 2060:  
        2: 2061:  retval = TRUE;
        -: 2062:  
        2: 2063: out:
        2: 2064:  if (message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2065:    dbus_message_unref (message);
call    0 never executed
        -: 2066:  
        2: 2067:  return retval;
        -: 2068:}
        -: 2069:
        -: 2070:static dbus_bool_t
        -: 2071:check_service_deactivated (BusContext     *context,
        -: 2072:                           DBusConnection *connection,
        -: 2073:                           const char     *activated_name,
        -: 2074:                           const char     *base_service)
function check_service_deactivated called 1538 returned 100% blocks executed 75%
     1538: 2075:{
        -: 2076:  dbus_bool_t retval;
        -: 2077:  CheckServiceOwnerChangedData socd;
        -: 2078:
     1538: 2079:  retval = FALSE;
        -: 2080:  
        -: 2081:  /* Now we are expecting ServiceOwnerChanged (deletion) messages for the base
        -: 2082:   * service and the activated_name.  The base service
        -: 2083:   * notification is required to come last.
        -: 2084:   */
     1538: 2085:  socd.expected_kind = SERVICE_DELETED;
     1538: 2086:  socd.expected_service_name = activated_name;
     1538: 2087:  socd.failed = FALSE;
     1538: 2088:  socd.skip_connection = NULL;
     1538: 2089:  bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 2090:                            &socd);      
        -: 2091:
     1538: 2092:  if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2093:    goto out;
        -: 2094:      
     1538: 2095:  socd.expected_kind = SERVICE_DELETED;
     1538: 2096:  socd.expected_service_name = base_service;
     1538: 2097:  socd.failed = FALSE;
     1538: 2098:  socd.skip_connection = NULL;
     1538: 2099:  bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 2100:                            &socd);
        -: 2101:
     1538: 2102:  if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2103:    goto out;
        -: 2104:
     1538: 2105:  retval = TRUE;
        -: 2106:  
     1538: 2107: out:
     1538: 2108:  return retval;
        -: 2109:}
        -: 2110:
        -: 2111:static dbus_bool_t
        -: 2112:check_send_exit_to_service (BusContext     *context,
        -: 2113:                            DBusConnection *connection,
        -: 2114:                            const char     *service_name,
        -: 2115:                            const char     *base_service)
function check_send_exit_to_service called 1585 returned 100% blocks executed 74%
     1585: 2116:{
        -: 2117:  dbus_bool_t got_error;
        -: 2118:  DBusMessage *message;
        -: 2119:  dbus_uint32_t serial;
        -: 2120:  dbus_bool_t retval;
        -: 2121:  
     1585: 2122:  _dbus_verbose ("Sending exit message to the test service\n");
call    0 returned 100%
        -: 2123:
     1585: 2124:  retval = FALSE;
        -: 2125:  
        -: 2126:  /* Kill off the test service by sending it a quit message */
     1585: 2127:  message = dbus_message_new_method_call (service_name,
call    0 returned 100%
        -: 2128:                                          "/org/freedesktop/TestSuite",
        -: 2129:                                          "org.freedesktop.TestSuite",
        -: 2130:                                          "Exit");
        -: 2131:      
     1585: 2132:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2133:    {
        -: 2134:      /* Do this again; we still need the service to exit... */
    #####: 2135:      if (!check_send_exit_to_service (context, connection,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 2136:                                       service_name, base_service))
    #####: 2137:        goto out;
        -: 2138:      
    #####: 2139:      return TRUE;
        -: 2140:    }
        -: 2141:      
     1585: 2142:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 2143:    {
        6: 2144:      dbus_message_unref (message);
call    0 returned 100%
        -: 2145:
        -: 2146:      /* Do this again; we still need the service to exit... */
        6: 2147:      if (!check_send_exit_to_service (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2148:                                       service_name, base_service))
    #####: 2149:        goto out;
        -: 2150:      
        6: 2151:      return TRUE;
        -: 2152:    }
        -: 2153:
     1579: 2154:  dbus_message_unref (message);
call    0 returned 100%
     1579: 2155:  message = NULL;
        -: 2156:
        -: 2157:  /* send message */
     1579: 2158:  bus_test_run_clients_loop (SEND_PENDING (connection));
call    0 returned 100%
call    1 returned 100%
        -: 2159:
        -: 2160:  /* read it in and write it out to test service */
     1579: 2161:  bus_test_run_bus_loop (context, FALSE);
call    0 returned 100%
        -: 2162:
        -: 2163:  /* see if we got an error during message bus dispatching */
     1579: 2164:  bus_test_run_clients_loop (FALSE);
call    0 returned 100%
     1579: 2165:  message = borrow_message_waiting_for_memory (connection);
call    0 returned 100%
     1579: 2166:  got_error = message != NULL && dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR;
branch  0 taken 4% (fallthrough)
branch  1 taken 96%
call    2 returned 100%
branch  3 taken 65% (fallthrough)
branch  4 taken 35%
     1579: 2167:  if (message)
branch  0 taken 4% (fallthrough)
branch  1 taken 96%
        -: 2168:    {
       63: 2169:      dbus_connection_return_message (connection, message);
call    0 returned 100%
       63: 2170:      message = NULL;
        -: 2171:    }
        -: 2172:          
     1579: 2173:  if (!got_error)
branch  0 taken 97% (fallthrough)
branch  1 taken 3%
        -: 2174:    {
        -: 2175:      /* If no error, wait for the test service to exit */
     1538: 2176:      block_connection_until_message_from_bus (context, connection, "test service to exit");
call    0 returned 100%
        -: 2177:              
     1538: 2178:      bus_test_run_everything (context);
call    0 returned 100%
        -: 2179:    }
        -: 2180:
     1579: 2181:  if (got_error)
branch  0 taken 3% (fallthrough)
branch  1 taken 97%
        -: 2182:    {
       41: 2183:      message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
       41: 2184:      _dbus_assert (message != NULL);
call    0 returned 100%
        -: 2185:
       41: 2186:      if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2187:        {
    #####: 2188:          warn_unexpected (connection, message,
call    0 never executed
        -: 2189:                           "error with the correct reply serial");
    #####: 2190:          goto out;
        -: 2191:        }
        -: 2192:      
       41: 2193:      if (!dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2194:                                  DBUS_ERROR_NO_MEMORY))
        -: 2195:        {
    #####: 2196:          warn_unexpected (connection, message,
call    0 never executed
        -: 2197:                           "a no memory error from asking test service to exit");
    #####: 2198:          goto out;
        -: 2199:        }
        -: 2200:
       41: 2201:      _dbus_verbose ("Got error %s when asking test service to exit\n",
call    0 returned 100%
call    1 returned 100%
        -: 2202:                     dbus_message_get_error_name (message));
        -: 2203:
        -: 2204:      /* Do this again; we still need the service to exit... */
       41: 2205:      if (!check_send_exit_to_service (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2206:                                       service_name, base_service))
    #####: 2207:        goto out;
        -: 2208:    }
        -: 2209:  else
        -: 2210:    {
     1538: 2211:      if (!check_service_deactivated (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2212:                                      service_name, base_service))
    #####: 2213:        goto out;
        -: 2214:
        -: 2215:      /* Should now have a NoReply error from the Exit() method
        -: 2216:       * call; it should have come after all the deactivation
        -: 2217:       * stuff.
        -: 2218:       */
     1538: 2219:      message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        -: 2220:          
     1538: 2221:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2222:        {
    #####: 2223:          warn_unexpected (connection, NULL,
call    0 never executed
        -: 2224:                           "reply to Exit() method call");
    #####: 2225:          goto out;
        -: 2226:        }
     1538: 2227:      if (!dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2228:                                  DBUS_ERROR_NO_REPLY))
        -: 2229:        {
    #####: 2230:          warn_unexpected (connection, message,
call    0 never executed
        -: 2231:                           "NoReply error from Exit() method call");
    #####: 2232:          goto out;
        -: 2233:        }
        -: 2234:
     1538: 2235:      if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2236:        {
    #####: 2237:          warn_unexpected (connection, message,
call    0 never executed
        -: 2238:                           "error with the correct reply serial");
    #####: 2239:          goto out;
        -: 2240:        }
        -: 2241:          
     1538: 2242:      _dbus_verbose ("Got error %s after test service exited\n",
call    0 returned 100%
call    1 returned 100%
        -: 2243:                     dbus_message_get_error_name (message));
        -: 2244:      
     1538: 2245:      if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2246:        {
    #####: 2247:          _dbus_warn ("Messages were left over after %s\n",
call    0 never executed
        -: 2248:                      _DBUS_FUNCTION_NAME);
    #####: 2249:          goto out;
        -: 2250:        }
        -: 2251:    }
        -: 2252:  
     1579: 2253:  retval = TRUE;
        -: 2254:  
     1579: 2255: out:
     1579: 2256:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
     1579: 2257:    dbus_message_unref (message);
call    0 returned 100%
        -: 2258:  
     1579: 2259:  return retval;
        -: 2260:}
        -: 2261:
        -: 2262:static dbus_bool_t
        -: 2263:check_got_error (BusContext     *context,
        -: 2264:                 DBusConnection *connection,
        -: 2265:                 const char     *first_error_name,
        -: 2266:                 ...)
function check_got_error called 416 returned 100% blocks executed 59%
      416: 2267:{
        -: 2268:  DBusMessage *message;
        -: 2269:  dbus_bool_t retval;
        -: 2270:  va_list ap;
        -: 2271:  dbus_bool_t error_found;
        -: 2272:  const char *error_name;
        -: 2273:  
      416: 2274:  retval = FALSE;
        -: 2275:  
      416: 2276:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
      416: 2277:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2278:    {
    #####: 2279:      _dbus_warn ("Did not get an expected error\n");
call    0 never executed
    #####: 2280:      goto out;
        -: 2281:    }
        -: 2282:
      416: 2283:  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2284:    {
    #####: 2285:      warn_unexpected (connection, message, "an error");
call    0 never executed
        -: 2286:
    #####: 2287:      goto out;
        -: 2288:    }
        -: 2289:
      416: 2290:  error_found = FALSE;
        -: 2291:
      416: 2292:  va_start (ap, first_error_name);
call    0 returned 100%
      416: 2293:  error_name = first_error_name;
      832: 2294:  while (error_name != NULL)
branch  0 taken 100%
branch  1 taken 0% (fallthrough)
        -: 2295:    {
      416: 2296:      if (dbus_message_is_error (message, error_name))
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2297:        {
      416: 2298:          error_found = TRUE;
      416: 2299:          break;
        -: 2300:        }
    #####: 2301:      error_name = va_arg (ap, char*);
branch  0 never executed
branch  1 never executed
        -: 2302:    }
      416: 2303:  va_end (ap);
call    0 returned 100%
        -: 2304:
      416: 2305:  if (!error_found)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2306:    {
    #####: 2307:      _dbus_warn ("Expected error %s or other, got %s instead\n",
call    0 never executed
call    1 never executed
        -: 2308:                  first_error_name,
        -: 2309:                  dbus_message_get_error_name (message));
    #####: 2310:      goto out;
        -: 2311:    }
        -: 2312:
      416: 2313:  retval = TRUE;
        -: 2314:  
      416: 2315: out:
      416: 2316:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      416: 2317:    dbus_message_unref (message);
call    0 returned 100%
        -: 2318:  
      416: 2319:  return retval;
        -: 2320:}
        -: 2321:          
        -: 2322:typedef enum
        -: 2323:{ 
        -: 2324:  GOT_SERVICE_CREATED,
        -: 2325:  GOT_SERVICE_DELETED,
        -: 2326:  GOT_ERROR,
        -: 2327:  GOT_SOMETHING_ELSE 
        -: 2328:} GotServiceInfo;
        -: 2329:
        -: 2330:static GotServiceInfo
        -: 2331:check_got_service_info (DBusMessage *message)
function check_got_service_info called 1954 returned 100% blocks executed 52%
     1954: 2332:{
        -: 2333:  GotServiceInfo message_kind;
        -: 2334:
     1954: 2335:  if (dbus_message_is_signal (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2336:                              DBUS_INTERFACE_DBUS,
        -: 2337:                              "NameOwnerChanged"))
        -: 2338:    {
        -: 2339:      DBusError error;
        -: 2340:      const char *service_name, *old_owner, *new_owner;
     1954: 2341:      dbus_error_init (&error);
call    0 returned 100%
        -: 2342:
     1954: 2343:    reget_service_info_data:
     1954: 2344:      service_name = NULL;
     1954: 2345:      old_owner = NULL;
     1954: 2346:      new_owner = NULL;
        -: 2347:
     1954: 2348:      dbus_message_get_args (message, &error,
call    0 returned 100%
        -: 2349:                             DBUS_TYPE_STRING, &service_name,
        -: 2350:                             DBUS_TYPE_STRING, &old_owner,
        -: 2351:                             DBUS_TYPE_STRING, &new_owner,
        -: 2352:                             DBUS_TYPE_INVALID);
     1954: 2353:      if (dbus_error_is_set (&error))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2354:        {
    #####: 2355:          if (dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 2356:            {
    #####: 2357:              dbus_error_free (&error);
call    0 never executed
    #####: 2358:              goto reget_service_info_data;
        -: 2359:            }
        -: 2360:          else
        -: 2361:            {
    #####: 2362:              _dbus_warn ("unexpected arguments for NameOwnerChanged message");
call    0 never executed
    #####: 2363:              message_kind = GOT_SOMETHING_ELSE;
        -: 2364:            }
        -: 2365:        }
     1954: 2366:      else if (!old_owner[0])
branch  0 taken 79% (fallthrough)
branch  1 taken 21%
     1538: 2367:        message_kind = GOT_SERVICE_CREATED;
      416: 2368:      else if (!new_owner[0])
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      416: 2369:        message_kind = GOT_SERVICE_DELETED;
        -: 2370:      else
    #####: 2371:        message_kind = GOT_SOMETHING_ELSE;
        -: 2372:
     1954: 2373:      dbus_error_free (&error);
call    0 returned 100%
        -: 2374:    }
    #####: 2375:  else if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 never executed
branch  1 never executed
branch  2 never executed
    #####: 2376:    message_kind = GOT_ERROR;
        -: 2377:  else
    #####: 2378:    message_kind = GOT_SOMETHING_ELSE;
        -: 2379:
     1954: 2380:  return message_kind;
        -: 2381:}
        -: 2382:
        -: 2383:#define EXISTENT_SERVICE_NAME "org.freedesktop.DBus.TestSuiteEchoService"
        -: 2384:
        -: 2385:/* returns TRUE if the correct thing happens,
        -: 2386: * but the correct thing may include OOM errors.
        -: 2387: */
        -: 2388:static dbus_bool_t
        -: 2389:check_existent_service_no_auto_start (BusContext     *context,
        -: 2390:                                      DBusConnection *connection)
function check_existent_service_no_auto_start called 2908 returned 100% blocks executed 64%
     2908: 2391:{
        -: 2392:  DBusMessage *message;
        -: 2393:  DBusMessage *base_service_message;
        -: 2394:  const char *base_service;
        -: 2395:  dbus_uint32_t serial;
        -: 2396:  dbus_bool_t retval;
     2908: 2397:  const char *existent = EXISTENT_SERVICE_NAME;
        -: 2398:  dbus_uint32_t flags;
        -: 2399:
     2908: 2400:  base_service_message = NULL;
        -: 2401:  
     2908: 2402:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 2403:                                          DBUS_PATH_DBUS,
        -: 2404:                                          DBUS_INTERFACE_DBUS,
        -: 2405:                                          "StartServiceByName");
        -: 2406:
     2908: 2407:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2408:    return TRUE;
        -: 2409:
     2908: 2410:  dbus_message_set_auto_start (message, FALSE);
call    0 returned 100%
        -: 2411:  
     2908: 2412:  flags = 0;
     2908: 2413:  if (!dbus_message_append_args (message,
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 2414:                                 DBUS_TYPE_STRING, &existent,
        -: 2415:                                 DBUS_TYPE_UINT32, &flags,
        -: 2416:                                 DBUS_TYPE_INVALID))
        -: 2417:    {
       30: 2418:      dbus_message_unref (message);
call    0 returned 100%
       30: 2419:      return TRUE;
        -: 2420:    }
        -: 2421:  
     2878: 2422:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 2423:    {
        3: 2424:      dbus_message_unref (message);
call    0 returned 100%
        3: 2425:      return TRUE;
        -: 2426:    }
        -: 2427:
     2875: 2428:  dbus_message_unref (message);
call    0 returned 100%
     2875: 2429:  message = NULL;
        -: 2430:
     2875: 2431:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2432:
        -: 2433:  /* now wait for the message bus to hear back from the activated
        -: 2434:   * service.
        -: 2435:   */
     2875: 2436:  block_connection_until_message_from_bus (context, connection, "activated service to connect");
call    0 returned 100%
        -: 2437:
     2875: 2438:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2439:
     2875: 2440:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2441:    {
    #####: 2442:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 2443:      return TRUE;
        -: 2444:    }
        -: 2445:  
     2875: 2446:  retval = FALSE;
        -: 2447:  
     2875: 2448:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     2875: 2449:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2450:    {
    #####: 2451:      _dbus_warn ("Did not receive any messages after %s %d on %p\n",
call    0 never executed
        -: 2452:                  "StartServiceByName", serial, connection);
    #####: 2453:      goto out;
        -: 2454:    }
        -: 2455:
     2875: 2456:  verbose_message_received (connection, message);
call    0 returned 100%
     2875: 2457:  _dbus_verbose ("  (after sending %s)\n", "StartServiceByName");
call    0 returned 100%
        -: 2458:
     2875: 2459:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 32% (fallthrough)
branch  2 taken 68%
        -: 2460:    {
      923: 2461:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2462:        {
    #####: 2463:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 2464:                      dbus_message_get_sender (message) ?
        -: 2465:                      dbus_message_get_sender (message) : "(none)");
    #####: 2466:          goto out;
        -: 2467:        }
        -: 2468:      
      923: 2469:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 47% (fallthrough)
branch  2 taken 53%
        -: 2470:                                 DBUS_ERROR_NO_MEMORY))
        -: 2471:        {
        -: 2472:          ; /* good, this is a valid response */
        -: 2473:        }
      437: 2474:      else if (dbus_message_is_error (message,
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
        -: 2475:                                      DBUS_ERROR_SPAWN_CHILD_EXITED) ||
        -: 2476:               dbus_message_is_error (message,
        -: 2477:                                      DBUS_ERROR_SPAWN_CHILD_SIGNALED) ||
        -: 2478:               dbus_message_is_error (message,
        -: 2479:                                      DBUS_ERROR_SPAWN_EXEC_FAILED))
        -: 2480:        {
        -: 2481:          ; /* good, this is expected also */
        -: 2482:        }
        -: 2483:      else
        -: 2484:        {
    #####: 2485:          _dbus_warn ("Did not expect error %s\n",
call    0 never executed
call    1 never executed
        -: 2486:                      dbus_message_get_error_name (message));
    #####: 2487:          goto out;
        -: 2488:        }
        -: 2489:    }
        -: 2490:  else
        -: 2491:    {
        -: 2492:      GotServiceInfo message_kind;
        -: 2493:      
     1952: 2494:      if (!check_base_service_activated (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2495:                                         message, &base_service))
    #####: 2496:        goto out;
        -: 2497:
     1952: 2498:      base_service_message = message;
     1952: 2499:      message = NULL;
        -: 2500:
        -: 2501:      /* We may need to block here for the test service to exit or finish up */
     1952: 2502:      block_connection_until_message_from_bus (context, connection, "test service to exit or finish up");
call    0 returned 100%
        -: 2503:      
     1952: 2504:      message = dbus_connection_borrow_message (connection);
call    0 returned 100%
     1952: 2505:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2506:        {
    #####: 2507:          _dbus_warn ("Did not receive any messages after base service creation notification\n");
call    0 never executed
    #####: 2508:          goto out;
        -: 2509:        }
        -: 2510:
     1952: 2511:      message_kind = check_got_service_info (message);
call    0 returned 100%
        -: 2512:
     1952: 2513:      dbus_connection_return_message (connection, message);
call    0 returned 100%
     1952: 2514:      message = NULL;
        -: 2515:
     1952: 2516:      switch (message_kind)
branch  0 taken 0%
branch  1 taken 0%
branch  2 taken 21%
branch  3 taken 79%
branch  4 taken 0%
        -: 2517:        {
        -: 2518:        case GOT_SOMETHING_ELSE:
    #####: 2519:          _dbus_warn ("Unexpected message after ActivateService "
call    0 never executed
        -: 2520:                      "(should be an error or a service announcement");
    #####: 2521:          goto out;
        -: 2522:
        -: 2523:        case GOT_ERROR:
    #####: 2524:          if (!check_got_error (context, connection,
call    0 never executed
branch  1 never executed
branch  2 never executed
        -: 2525:                                DBUS_ERROR_SPAWN_CHILD_EXITED,
        -: 2526:                                DBUS_ERROR_NO_MEMORY,
        -: 2527:                                NULL))
    #####: 2528:            goto out;
        -: 2529:          /* A service deleted should be coming along now after this error.
        -: 2530:           * We can also get the error *after* the service deleted.
        -: 2531:           */
        -: 2532:
        -: 2533:          /* fall through */
        -: 2534:
        -: 2535:        case GOT_SERVICE_DELETED:
        -: 2536:          {
        -: 2537:            /* The service started up and got a base address, but then
        -: 2538:             * failed to register under EXISTENT_SERVICE_NAME
        -: 2539:             */
        -: 2540:            CheckServiceOwnerChangedData socd;
        -: 2541:
      416: 2542:            socd.expected_kind = SERVICE_DELETED;
      416: 2543:            socd.expected_service_name = base_service;
      416: 2544:            socd.failed = FALSE;
      416: 2545:            socd.skip_connection = NULL;
        -: 2546:            
      416: 2547:            bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 returned 100%
        -: 2548:                                      &socd);
        -: 2549:
      416: 2550:            if (socd.failed)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2551:              goto out;
        -: 2552:
        -: 2553:            /* Now we should get an error about the service exiting
        -: 2554:             * if we didn't get it before.
        -: 2555:             */
      416: 2556:            if (message_kind != GOT_ERROR)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -: 2557:              {
      416: 2558:                block_connection_until_message_from_bus (context, connection, "error about service exiting");
call    0 returned 100%
        -: 2559:              
        -: 2560:                /* and process everything again */
      416: 2561:                bus_test_run_everything (context);
call    0 returned 100%
        -: 2562:              
      416: 2563:                if (!check_got_error (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2564:                                      DBUS_ERROR_SPAWN_CHILD_EXITED,
        -: 2565:                                      NULL))
    #####: 2566:                  goto out;
        -: 2567:              }
      416: 2568:            break;
        -: 2569:          }
        -: 2570:
        -: 2571:        case GOT_SERVICE_CREATED:
     1536: 2572:          message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
     1536: 2573:          if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2574:            {
    #####: 2575:              _dbus_warn ("Failed to pop message we just put back! "
call    0 never executed
        -: 2576:                          "should have been a NameOwnerChanged (creation)\n");
    #####: 2577:              goto out;
        -: 2578:            }
        -: 2579:          
     1536: 2580:          if (!check_service_activated (context, connection, EXISTENT_SERVICE_NAME,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2581:                                        base_service, message))
    #####: 2582:            goto out;
        -: 2583:          
     1536: 2584:          dbus_message_unref (message);
call    0 returned 100%
     1536: 2585:          message = NULL;
        -: 2586:
     1536: 2587:          if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2588:            {
    #####: 2589:              _dbus_warn ("Messages were left over after successful activation\n");
call    0 never executed
    #####: 2590:              goto out;
        -: 2591:            }
        -: 2592:
     1536: 2593:          if (!check_send_exit_to_service (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2594:                                           EXISTENT_SERVICE_NAME, base_service))
    #####: 2595:            goto out;
        -: 2596:
        -: 2597:          break;
        -: 2598:        }
        -: 2599:    }
        -: 2600:
     2875: 2601:  retval = TRUE;
        -: 2602:  
     2875: 2603: out:
     2875: 2604:  if (message)
branch  0 taken 32% (fallthrough)
branch  1 taken 68%
      923: 2605:    dbus_message_unref (message);
call    0 returned 100%
        -: 2606:
     2875: 2607:  if (base_service_message)
branch  0 taken 68% (fallthrough)
branch  1 taken 32%
     1952: 2608:    dbus_message_unref (base_service_message);
call    0 returned 100%
        -: 2609:  
     2875: 2610:  return retval;
        -: 2611:}
        -: 2612:
        -: 2613:/* returns TRUE if the correct thing happens,
        -: 2614: * but the correct thing may include OOM errors.
        -: 2615: */
        -: 2616:static dbus_bool_t
        -: 2617:check_segfault_service_no_auto_start (BusContext     *context,
        -: 2618:                                      DBusConnection *connection)
function check_segfault_service_no_auto_start called 670 returned 100% blocks executed 67%
      670: 2619:{
        -: 2620:  DBusMessage *message;
        -: 2621:  dbus_uint32_t serial;
        -: 2622:  dbus_bool_t retval;
        -: 2623:  const char *segv_service;
        -: 2624:  dbus_uint32_t flags;
        -: 2625:  
      670: 2626:  message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
call    0 returned 100%
        -: 2627:                                          DBUS_PATH_DBUS,
        -: 2628:                                          DBUS_INTERFACE_DBUS,
        -: 2629:                                          "StartServiceByName");
        -: 2630:
      670: 2631:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2632:    return TRUE;
        -: 2633:
      670: 2634:  dbus_message_set_auto_start (message, FALSE);
call    0 returned 100%
        -: 2635:  
      670: 2636:  segv_service = "org.freedesktop.DBus.TestSuiteSegfaultService";
      670: 2637:  flags = 0;
      670: 2638:  if (!dbus_message_append_args (message,
call    0 returned 100%
branch  1 taken 4% (fallthrough)
branch  2 taken 96%
        -: 2639:                                 DBUS_TYPE_STRING, &segv_service,
        -: 2640:                                 DBUS_TYPE_UINT32, &flags,
        -: 2641:                                 DBUS_TYPE_INVALID))
        -: 2642:    {
       30: 2643:      dbus_message_unref (message);
call    0 returned 100%
       30: 2644:      return TRUE;
        -: 2645:    }
        -: 2646:  
      640: 2647:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 2648:    {
        3: 2649:      dbus_message_unref (message);
call    0 returned 100%
        3: 2650:      return TRUE;
        -: 2651:    }
        -: 2652:
      637: 2653:  dbus_message_unref (message);
call    0 returned 100%
      637: 2654:  message = NULL;
        -: 2655:
      637: 2656:  bus_test_run_everything (context);
call    0 returned 100%
      637: 2657:  block_connection_until_message_from_bus (context, connection, "reply to activating segfault service");
call    0 returned 100%
      637: 2658:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2659:
      637: 2660:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2661:    {
    #####: 2662:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 2663:      return TRUE;
        -: 2664:    }
        -: 2665:  
      637: 2666:  retval = FALSE;
        -: 2667:  
      637: 2668:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
      637: 2669:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2670:    {
    #####: 2671:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 2672:                  "StartServiceByName", serial, connection);
    #####: 2673:      goto out;
        -: 2674:    }
        -: 2675:
      637: 2676:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 2677:
      637: 2678:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2679:    {
      637: 2680:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2681:        {
    #####: 2682:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 2683:                      dbus_message_get_sender (message) ?
        -: 2684:                      dbus_message_get_sender (message) : "(none)");
    #####: 2685:          goto out;
        -: 2686:        }
        -: 2687:      
      637: 2688:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 33% (fallthrough)
branch  2 taken 67%
        -: 2689:                                 DBUS_ERROR_NO_MEMORY))
        -: 2690:        {
        -: 2691:          ; /* good, this is a valid response */
        -: 2692:        }
      211: 2693:      else if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2694:                                      DBUS_ERROR_SPAWN_CHILD_SIGNALED))
        -: 2695:        {
        -: 2696:          ; /* good, this is expected also */
        -: 2697:        }
        -: 2698:      else
        -: 2699:        {
    #####: 2700:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 2701:
    #####: 2702:          goto out;
        -: 2703:        }
        -: 2704:    }
        -: 2705:  else
        -: 2706:    {
    #####: 2707:      _dbus_warn ("Did not expect to successfully activate segfault service\n");
call    0 never executed
    #####: 2708:      goto out;
        -: 2709:    }
        -: 2710:
      637: 2711:  retval = TRUE;
        -: 2712:  
      637: 2713: out:
      637: 2714:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      637: 2715:    dbus_message_unref (message);
call    0 returned 100%
        -: 2716:  
      637: 2717:  return retval;
        -: 2718:}
        -: 2719:
        -: 2720:
        -: 2721:/* returns TRUE if the correct thing happens,
        -: 2722: * but the correct thing may include OOM errors.
        -: 2723: */
        -: 2724:static dbus_bool_t
        -: 2725:check_segfault_service_auto_start (BusContext     *context,
        -: 2726:                                   DBusConnection *connection)
function check_segfault_service_auto_start called 598 returned 100% blocks executed 64%
      598: 2727:{
        -: 2728:  DBusMessage *message;
        -: 2729:  dbus_uint32_t serial;
        -: 2730:  dbus_bool_t retval;
        -: 2731:
      598: 2732:  message = dbus_message_new_method_call ("org.freedesktop.DBus.TestSuiteSegfaultService",
call    0 returned 100%
        -: 2733:                                          "/org/freedesktop/TestSuite",
        -: 2734:                                          "org.freedesktop.TestSuite",
        -: 2735:                                          "Echo");
        -: 2736:  
      598: 2737:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2738:    return TRUE;
        -: 2739:  
      598: 2740:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 2741:    {
        3: 2742:      dbus_message_unref (message);
call    0 returned 100%
        3: 2743:      return TRUE;
        -: 2744:    }
        -: 2745:
      595: 2746:  dbus_message_unref (message);
call    0 returned 100%
      595: 2747:  message = NULL;
        -: 2748:
      595: 2749:  bus_test_run_everything (context);
call    0 returned 100%
      595: 2750:  block_connection_until_message_from_bus (context, connection, "reply to Echo on segfault service");
call    0 returned 100%
      595: 2751:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2752:
      595: 2753:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2754:    {
    #####: 2755:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 2756:      return TRUE;
        -: 2757:    }
        -: 2758:  
      595: 2759:  retval = FALSE;
        -: 2760:  
      595: 2761:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
      595: 2762:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2763:    {
    #####: 2764:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 2765:                  "Echo message (auto activation)", serial, connection);
    #####: 2766:      goto out;
        -: 2767:    }
        -: 2768:
      595: 2769:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 2770:
      595: 2771:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 2772:    {
      595: 2773:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2774:        {
    #####: 2775:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 2776:                      dbus_message_get_sender (message) ?
        -: 2777:                      dbus_message_get_sender (message) : "(none)");
    #####: 2778:          goto out;
        -: 2779:        }
        -: 2780:      
      595: 2781:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 30% (fallthrough)
branch  2 taken 70%
        -: 2782:                                 DBUS_ERROR_NO_MEMORY))
        -: 2783:        {
        -: 2784:          ; /* good, this is a valid response */
        -: 2785:        }
      178: 2786:      else if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2787:                                      DBUS_ERROR_SPAWN_CHILD_SIGNALED))
        -: 2788:        {
        -: 2789:          ; /* good, this is expected also */
        -: 2790:        }
        -: 2791:      else
        -: 2792:        {
    #####: 2793:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 2794:
    #####: 2795:          goto out;
        -: 2796:        }
        -: 2797:    }
        -: 2798:  else
        -: 2799:    {
    #####: 2800:      _dbus_warn ("Did not expect to successfully activate segfault service\n");
call    0 never executed
    #####: 2801:      goto out;
        -: 2802:    }
        -: 2803:
      595: 2804:  retval = TRUE;
        -: 2805:  
      595: 2806: out:
      595: 2807:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      595: 2808:    dbus_message_unref (message);
call    0 returned 100%
        -: 2809:  
      595: 2810:  return retval;
        -: 2811:}
        -: 2812:
        -: 2813:#define TEST_ECHO_MESSAGE "Test echo message"
        -: 2814:#define TEST_RUN_HELLO_FROM_SELF_MESSAGE "Test sending message to self"
        -: 2815:
        -: 2816:/* returns TRUE if the correct thing happens,
        -: 2817: * but the correct thing may include OOM errors.
        -: 2818: */
        -: 2819:static dbus_bool_t
        -: 2820:check_existent_hello_from_self (BusContext     *context,
        -: 2821:                                DBusConnection *connection)
function check_existent_hello_from_self called 1 returned 100% blocks executed 62%
        1: 2822:{
        -: 2823:  DBusMessage *message;
        -: 2824:  dbus_uint32_t serial;
        -: 2825:  const char *text;
        -: 2826:
        1: 2827:  message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
call    0 returned 100%
        -: 2828:                                          "/org/freedesktop/TestSuite",
        -: 2829:                                          "org.freedesktop.TestSuite",
        -: 2830:                                          "RunHelloFromSelf");
        -: 2831:  
        1: 2832:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2833:    return TRUE;
        -: 2834:
        1: 2835:  text = TEST_RUN_HELLO_FROM_SELF_MESSAGE;
        1: 2836:  if (!dbus_message_append_args (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2837:                                 DBUS_TYPE_STRING, &text,
        -: 2838:                                 DBUS_TYPE_INVALID))
        -: 2839:    {
    #####: 2840:      dbus_message_unref (message);
call    0 never executed
    #####: 2841:      return TRUE;
        -: 2842:    }
        -: 2843:
        1: 2844:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2845:    {
    #####: 2846:      dbus_message_unref (message);
call    0 never executed
    #####: 2847:      return TRUE;
        -: 2848:    }
        -: 2849:
        1: 2850:  dbus_message_unref (message);
call    0 returned 100%
        1: 2851:  message = NULL;
        -: 2852:
        1: 2853:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2854:
        -: 2855:  /* Note: if this test is run in OOM mode, it will block when the bus
        -: 2856:   * doesn't send a reply due to OOM.
        -: 2857:   */
        1: 2858:  block_connection_until_message_from_bus (context, connection, "reply from running hello from self");
call    0 returned 100%
        -: 2859:      
        1: 2860:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 2861:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2862:    {
    #####: 2863:      _dbus_warn ("Failed to pop message! Should have been reply from RunHelloFromSelf message\n");
call    0 never executed
    #####: 2864:      return FALSE;
        -: 2865:    }
        -: 2866:
        1: 2867:  if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2868:    {
    #####: 2869:      _dbus_warn ("Wrong reply serial\n");
call    0 never executed
    #####: 2870:      dbus_message_unref (message);
call    0 never executed
    #####: 2871:      return FALSE;
        -: 2872:    }
        -: 2873:
        1: 2874:  dbus_message_unref (message);
call    0 returned 100%
        1: 2875:  message = NULL;
        -: 2876:      
        1: 2877:  return TRUE;
        -: 2878:}
        -: 2879:
        -: 2880:/* returns TRUE if the correct thing happens,
        -: 2881: * but the correct thing may include OOM errors.
        -: 2882: */
        -: 2883:static dbus_bool_t
        -: 2884:check_existent_ping (BusContext     *context,
        -: 2885:                     DBusConnection *connection)
function check_existent_ping called 1 returned 100% blocks executed 59%
        1: 2886:{
        -: 2887:  DBusMessage *message;
        -: 2888:  dbus_uint32_t serial;
        1: 2889:  message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
call    0 returned 100%
        -: 2890:                                          "/org/freedesktop/TestSuite",
        -: 2891:                                          "org.freedesktop.DBus.Peer",
        -: 2892:                                          "Ping");
        -: 2893:  
        1: 2894:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2895:    return TRUE;
        -: 2896:
        1: 2897:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2898:    {
    #####: 2899:      dbus_message_unref (message);
call    0 never executed
    #####: 2900:      return TRUE;
        -: 2901:    }
        -: 2902:
        1: 2903:  dbus_message_unref (message);
call    0 returned 100%
        1: 2904:  message = NULL;
        -: 2905:
        1: 2906:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2907:
        -: 2908:  /* Note: if this test is run in OOM mode, it will block when the bus
        -: 2909:   * doesn't send a reply due to OOM.
        -: 2910:   */
        1: 2911:  block_connection_until_message_from_bus (context, connection, "reply from running Ping");
call    0 returned 100%
        -: 2912:      
        1: 2913:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 2914:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 2915:    {
    #####: 2916:      _dbus_warn ("Failed to pop message! Should have been reply from Ping message\n");
call    0 never executed
    #####: 2917:      return FALSE;
        -: 2918:    }
        -: 2919:
        1: 2920:  if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2921:    {
    #####: 2922:      _dbus_warn ("Wrong reply serial\n");
call    0 never executed
    #####: 2923:      dbus_message_unref (message);
call    0 never executed
    #####: 2924:      return FALSE;
        -: 2925:    }
        -: 2926:
        1: 2927:  if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_METHOD_RETURN)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2928:    {
    #####: 2929:      _dbus_warn ("Unexpected message return during Ping\n");
call    0 never executed
    #####: 2930:      dbus_message_unref (message);
call    0 never executed
    #####: 2931:      return FALSE;
        -: 2932:    }
        -: 2933:
        1: 2934:  dbus_message_unref (message);
call    0 returned 100%
        1: 2935:  message = NULL;
        -: 2936:      
        1: 2937:  return TRUE;
        -: 2938:}
        -: 2939:
        -: 2940:/* returns TRUE if the correct thing happens,
        -: 2941: * but the correct thing may include OOM errors.
        -: 2942: */
        -: 2943:static dbus_bool_t
        -: 2944:check_existent_service_auto_start (BusContext     *context,
        -: 2945:                                   DBusConnection *connection)
function check_existent_service_auto_start called 1 returned 100% blocks executed 63%
        1: 2946:{
        -: 2947:  DBusMessage *message;
        -: 2948:  DBusMessage *base_service_message;
        -: 2949:  dbus_uint32_t serial;
        -: 2950:  dbus_bool_t retval;
        -: 2951:  const char *base_service;
        -: 2952:  const char *text;
        -: 2953:
        1: 2954:  base_service_message = NULL;
        -: 2955:
        1: 2956:  message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
call    0 returned 100%
        -: 2957:                                          "/org/freedesktop/TestSuite",
        -: 2958:                                          "org.freedesktop.TestSuite",
        -: 2959:                                          "Echo");
        -: 2960:  
        1: 2961:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 2962:    return TRUE;
        -: 2963:
        1: 2964:  text = TEST_ECHO_MESSAGE;
        1: 2965:  if (!dbus_message_append_args (message,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2966:                                 DBUS_TYPE_STRING, &text,
        -: 2967:                                 DBUS_TYPE_INVALID))
        -: 2968:    {
    #####: 2969:      dbus_message_unref (message);
call    0 never executed
    #####: 2970:      return TRUE;
        -: 2971:    }
        -: 2972:
        1: 2973:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2974:    {
    #####: 2975:      dbus_message_unref (message);
call    0 never executed
    #####: 2976:      return TRUE;
        -: 2977:    }
        -: 2978:
        1: 2979:  dbus_message_unref (message);
call    0 returned 100%
        1: 2980:  message = NULL;
        -: 2981:
        1: 2982:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2983:
        -: 2984:  /* now wait for the message bus to hear back from the activated
        -: 2985:   * service.
        -: 2986:   */
        1: 2987:  block_connection_until_message_from_bus (context, connection, "reply to Echo on existent service");
call    0 returned 100%
        1: 2988:  bus_test_run_everything (context);
call    0 returned 100%
        -: 2989:
        1: 2990:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 2991:    {
    #####: 2992:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 2993:      return TRUE;
        -: 2994:    }
        -: 2995:
        1: 2996:  retval = FALSE;
        -: 2997:  
        1: 2998:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 2999:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3000:    {
    #####: 3001:      _dbus_warn ("Did not receive any messages after auto start %d on %p\n",
call    0 never executed
        -: 3002:                  serial, connection);
    #####: 3003:      goto out;
        -: 3004:    }
        -: 3005:
        1: 3006:  verbose_message_received (connection, message);
call    0 returned 100%
        1: 3007:  _dbus_verbose ("  (after sending %s)\n", "auto start");
call    0 returned 100%
        -: 3008:
        -: 3009:  /* we should get zero or two ServiceOwnerChanged signals */
        1: 3010:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_SIGNAL)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 3011:    {
        -: 3012:      GotServiceInfo message_kind;
        -: 3013:
        1: 3014:      if (!check_base_service_activated (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3015:                                         message, &base_service))
    #####: 3016:        goto out;
        -: 3017:
        1: 3018:      base_service_message = message;
        1: 3019:      message = NULL;
        -: 3020:
        -: 3021:      /* We may need to block here for the test service to exit or finish up */
        1: 3022:      block_connection_until_message_from_bus (context, connection, "service to exit");
call    0 returned 100%
        -: 3023:
        -: 3024:      /* Should get a service creation notification for the activated
        -: 3025:       * service name, or a service deletion on the base service name
        -: 3026:       */
        1: 3027:      message = dbus_connection_borrow_message (connection);
call    0 returned 100%
        1: 3028:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3029:        {
    #####: 3030:          _dbus_warn ("No message after auto activation "
call    0 never executed
        -: 3031:                      "(should be a service announcement)");
    #####: 3032:          dbus_connection_return_message (connection, message);
call    0 never executed
    #####: 3033:          message = NULL;
    #####: 3034:          goto out;
        -: 3035:        }
        -: 3036:
        1: 3037:      message_kind = check_got_service_info (message);
call    0 returned 100%
        -: 3038:
        1: 3039:      dbus_connection_return_message (connection, message);
call    0 returned 100%
        1: 3040:      message = NULL;
        -: 3041:
        1: 3042:      switch (message_kind) 
branch  0 taken 100%
branch  1 taken 0%
branch  2 taken 0%
branch  3 taken 0%
        -: 3043:        {
        -: 3044:        case GOT_SERVICE_CREATED:
        1: 3045:          message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 3046:          if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3047:            {
    #####: 3048:              _dbus_warn ("Failed to pop message we just put back! "
call    0 never executed
        -: 3049:                          "should have been a NameOwnerChanged (creation)\n");
    #####: 3050:              goto out;
        -: 3051:            }
        -: 3052:            
        -: 3053:          /* Check that ServiceOwnerChanged (creation) was correctly received */
        1: 3054:          if (!check_service_auto_activated (context, connection, EXISTENT_SERVICE_NAME,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3055:                                             base_service, message))
    #####: 3056:            goto out;
        -: 3057:          
        1: 3058:          dbus_message_unref (message);
call    0 returned 100%
        1: 3059:          message = NULL;
        -: 3060:
        1: 3061:          break;
        -: 3062:
        -: 3063:        case GOT_SERVICE_DELETED:
        -: 3064:          {
        -: 3065:            /* The service started up and got a base address, but then
        -: 3066:             * failed to register under EXISTENT_SERVICE_NAME
        -: 3067:             */
        -: 3068:            CheckServiceOwnerChangedData socd;
        -: 3069:          
    #####: 3070:            socd.expected_kind = SERVICE_DELETED;
    #####: 3071:            socd.expected_service_name = base_service;
    #####: 3072:            socd.failed = FALSE;
    #####: 3073:            socd.skip_connection = NULL;
    #####: 3074:            bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 never executed
        -: 3075:                                      &socd);
        -: 3076:
    #####: 3077:            if (socd.failed)
branch  0 never executed
branch  1 never executed
    #####: 3078:              goto out;
        -: 3079:
    #####: 3080:            break;
        -: 3081:          }
        -: 3082:
        -: 3083:        case GOT_ERROR:
        -: 3084:        case GOT_SOMETHING_ELSE:
    #####: 3085:          _dbus_warn ("Unexpected message after auto activation\n");
call    0 never executed
    #####: 3086:          goto out;
        -: 3087:        }
        -: 3088:    }
        -: 3089:
        -: 3090:  /* OK, now we've dealt with ServiceOwnerChanged signals, now should
        -: 3091:   * come the method reply (or error) from the initial method call
        -: 3092:   */
        -: 3093:
        -: 3094:  /* Note: if this test is run in OOM mode, it will block when the bus
        -: 3095:   * doesn't send a reply due to OOM.
        -: 3096:   */
        1: 3097:  block_connection_until_message_from_bus (context, connection, "reply from echo message after auto-activation");
call    0 returned 100%
        -: 3098:      
        1: 3099:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 3100:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3101:    {
    #####: 3102:      _dbus_warn ("Failed to pop message! Should have been reply from echo message\n");
call    0 never executed
    #####: 3103:      goto out;
        -: 3104:    }
        -: 3105:
        1: 3106:  if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3107:    {
    #####: 3108:      _dbus_warn ("Wrong reply serial\n");
call    0 never executed
    #####: 3109:      goto out;
        -: 3110:    }
        -: 3111:
        1: 3112:  dbus_message_unref (message);
call    0 returned 100%
        1: 3113:  message = NULL;
        -: 3114:
        1: 3115:  if (!check_existent_ping (context, connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3116:    goto out;
        -: 3117:
        1: 3118:  if (!check_existent_hello_from_self (context, connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3119:    goto out;
        -: 3120:
        1: 3121:  if (!check_send_exit_to_service (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3122:                                   EXISTENT_SERVICE_NAME,
        -: 3123:                                   base_service))
    #####: 3124:    goto out;
        -: 3125:  
        1: 3126:  retval = TRUE;
        -: 3127:
        1: 3128: out:
        1: 3129:  if (message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3130:    dbus_message_unref (message);
call    0 never executed
        -: 3131:
        1: 3132:  if (base_service_message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1: 3133:    dbus_message_unref (base_service_message);
call    0 returned 100%
        -: 3134:
        1: 3135:  return retval;
        -: 3136:}
        -: 3137:
        -: 3138:#define SHELL_FAIL_SERVICE_NAME "org.freedesktop.DBus.TestSuiteShellEchoServiceFail"
        -: 3139:
        -: 3140:/* returns TRUE if the correct thing happens,
        -: 3141: * but the correct thing may include OOM errors.
        -: 3142: */
        -: 3143:static dbus_bool_t
        -: 3144:check_shell_fail_service_auto_start (BusContext     *context,
        -: 3145:                                     DBusConnection *connection)
function check_shell_fail_service_auto_start called 568 returned 100% blocks executed 64%
      568: 3146:{
        -: 3147:  DBusMessage *message;
        -: 3148:  dbus_uint32_t serial;
        -: 3149:  dbus_bool_t retval;
        -: 3150:
      568: 3151:  message = dbus_message_new_method_call (SHELL_FAIL_SERVICE_NAME,
call    0 returned 100%
        -: 3152:                                          "/org/freedesktop/TestSuite",
        -: 3153:                                          "org.freedesktop.TestSuite",
        -: 3154:                                          "Echo");
        -: 3155:  
      568: 3156:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3157:    return TRUE;
        -: 3158:  
      568: 3159:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 1% (fallthrough)
branch  2 taken 99%
        -: 3160:    {
        3: 3161:      dbus_message_unref (message);
call    0 returned 100%
        3: 3162:      return TRUE;
        -: 3163:    }
        -: 3164:
      565: 3165:  dbus_message_unref (message);
call    0 returned 100%
      565: 3166:  message = NULL;
        -: 3167:
      565: 3168:  bus_test_run_everything (context);
call    0 returned 100%
      565: 3169:  block_connection_until_message_from_bus (context, connection, "reply to shell Echo on service which should fail to auto-start");
call    0 returned 100%
      565: 3170:  bus_test_run_everything (context);
call    0 returned 100%
        -: 3171:
      565: 3172:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3173:    {
    #####: 3174:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 3175:      return TRUE;
        -: 3176:    }
        -: 3177:  
      565: 3178:  retval = FALSE;
        -: 3179:  
      565: 3180:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
      565: 3181:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3182:    {
    #####: 3183:      _dbus_warn ("Did not receive a reply to %s %d on %p\n",
call    0 never executed
        -: 3184:                  "Echo message (auto activation)", serial, connection);
    #####: 3185:      goto out;
        -: 3186:    }
        -: 3187:
      565: 3188:  verbose_message_received (connection, message);
call    0 returned 100%
        -: 3189:
      565: 3190:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 3191:    {
      565: 3192:      if (!dbus_message_has_sender (message, DBUS_SERVICE_DBUS))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3193:        {
    #####: 3194:          _dbus_warn ("Message has wrong sender %s\n",
call    0 never executed
branch  1 never executed
branch  2 never executed
call    3 never executed
call    4 never executed
        -: 3195:                      dbus_message_get_sender (message) ?
        -: 3196:                      dbus_message_get_sender (message) : "(none)");
    #####: 3197:          goto out;
        -: 3198:        }
        -: 3199:      
      565: 3200:      if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 20% (fallthrough)
branch  2 taken 80%
        -: 3201:                                 DBUS_ERROR_NO_MEMORY))
        -: 3202:        {
        -: 3203:          ; /* good, this is a valid response */
        -: 3204:        }
      115: 3205:      else if (dbus_message_is_error (message,
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 3206:                                      DBUS_ERROR_INVALID_ARGS))
        -: 3207:        {
      115: 3208:          _dbus_verbose("got invalid args\n");
call    0 returned 100%
        -: 3209:          ; /* good, this is expected also */
        -: 3210:        }
        -: 3211:      else
        -: 3212:        {
    #####: 3213:          warn_unexpected (connection, message, "not this error");
call    0 never executed
        -: 3214:
    #####: 3215:          goto out;
        -: 3216:        }
        -: 3217:    }
        -: 3218:  else
        -: 3219:    {
    #####: 3220:      _dbus_warn ("Did not expect to successfully auto-start shell fail service\n");
call    0 never executed
    #####: 3221:      goto out;
        -: 3222:    }
        -: 3223:
      565: 3224:  retval = TRUE;
        -: 3225:  
      565: 3226: out:
      565: 3227:  if (message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      565: 3228:    dbus_message_unref (message);
call    0 returned 100%
        -: 3229:  
      565: 3230:  return retval;
        -: 3231:}
        -: 3232:
        -: 3233:#define SHELL_SUCCESS_SERVICE_NAME "org.freedesktop.DBus.TestSuiteShellEchoServiceSuccess"
        -: 3234:
        -: 3235:/* returns TRUE if the correct thing happens,
        -: 3236: * but the correct thing may include OOM errors.
        -: 3237: */
        -: 3238:static dbus_bool_t
        -: 3239:check_shell_service_success_auto_start (BusContext     *context,
        -: 3240:                                        DBusConnection *connection)
function check_shell_service_success_auto_start called 1 returned 100% blocks executed 59%
        1: 3241:{
        -: 3242:  DBusMessage *message;
        -: 3243:  DBusMessage *base_service_message;
        -: 3244:  dbus_uint32_t serial;
        -: 3245:  dbus_bool_t retval;
        -: 3246:  const char *base_service;
        1: 3247:  const char *argv[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL};
        -: 3248:
        1: 3249:  base_service_message = NULL;
        -: 3250:
        1: 3251:  message = dbus_message_new_method_call (SHELL_SUCCESS_SERVICE_NAME,
call    0 returned 100%
        -: 3252:                                          "/org/freedesktop/TestSuite",
        -: 3253:                                          "org.freedesktop.TestSuite",
        -: 3254:                                          "Echo");
        -: 3255:  
        1: 3256:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3257:    return TRUE;
        -: 3258:
        1: 3259:  if (!dbus_connection_send (connection, message, &serial))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3260:    {
    #####: 3261:      dbus_message_unref (message);
call    0 never executed
    #####: 3262:      return TRUE;
        -: 3263:    }
        -: 3264:
        1: 3265:  dbus_message_unref (message);
call    0 returned 100%
        1: 3266:  message = NULL;
        -: 3267:
        1: 3268:  bus_test_run_everything (context);
call    0 returned 100%
        -: 3269:
        -: 3270:  /* now wait for the message bus to hear back from the activated
        -: 3271:   * service.
        -: 3272:   */
        1: 3273:  block_connection_until_message_from_bus (context, connection, "reply to Echo on shell success service");
call    0 returned 100%
        1: 3274:  bus_test_run_everything (context);
call    0 returned 100%
        -: 3275:
        1: 3276:  if (!dbus_connection_get_is_connected (connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3277:    {
    #####: 3278:      _dbus_verbose ("connection was disconnected: %s %d\n", _DBUS_FUNCTION_NAME, __LINE__);
call    0 never executed
    #####: 3279:      return TRUE;
        -: 3280:    }
        -: 3281:
        1: 3282:  retval = FALSE;
        -: 3283:  
        1: 3284:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 3285:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3286:    {
    #####: 3287:      _dbus_warn ("Did not receive any messages after auto start %d on %p\n",
call    0 never executed
        -: 3288:                  serial, connection);
    #####: 3289:      goto out;
        -: 3290:    }
        -: 3291:
        1: 3292:  verbose_message_received (connection, message);
call    0 returned 100%
        1: 3293:  _dbus_verbose ("  (after sending %s)\n", "auto start");
call    0 returned 100%
        -: 3294:
        -: 3295:  /* we should get zero or two ServiceOwnerChanged signals */
        1: 3296:  if (dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_SIGNAL)
call    0 returned 100%
branch  1 taken 100% (fallthrough)
branch  2 taken 0%
        -: 3297:    {
        -: 3298:      GotServiceInfo message_kind;
        -: 3299:
        1: 3300:      if (!check_base_service_activated (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3301:                                         message, &base_service))
    #####: 3302:        goto out;
        -: 3303:
        1: 3304:      base_service_message = message;
        1: 3305:      message = NULL;
        -: 3306:
        -: 3307:      /* We may need to block here for the test service to exit or finish up */
        1: 3308:      block_connection_until_message_from_bus (context, connection, "service to exit");
call    0 returned 100%
        -: 3309:
        -: 3310:      /* Should get a service creation notification for the activated
        -: 3311:       * service name, or a service deletion on the base service name
        -: 3312:       */
        1: 3313:      message = dbus_connection_borrow_message (connection);
call    0 returned 100%
        1: 3314:      if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3315:        {
    #####: 3316:          _dbus_warn ("No message after auto activation "
call    0 never executed
        -: 3317:                      "(should be a service announcement)");
    #####: 3318:          dbus_connection_return_message (connection, message);
call    0 never executed
    #####: 3319:          message = NULL;
    #####: 3320:          goto out;
        -: 3321:        }
        -: 3322:
        1: 3323:      message_kind = check_got_service_info (message);
call    0 returned 100%
        -: 3324:
        1: 3325:      dbus_connection_return_message (connection, message);
call    0 returned 100%
        1: 3326:      message = NULL;
        -: 3327:
        1: 3328:      switch (message_kind) 
branch  0 taken 100%
branch  1 taken 0%
branch  2 taken 0%
branch  3 taken 0%
        -: 3329:        {
        -: 3330:        case GOT_SERVICE_CREATED:
        1: 3331:          message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 3332:          if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3333:            {
    #####: 3334:              _dbus_warn ("Failed to pop message we just put back! "
call    0 never executed
        -: 3335:                          "should have been a NameOwnerChanged (creation)\n");
    #####: 3336:              goto out;
        -: 3337:            }
        -: 3338:            
        -: 3339:          /* Check that ServiceOwnerChanged (creation) was correctly received */
        1: 3340:          if (!check_service_auto_activated (context, connection, SHELL_SUCCESS_SERVICE_NAME,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3341:                                             base_service, message))
    #####: 3342:            goto out;
        -: 3343:          
        1: 3344:          dbus_message_unref (message);
call    0 returned 100%
        1: 3345:          message = NULL;
        -: 3346:
        1: 3347:          break;
        -: 3348:
        -: 3349:        case GOT_SERVICE_DELETED:
        -: 3350:          {
        -: 3351:            /* The service started up and got a base address, but then
        -: 3352:             * failed to register under SHELL_SUCCESS_SERVICE_NAME
        -: 3353:             */
        -: 3354:            CheckServiceOwnerChangedData socd;
        -: 3355:          
    #####: 3356:            socd.expected_kind = SERVICE_DELETED;
    #####: 3357:            socd.expected_service_name = base_service;
    #####: 3358:            socd.failed = FALSE;
    #####: 3359:            socd.skip_connection = NULL;
    #####: 3360:            bus_test_clients_foreach (check_service_owner_changed_foreach,
call    0 never executed
        -: 3361:                                      &socd);
        -: 3362:
    #####: 3363:            if (socd.failed)
branch  0 never executed
branch  1 never executed
    #####: 3364:              goto out;
        -: 3365:
    #####: 3366:            break;
        -: 3367:          }
        -: 3368:
        -: 3369:        case GOT_ERROR:
        -: 3370:        case GOT_SOMETHING_ELSE:
    #####: 3371:          _dbus_warn ("Unexpected message after auto activation\n");
call    0 never executed
    #####: 3372:          goto out;
        -: 3373:        }
        -: 3374:    }
        -: 3375:
        -: 3376:  /* OK, now we've dealt with ServiceOwnerChanged signals, now should
        -: 3377:   * come the method reply (or error) from the initial method call
        -: 3378:   */
        -: 3379:
        -: 3380:  /* Note: if this test is run in OOM mode, it will block when the bus
        -: 3381:   * doesn't send a reply due to OOM.
        -: 3382:   */
        1: 3383:  block_connection_until_message_from_bus (context, connection, "reply from echo message after auto-activation");
call    0 returned 100%
        -: 3384:      
        1: 3385:  message = pop_message_waiting_for_memory (connection);
call    0 returned 100%
        1: 3386:  if (message == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
        -: 3387:    {
    #####: 3388:      _dbus_warn ("Failed to pop message! Should have been reply from echo message\n");
call    0 never executed
    #####: 3389:      goto out;
        -: 3390:    }
        -: 3391:
        1: 3392:  if (dbus_message_get_reply_serial (message) != serial)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3393:    {
    #####: 3394:      _dbus_warn ("Wrong reply serial\n");
call    0 never executed
    #####: 3395:      goto out;
        -: 3396:    }
        -: 3397:
        1: 3398:  if (!dbus_message_get_args (message, NULL,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3399:                                       DBUS_TYPE_STRING, &argv[0], 
        -: 3400:                                       DBUS_TYPE_STRING, &argv[1],
        -: 3401:                                       DBUS_TYPE_STRING, &argv[2],
        -: 3402:                                       DBUS_TYPE_STRING, &argv[3],
        -: 3403:                                       DBUS_TYPE_STRING, &argv[4],
        -: 3404:                                       DBUS_TYPE_STRING, &argv[5],
        -: 3405:                                       DBUS_TYPE_STRING, &argv[6],
        -: 3406:                                       DBUS_TYPE_INVALID))
        -: 3407:    {
    #####: 3408:      _dbus_warn ("Error getting arguments from return");
call    0 never executed
    #####: 3409:      goto out;
        -: 3410:    }
        -: 3411:
        -: 3412:   /* don't worry about arg[0] as it may be different 
        -: 3413:      depending on the path to the tests
        -: 3414:   */
        1: 3415:  if (strcmp("-test", argv[1]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3416:    {
    #####: 3417:      _dbus_warn ("Unexpected argv[1] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3418:                  "-test", argv[1]);
    #####: 3419:      goto out;
        -: 3420:    } 
        -: 3421:
        1: 3422:  if (strcmp("that", argv[2]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3423:    {
    #####: 3424:      _dbus_warn ("Unexpected argv[2] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3425:                   "that", argv[2]);
    #####: 3426:      goto out;
        -: 3427:    } 
        -: 3428:
        1: 3429:  if (strcmp("we get", argv[3]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3430:    {
    #####: 3431:      _dbus_warn ("Unexpected argv[3] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3432:                   "we get", argv[3]);
    #####: 3433:      goto out;
        -: 3434:    } 
        -: 3435:   
        1: 3436:  if (strcmp("back", argv[4]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3437:    {
    #####: 3438:      _dbus_warn ("Unexpected argv[4] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3439:                   "back", argv[4]);
    #####: 3440:      goto out;
        -: 3441:    } 
        -: 3442:
        1: 3443:  if (strcmp("--what", argv[5]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3444:    {
    #####: 3445:      _dbus_warn ("Unexpected argv[5] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3446:                   "--what", argv[5]);
    #####: 3447:      goto out;
        -: 3448:    } 
        -: 3449:
        1: 3450:  if (strcmp("we put in", argv[6]) != 0)
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3451:    {
    #####: 3452:      _dbus_warn ("Unexpected argv[6] in shell success service test (expected: %s, got: %s)", 
call    0 never executed
        -: 3453:                   "we put in", argv[6]);
    #####: 3454:      goto out;
        -: 3455:    } 
        -: 3456:
        1: 3457:  dbus_message_unref (message);
call    0 returned 100%
        1: 3458:  message = NULL;
        -: 3459:      
        1: 3460:  if (!check_send_exit_to_service (context, connection,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3461:                                   SHELL_SUCCESS_SERVICE_NAME,
        -: 3462:                                   base_service))
    #####: 3463:    goto out;
        -: 3464:  
        1: 3465:  retval = TRUE;
        -: 3466:
        1: 3467: out:
        1: 3468:  if (message)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3469:    dbus_message_unref (message);
call    0 never executed
        -: 3470:
        1: 3471:  if (base_service_message)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1: 3472:    dbus_message_unref (base_service_message);
call    0 returned 100%
        -: 3473:
        1: 3474:  return retval;
        -: 3475:}
        -: 3476:
        -: 3477:typedef struct
        -: 3478:{
        -: 3479:  Check1Func func;
        -: 3480:  BusContext *context;
        -: 3481:} Check1Data;
        -: 3482:
        -: 3483:static dbus_bool_t
        -: 3484:check_oom_check1_func (void *data)
function check_oom_check1_func called 6053 returned 100% blocks executed 67%
     6053: 3485:{
     6053: 3486:  Check1Data *d = data;
        -: 3487:
     6053: 3488:  if (! (* d->func) (d->context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3489:    return FALSE;
        -: 3490:  
     6053: 3491:  if (!check_no_leftovers (d->context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3492:    {
    #####: 3493:      _dbus_warn ("Messages were left over, should be covered by test suite\n");
call    0 never executed
    #####: 3494:      return FALSE;
        -: 3495:    }
        -: 3496:
     6053: 3497:  return TRUE;
        -: 3498:}
        -: 3499:
        -: 3500:static void
        -: 3501:check1_try_iterations (BusContext *context,
        -: 3502:                       const char *description,
        -: 3503:                       Check1Func  func)
function check1_try_iterations called 2 returned 100% blocks executed 75%
        2: 3504:{
        -: 3505:  Check1Data d;
        -: 3506:
        2: 3507:  d.func = func;
        2: 3508:  d.context = context;
        -: 3509:
        2: 3510:  if (!_dbus_test_oom_handling (description, check_oom_check1_func,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3511:                                &d))
    #####: 3512:    _dbus_assert_not_reached ("test failed");
call    0 never executed
        2: 3513:}
        -: 3514:
        -: 3515:typedef struct
        -: 3516:{
        -: 3517:  Check2Func func;
        -: 3518:  BusContext *context;
        -: 3519:  DBusConnection *connection;
        -: 3520:} Check2Data;
        -: 3521:
        -: 3522:static dbus_bool_t
        -: 3523:check_oom_check2_func (void *data)
function check_oom_check2_func called 5361 returned 100% blocks executed 67%
     5361: 3524:{
     5361: 3525:  Check2Data *d = data;
        -: 3526:
     5361: 3527:  if (! (* d->func) (d->context, d->connection))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3528:    return FALSE;
        -: 3529:  
     5361: 3530:  if (!check_no_leftovers (d->context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3531:    {
    #####: 3532:      _dbus_warn ("Messages were left over, should be covered by test suite");
call    0 never executed
    #####: 3533:      return FALSE;
        -: 3534:    }
        -: 3535:
     5361: 3536:  return TRUE;
        -: 3537:}
        -: 3538:
        -: 3539:static void
        -: 3540:check2_try_iterations (BusContext     *context,
        -: 3541:                       DBusConnection *connection,
        -: 3542:                       const char     *description,
        -: 3543:                       Check2Func      func)
function check2_try_iterations called 6 returned 100% blocks executed 60%
        6: 3544:{
        -: 3545:  Check2Data d;
        -: 3546:
        6: 3547:  d.func = func;
        6: 3548:  d.context = context;
        6: 3549:  d.connection = connection;
        -: 3550:  
        6: 3551:  if (!_dbus_test_oom_handling (description, check_oom_check2_func,
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3552:                                &d))
        -: 3553:    {
    #####: 3554:      _dbus_warn ("%s failed during oom\n", description);
call    0 never executed
    #####: 3555:      _dbus_assert_not_reached ("test failed");
call    0 never executed
        -: 3556:    }
        6: 3557:}
        -: 3558:
        -: 3559:dbus_bool_t
        -: 3560:bus_dispatch_test (const DBusString *test_data_dir)
function bus_dispatch_test called 1 returned 100% blocks executed 74%
        1: 3561:{
        -: 3562:  BusContext *context;
        -: 3563:  DBusConnection *foo;
        -: 3564:  DBusConnection *bar;
        -: 3565:  DBusConnection *baz;
        -: 3566:  DBusError error;
        -: 3567:
        1: 3568:  dbus_error_init (&error);
call    0 returned 100%
        -: 3569:  
        1: 3570:  context = bus_context_new_test (test_data_dir,
call    0 returned 100%
        -: 3571:                                  "valid-config-files/debug-allow-all.conf");
        1: 3572:  if (context == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3573:    return FALSE;
        -: 3574:  
        1: 3575:  foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
call    0 returned 100%
        1: 3576:  if (foo == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3577:    _dbus_assert_not_reached ("could not alloc connection");
call    0 never executed
        -: 3578:
        1: 3579:  if (!bus_setup_debug_client (foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3580:    _dbus_assert_not_reached ("could not set up connection");
call    0 never executed
        -: 3581:
        1: 3582:  spin_connection_until_authenticated (context, foo);
call    0 returned 100%
        -: 3583:  
        1: 3584:  if (!check_hello_message (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3585:    _dbus_assert_not_reached ("hello message failed");
call    0 never executed
        -: 3586:
        1: 3587:  if (!check_double_hello_message (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3588:    _dbus_assert_not_reached ("double hello message failed");
call    0 never executed
        -: 3589:
        1: 3590:  if (!check_add_match_all (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3591:    _dbus_assert_not_reached ("AddMatch message failed");
call    0 never executed
        -: 3592:  
        1: 3593:  bar = dbus_connection_open ("debug-pipe:name=test-server", &error);
call    0 returned 100%
        1: 3594:  if (bar == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3595:    _dbus_assert_not_reached ("could not alloc connection");
call    0 never executed
        -: 3596:
        1: 3597:  if (!bus_setup_debug_client (bar))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3598:    _dbus_assert_not_reached ("could not set up connection");
call    0 never executed
        -: 3599:
        1: 3600:  spin_connection_until_authenticated (context, bar);
call    0 returned 100%
        -: 3601:  
        1: 3602:  if (!check_hello_message (context, bar))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3603:    _dbus_assert_not_reached ("hello message failed");
call    0 never executed
        -: 3604:
        1: 3605:  if (!check_add_match_all (context, bar))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3606:    _dbus_assert_not_reached ("AddMatch message failed");
call    0 never executed
        -: 3607:  
        1: 3608:  baz = dbus_connection_open ("debug-pipe:name=test-server", &error);
call    0 returned 100%
        1: 3609:  if (baz == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3610:    _dbus_assert_not_reached ("could not alloc connection");
call    0 never executed
        -: 3611:
        1: 3612:  if (!bus_setup_debug_client (baz))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3613:    _dbus_assert_not_reached ("could not set up connection");
call    0 never executed
        -: 3614:
        1: 3615:  spin_connection_until_authenticated (context, baz);
call    0 returned 100%
        -: 3616:  
        1: 3617:  if (!check_hello_message (context, baz))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3618:    _dbus_assert_not_reached ("hello message failed");
call    0 never executed
        -: 3619:
        1: 3620:  if (!check_add_match_all (context, baz))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3621:    _dbus_assert_not_reached ("AddMatch message failed");
call    0 never executed
        -: 3622:
        1: 3623:  if (!check_get_connection_unix_user (context, baz))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3624:    _dbus_assert_not_reached ("GetConnectionUnixUser message failed");
call    0 never executed
        -: 3625:
        1: 3626:  if (!check_get_connection_unix_process_id (context, baz))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3627:    _dbus_assert_not_reached ("GetConnectionUnixProcessID message failed");
call    0 never executed
        -: 3628:  
        1: 3629:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3630:    {
    #####: 3631:      _dbus_warn ("Messages were left over after setting up initial connections");
call    0 never executed
    #####: 3632:      _dbus_assert_not_reached ("initial connection setup failed");
call    0 never executed
        -: 3633:    }
        -: 3634:  
        1: 3635:  check1_try_iterations (context, "create_and_hello",
call    0 returned 100%
        -: 3636:                         check_hello_connection);
        -: 3637:  
        1: 3638:  check2_try_iterations (context, foo, "nonexistent_service_no_auto_start",
call    0 returned 100%
        -: 3639:                         check_nonexistent_service_no_auto_start);
        -: 3640:
        1: 3641:  check2_try_iterations (context, foo, "segfault_service_no_auto_start",
call    0 returned 100%
        -: 3642:                         check_segfault_service_no_auto_start);
        -: 3643:  
        1: 3644:  check2_try_iterations (context, foo, "existent_service_no_auto_start",
call    0 returned 100%
        -: 3645:                         check_existent_service_no_auto_start);
        -: 3646:  
        1: 3647:  check2_try_iterations (context, foo, "nonexistent_service_auto_start",
call    0 returned 100%
        -: 3648:                         check_nonexistent_service_auto_start);
        -: 3649:  
        1: 3650:  check2_try_iterations (context, foo, "segfault_service_auto_start",
call    0 returned 100%
        -: 3651:                         check_segfault_service_auto_start);
        -: 3652:
        1: 3653:  check2_try_iterations (context, foo, "shell_fail_service_auto_start",
call    0 returned 100%
        -: 3654:                         check_shell_fail_service_auto_start);
        -: 3655:
        -: 3656:#if 0
        -: 3657:  /* Note: need to resolve some issues with the testing code in order to run
        -: 3658:   * this in oom (handle that we sometimes don't get replies back from the bus
        -: 3659:   * when oom happens, without blocking the test).
        -: 3660:   */
        -: 3661:  check2_try_iterations (context, foo, "existent_service_auto_auto_start",
        -: 3662:                         check_existent_service_auto_start);
        -: 3663:#endif
        -: 3664:  
        1: 3665:  if (!check_existent_service_auto_start (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3666:    _dbus_assert_not_reached ("existent service auto start failed");
call    0 never executed
        -: 3667:
        1: 3668:  if (!check_shell_service_success_auto_start (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3669:    _dbus_assert_not_reached ("shell success service auto start failed");
call    0 never executed
        -: 3670:
        1: 3671:  _dbus_verbose ("Disconnecting foo, bar, and baz\n");
call    0 returned 100%
        -: 3672:
        1: 3673:  kill_client_connection_unchecked (foo);
call    0 returned 100%
        1: 3674:  kill_client_connection_unchecked (bar);
call    0 returned 100%
        1: 3675:  kill_client_connection_unchecked (baz);
call    0 returned 100%
        -: 3676:
        1: 3677:  bus_context_unref (context);
call    0 returned 100%
        -: 3678:  
        1: 3679:  return TRUE;
        -: 3680:}
        -: 3681:
        -: 3682:dbus_bool_t
        -: 3683:bus_dispatch_sha1_test (const DBusString *test_data_dir)
function bus_dispatch_sha1_test called 1 returned 100% blocks executed 74%
        1: 3684:{
        -: 3685:  BusContext *context;
        -: 3686:  DBusConnection *foo;
        -: 3687:  DBusError error;
        -: 3688:
        1: 3689:  dbus_error_init (&error);
call    0 returned 100%
        -: 3690:  
        -: 3691:  /* Test SHA1 authentication */
        1: 3692:  _dbus_verbose ("Testing SHA1 context\n");
call    0 returned 100%
        -: 3693:  
        1: 3694:  context = bus_context_new_test (test_data_dir,
call    0 returned 100%
        -: 3695:                                  "valid-config-files/debug-allow-all-sha1.conf");
        1: 3696:  if (context == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3697:    return FALSE;
        -: 3698:
        1: 3699:  foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
call    0 returned 100%
        1: 3700:  if (foo == NULL)
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####: 3701:    _dbus_assert_not_reached ("could not alloc connection");
call    0 never executed
        -: 3702:
        1: 3703:  if (!bus_setup_debug_client (foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3704:    _dbus_assert_not_reached ("could not set up connection");
call    0 never executed
        -: 3705:
        1: 3706:  spin_connection_until_authenticated (context, foo);
call    0 returned 100%
        -: 3707:  
        1: 3708:  if (!check_hello_message (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3709:    _dbus_assert_not_reached ("hello message failed");
call    0 never executed
        -: 3710:
        1: 3711:  if (!check_add_match_all (context, foo))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####: 3712:    _dbus_assert_not_reached ("addmatch message failed");
call    0 never executed
        -: 3713:  
        1: 3714:  if (!check_no_leftovers (context))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -: 3715:    {
    #####: 3716:      _dbus_warn ("Messages were left over after setting up initial SHA-1 connection\n");
call    0 never executed
    #####: 3717:      _dbus_assert_not_reached ("initial connection setup failed");
call    0 never executed
        -: 3718:    }
        -: 3719:  
        1: 3720:  check1_try_iterations (context, "create_and_hello_sha1",
call    0 returned 100%
        -: 3721:                         check_hello_connection);
        -: 3722:
        1: 3723:  kill_client_connection_unchecked (foo);
call    0 returned 100%
        -: 3724:
        1: 3725:  bus_context_unref (context);
call    0 returned 100%
        -: 3726:
        1: 3727:  return TRUE;
        -: 3728:}
        -: 3729:
        -: 3730:#endif /* DBUS_BUILD_TESTS */