"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/internals/dbus-message-util.c" between
dbus-1.13.12.tar.xz and dbus-1.13.14.tar.xz

About: D-Bus is an inter-process communication (IPC) system, allowing multiple, concurrently-running applications to communicate with one another. D-Bus supplies both a system daemon and a per-user-login-session daemon. Development version.

dbus-message-util.c  (dbus-1.13.12.tar.xz):dbus-message-util.c  (dbus-1.13.14.tar.xz)
skipping to change at line 49 skipping to change at line 49
#include "dbus/dbus-message-private.h" #include "dbus/dbus-message-private.h"
#include "dbus/dbus-marshal-recursive.h" #include "dbus/dbus-marshal-recursive.h"
#include "dbus/dbus-string.h" #include "dbus/dbus-string.h"
#ifdef HAVE_UNIX_FD_PASSING #ifdef HAVE_UNIX_FD_PASSING
#include "dbus/dbus-sysdeps-unix.h" #include "dbus/dbus-sysdeps-unix.h"
#endif #endif
#include "dbus/dbus-test-tap.h" #include "dbus/dbus-test-tap.h"
#include "dbus-message-factory.h" #include "dbus-message-factory.h"
#include "test/test-utils.h"
#ifdef DBUS_ENABLE_EMBEDDED_TESTS #ifdef DBUS_ENABLE_EMBEDDED_TESTS
/** /**
* Reads arguments from a message iterator given a variable argument * Reads arguments from a message iterator given a variable argument
* list. Only arguments of basic type and arrays of fixed-length * list. Only arguments of basic type and arrays of fixed-length
* basic type may be read with this function. See * basic type may be read with this function. See
* dbus_message_get_args() for more details. * dbus_message_get_args() for more details.
* *
* @param iter the message iterator * @param iter the message iterator
* @param error error to be filled in on failure * @param error error to be filled in on failure
* @param first_arg_type the first argument type * @param first_arg_type the first argument type
skipping to change at line 885 skipping to change at line 887
strcmp (our_string_array[3], "woo woo woo woo") != 0) strcmp (our_string_array[3], "woo woo woo woo") != 0)
_dbus_test_fatal ("string array had wrong values"); _dbus_test_fatal ("string array had wrong values");
dbus_free_string_array (our_string_array); dbus_free_string_array (our_string_array);
if (dbus_message_iter_next (&iter)) if (dbus_message_iter_next (&iter))
_dbus_test_fatal ("Didn't reach end of arguments"); _dbus_test_fatal ("Didn't reach end of arguments");
} }
static void static void
verify_test_message_args_ignored (DBusMessage *message) verify_test_message_args_ignored (DBusMessage *message,
const char *context)
{ {
DBusMessageIter iter; DBusMessageIter iter;
DBusError error = DBUS_ERROR_INIT; DBusError error = DBUS_ERROR_INIT;
dbus_uint32_t our_uint; dbus_uint32_t our_uint;
DBusInitialFDs *initial_fds; DBusInitialFDs *initial_fds;
initial_fds = _dbus_check_fdleaks_enter (); initial_fds = _dbus_check_fdleaks_enter ();
/* parse with empty signature: "" */ /* parse with empty signature: "" */
dbus_message_iter_init (message, &iter); dbus_message_iter_init (message, &iter);
skipping to change at line 923 skipping to change at line 926
{ {
_dbus_warn ("error: %s - %s", error.name, _dbus_warn ("error: %s - %s", error.name,
(error.message != NULL) ? error.message : "no message"); (error.message != NULL) ? error.message : "no message");
} }
else else
{ {
_dbus_assert (!dbus_error_is_set (&error)); _dbus_assert (!dbus_error_is_set (&error));
_dbus_verbose ("arguments ignored.\n"); _dbus_verbose ("arguments ignored.\n");
} }
_dbus_check_fdleaks_leave (initial_fds); _dbus_check_fdleaks_leave (initial_fds, context);
} }
static void static void
verify_test_message_memleak (DBusMessage *message) verify_test_message_memleak (DBusMessage *message,
const char *context)
{ {
DBusMessageIter iter; DBusMessageIter iter;
DBusError error = DBUS_ERROR_INIT; DBusError error = DBUS_ERROR_INIT;
dbus_uint32_t our_uint1; dbus_uint32_t our_uint1;
dbus_uint32_t our_uint2; dbus_uint32_t our_uint2;
dbus_uint32_t our_uint3; dbus_uint32_t our_uint3;
char **our_string_array1; char **our_string_array1;
int our_string_array_len1; int our_string_array_len1;
char **our_string_array2; char **our_string_array2;
int our_string_array_len2; int our_string_array_len2;
skipping to change at line 1037 skipping to change at line 1041
} }
else else
{ {
dbus_free_string_array (our_string_array1); dbus_free_string_array (our_string_array1);
dbus_free_string_array (our_string_array2); dbus_free_string_array (our_string_array2);
#ifdef HAVE_UNIX_FD_PASSING #ifdef HAVE_UNIX_FD_PASSING
_dbus_close (our_unix_fd1, &error); _dbus_close (our_unix_fd1, &error);
_dbus_close (our_unix_fd2, &error); _dbus_close (our_unix_fd2, &error);
#endif #endif
} }
_dbus_check_fdleaks_leave (initial_fds); _dbus_check_fdleaks_leave (initial_fds, context);
} }
/** /**
* @ingroup DBusMessageInternals * @ingroup DBusMessageInternals
* Unit test for DBusMessage. * Unit test for DBusMessage.
* *
* @returns #TRUE on success. * @returns #TRUE on success.
*/ */
dbus_bool_t dbus_bool_t
_dbus_message_test (const char *test_data_dir _DBUS_GNUC_UNUSED) _dbus_message_test (const char *test_data_dir _DBUS_GNUC_UNUSED)
skipping to change at line 1500 skipping to change at line 1504
/* Bytes needed to demarshal invalid message: -1 (error). */ /* Bytes needed to demarshal invalid message: -1 (error). */
_dbus_assert (dbus_message_demarshal_bytes_needed (garbage_header, DBUS_MI NIMUM_HEADER_SIZE) == -1); _dbus_assert (dbus_message_demarshal_bytes_needed (garbage_header, DBUS_MI NIMUM_HEADER_SIZE) == -1);
} }
dbus_message_unref (message_without_unix_fds); dbus_message_unref (message_without_unix_fds);
_dbus_message_loader_unref (loader); _dbus_message_loader_unref (loader);
check_memleaks (); check_memleaks ();
_dbus_check_fdleaks_leave (initial_fds); _dbus_check_fdleaks_leave (initial_fds, _DBUS_FILE_LINE);
initial_fds = _dbus_check_fdleaks_enter (); initial_fds = _dbus_check_fdleaks_enter ();
/* Test enumeration of array elements */ /* Test enumeration of array elements */
for (i = strlen (basic_types) - 1; i > 0; i--) for (i = strlen (basic_types) - 1; i > 0; i--)
{ {
DBusBasicValue val; DBusBasicValue val;
int some; int some;
char* signature = _dbus_strdup ("?"); char* signature = _dbus_strdup ("?");
signature[0] = basic_types[i]; signature[0] = basic_types[i];
skipping to change at line 1622 skipping to change at line 1626
sig[i++] = DBUS_TYPE_UINT32; sig[i++] = DBUS_TYPE_UINT32;
sig[i++] = DBUS_TYPE_ARRAY; sig[i++] = DBUS_TYPE_ARRAY;
sig[i++] = DBUS_TYPE_STRING; sig[i++] = DBUS_TYPE_STRING;
#ifdef HAVE_UNIX_FD_PASSING #ifdef HAVE_UNIX_FD_PASSING
sig[i++] = DBUS_TYPE_UNIX_FD; sig[i++] = DBUS_TYPE_UNIX_FD;
#endif #endif
sig[i++] = DBUS_TYPE_INVALID; sig[i++] = DBUS_TYPE_INVALID;
_dbus_assert (i < (int) _DBUS_N_ELEMENTS (sig)); _dbus_assert (i < (int) _DBUS_N_ELEMENTS (sig));
verify_test_message_args_ignored (message); verify_test_message_args_ignored (message, _DBUS_FILE_LINE);
verify_test_message_memleak (message); verify_test_message_memleak (message, _DBUS_FILE_LINE);
dbus_message_unref (message); dbus_message_unref (message);
/* Load all the sample messages from the message factory */ /* Load all the sample messages from the message factory */
{ {
DBusMessageDataIter diter; DBusMessageDataIter diter;
DBusMessageData mdata; DBusMessageData mdata;
int count; int count;
reset_validities_seen (); reset_validities_seen ();
skipping to change at line 1659 skipping to change at line 1663
count += 1; count += 1;
} }
_dbus_test_diag ("%d sample messages tested", count); _dbus_test_diag ("%d sample messages tested", count);
print_validities_seen (FALSE); print_validities_seen (FALSE);
print_validities_seen (TRUE); print_validities_seen (TRUE);
} }
check_memleaks (); check_memleaks ();
_dbus_check_fdleaks_leave (initial_fds); _dbus_check_fdleaks_leave (initial_fds, _DBUS_FILE_LINE);
/* Now load every message in test_data_dir if we have one */ /* Now load every message in test_data_dir if we have one */
if (test_data_dir == NULL) if (test_data_dir == NULL)
return TRUE; return TRUE;
initial_fds = _dbus_check_fdleaks_enter (); initial_fds = _dbus_check_fdleaks_enter ();
if (!foreach_message_file (test_data_dir, try_message_file, NULL)) if (!foreach_message_file (test_data_dir, try_message_file, NULL))
_dbus_test_fatal ("foreach_message_file test failed"); _dbus_test_fatal ("foreach_message_file test failed");
_dbus_check_fdleaks_leave (initial_fds); _dbus_check_fdleaks_leave (initial_fds, _DBUS_FILE_LINE);
return TRUE; return TRUE;
} }
#endif /* DBUS_ENABLE_EMBEDDED_TESTS */ #endif /* DBUS_ENABLE_EMBEDDED_TESTS */
 End of changes. 9 change blocks. 
9 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)