summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-test.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-01-09 01:31:35 +0000
committerHavoc Pennington <hp@redhat.com>2003-01-09 01:31:35 +0000
commit993be1059afcb0e9a5b67f5287fb1122d6c48ce6 (patch)
treeb96e02f8d05a2a5a82778f3d302f49177ac89aac /dbus/dbus-test.c
parent509bbe9bded65ddc4039f50ea95a3706ab35ba4f (diff)
2003-01-08 Havoc Pennington <hp@pobox.com>
* dbus/dbus-string.c (_dbus_string_align_length): new function * dbus/dbus-test-main.c: move main() for test app here * dbus/dbus-test.c (dbus_internal_symbol_do_not_use_run_tests): we have to export a symbol to run tests, because dbus-test isn't in the main library Code review nitpicks. * dbus/dbus-message.c (dbus_message_write_header): add newlines for people with narrow emacs ;-). Assert client_serial was filled in. Assert message->name != NULL. (dbus_message_append_fields): have "first_field_type" arg separate from va list, needed for C++ binding that also uses varargs IIRC and helps with type safety (dbus_message_new): add @todo about using DBusString to store service/name internally (dbus_message_new): don't leak ->service and ->name on OOM later in the function (dbus_message_unref): free the service name (dbus_message_get_fields): same change to varargs i.e. first_field_type (_dbus_message_loader_return_buffer): assert that the message data is aligned (if not it's a bug in our code). Put in verbose griping about why we set corrupted = TRUE. (decode_header_data): add FIXME that char* is evil. Was going to add FIXME about evil locale-specific string.h strncmp, but just switched to wacky string-as-uint32 optimization. Move check for "no room for field name" above get_const_data_len() to avoid assertion failure in get_const_data_len if we have trailing 2 bytes or the like. Check for service and name fields being provided twice. Don't leak service/name on error. Require field names to be aligned to 4 bytes. * dbus/dbus-marshal.c: move byte swap stuff to header (_dbus_pack_int32): uscore-prefix (_dbus_unpack_int32): uscore-prefix (_dbus_unpack_uint32): export (_dbus_demarshal_string): add @todo complaining about use of memcpy() (_dbus_marshal_get_field_end_pos): add @todo about bad error handling allowing corrupt data to go unchecked
Diffstat (limited to 'dbus/dbus-test.c')
-rw-r--r--dbus/dbus-test.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/dbus/dbus-test.c b/dbus/dbus-test.c
index 2866e084..a219069f 100644
--- a/dbus/dbus-test.c
+++ b/dbus/dbus-test.c
@@ -21,7 +21,6 @@
*
*/
-#include "dbus-types.h"
#include "dbus-test.h"
#include <stdio.h>
#include <stdlib.h>
@@ -33,34 +32,41 @@ die (const char *failure)
exit (1);
}
-int
-main (int argc,
- char **argv)
+/**
+ * An exported symbol to be run in order to execute
+ * unit tests. Should not be used by
+ * any app other than our test app, this symbol
+ * won't exist in some builds of the library.
+ * (with --enable-tests=no)
+ */
+void
+dbus_internal_symbol_do_not_use_run_tests (void)
{
- printf ("%s: running string tests\n", argv[0]);
+ printf ("%s: running string tests\n", "dbus-test");
if (!_dbus_string_test ())
die ("strings");
- printf ("%s: running marshalling tests\n", argv[0]);
+ printf ("%s: running marshalling tests\n", "dbus-test");
if (!_dbus_marshal_test ())
die ("marshalling");
- printf ("%s: running message tests\n", argv[0]);
+ printf ("%s: running message tests\n", "dbus-test");
if (!_dbus_message_test ())
die ("messages");
- printf ("%s: running memory pool tests\n", argv[0]);
+ printf ("%s: running memory pool tests\n", "dbus-test");
if (!_dbus_mem_pool_test ())
die ("memory pools");
- printf ("%s: running linked list tests\n", argv[0]);
+ printf ("%s: running linked list tests\n", "dbus-test");
if (!_dbus_list_test ())
die ("lists");
- printf ("%s: running hash table tests\n", argv[0]);
+ printf ("%s: running hash table tests\n", "dbus-test");
if (!_dbus_hash_test ())
die ("hash tables");
- printf ("%s: completed successfully\n", argv[0]);
- return 0;
+ printf ("%s: completed successfully\n", "dbus-test");
}
+
+