summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am9
-rw-r--r--test/break-loader.c2
-rwxr-xr-xtest/glib/run-test.sh4
-rw-r--r--test/glib/test-dbus-glib.c59
-rw-r--r--test/glib/test-profile.c30
-rw-r--r--test/glib/test-thread-client.c6
-rw-r--r--test/glib/test-thread-server.c10
-rw-r--r--test/test-service.c10
8 files changed, 68 insertions, 62 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 0579e7f8..4498b7e3 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -10,7 +10,8 @@ INCLUDES=-I$(top_srcdir) $(DBUS_TEST_CFLAGS)
if DBUS_BUILD_TESTS
-TEST_BINARIES=test-service break-loader spawn-test test-segfault test-exit test-sleep-forever
+## break-loader removed for now
+TEST_BINARIES=test-service spawn-test test-segfault test-exit test-sleep-forever
else
TEST_BINARIES=
endif
@@ -28,8 +29,8 @@ test_service_SOURCES= \
test-utils.c \
test-utils.h
-break_loader_SOURCES= \
- break-loader.c
+##break_loader_SOURCES= \
+## break-loader.c
spawn_test_SOURCES= \
spawn-test.c
@@ -49,7 +50,7 @@ decode_gcov_SOURCES= \
TEST_LIBS=$(DBUS_TEST_LIBS) $(top_builddir)/dbus/libdbus-convenience.la
test_service_LDADD=$(TEST_LIBS)
-break_loader_LDADD= $(TEST_LIBS)
+## break_loader_LDADD= $(TEST_LIBS)
spawn_test_LDADD=$(TEST_LIBS)
decode_gcov_LDADD=$(TEST_LIBS)
diff --git a/test/break-loader.c b/test/break-loader.c
index cb7dc19c..f74d5025 100644
--- a/test/break-loader.c
+++ b/test/break-loader.c
@@ -36,7 +36,7 @@
#include <dbus/dbus-string.h>
#include <dbus/dbus-internals.h>
#include <dbus/dbus-test.h>
-#include <dbus/dbus-marshal.h>
+#include <dbus/dbus-marshal-basic.h>
#undef DBUS_COMPILATION
static DBusString failure_dir;
diff --git a/test/glib/run-test.sh b/test/glib/run-test.sh
index 5d0317a3..473946a9 100755
--- a/test/glib/run-test.sh
+++ b/test/glib/run-test.sh
@@ -61,9 +61,9 @@ if test x$MODE = xprofile ; then
if test x$PROFILE_TYPE = x ; then
PROFILE_TYPE=all
fi
- $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-profile $PROFILE_TYPE || die "test-profile failed"
+ libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-profile $PROFILE_TYPE || die "test-profile failed"
else
- $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-dbus-glib || die "test-dbus-glib failed"
+ libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-dbus-glib || die "test-dbus-glib failed"
fi
## we kill -TERM so gcov data can be written out
diff --git a/test/glib/test-dbus-glib.c b/test/glib/test-dbus-glib.c
index 2315c97c..5ebf3b9d 100644
--- a/test/glib/test-dbus-glib.c
+++ b/test/glib/test-dbus-glib.c
@@ -62,8 +62,9 @@ main (int argc, char **argv)
int service_list_len;
int i;
guint32 result;
- char *str;
-
+ const char *v_STRING;
+ guint32 v_UINT32;
+
g_type_init ();
loop = g_main_loop_new (NULL, FALSE);
@@ -115,12 +116,14 @@ main (int argc, char **argv)
g_strfreev (service_list);
/* Test handling of unknown method */
+ v_STRING = "blah blah blah blah blah";
+ v_UINT32 = 10;
call = dbus_g_proxy_begin_call (driver, "ThisMethodDoesNotExist",
- DBUS_TYPE_STRING,
- "blah blah blah blah blah",
- DBUS_TYPE_INT32,
- 10,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING,
+ &v_STRING,
+ DBUS_TYPE_INT32,
+ &v_UINT32,
+ DBUS_TYPE_INVALID);
error = NULL;
if (dbus_g_proxy_end_call (driver, call, &error,
@@ -135,17 +138,19 @@ main (int argc, char **argv)
g_error_free (error);
/* Activate a service */
+ v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
+ v_UINT32 = 0;
call = dbus_g_proxy_begin_call (driver, "ActivateService",
- DBUS_TYPE_STRING,
- "org.freedesktop.DBus.TestSuiteEchoService",
- DBUS_TYPE_UINT32,
- 0,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING,
+ &v_STRING,
+ DBUS_TYPE_UINT32,
+ &v_UINT32,
+ DBUS_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_UINT32, &result,
- DBUS_TYPE_INVALID))
+ DBUS_TYPE_UINT32, &result,
+ DBUS_TYPE_INVALID))
{
g_printerr ("Failed to complete Activate call: %s\n",
error->message);
@@ -156,12 +161,14 @@ main (int argc, char **argv)
g_print ("Activation of echo service = 0x%x\n", result);
/* Activate a service again */
+ v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
+ v_UINT32 = 0;
call = dbus_g_proxy_begin_call (driver, "ActivateService",
- DBUS_TYPE_STRING,
- "org.freedesktop.DBus.TestSuiteEchoService",
- DBUS_TYPE_UINT32,
- 0,
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING,
+ &v_STRING,
+ DBUS_TYPE_UINT32,
+ &v_UINT32,
+ DBUS_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (driver, call, &error,
@@ -192,15 +199,16 @@ main (int argc, char **argv)
exit (1);
}
+ v_STRING = "my string hello";
call = dbus_g_proxy_begin_call (proxy, "Echo",
- DBUS_TYPE_STRING,
- "my string hello",
- DBUS_TYPE_INVALID);
+ DBUS_TYPE_STRING,
+ &v_STRING,
+ DBUS_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_STRING, &str,
- DBUS_TYPE_INVALID))
+ DBUS_TYPE_STRING, &v_STRING,
+ DBUS_TYPE_INVALID))
{
g_printerr ("Failed to complete Echo call: %s\n",
error->message);
@@ -208,8 +216,7 @@ main (int argc, char **argv)
exit (1);
}
- g_print ("String echoed = \"%s\"\n", str);
- g_free (str);
+ g_print ("String echoed = \"%s\"\n", v_STRING);
/* Test oneway call and signal handling */
diff --git a/test/glib/test-profile.c b/test/glib/test-profile.c
index 8e636d0a..55dc603f 100644
--- a/test/glib/test-profile.c
+++ b/test/glib/test-profile.c
@@ -48,7 +48,7 @@
*/
#define N_CLIENT_THREADS 1
/* It seems like at least 750000 or so iterations reduces the variability to sane levels */
-#define N_ITERATIONS 750000
+#define N_ITERATIONS 7500
#define N_PROGRESS_UPDATES 20
/* Don't make PAYLOAD_SIZE too huge because it gets used as a static buffer size */
#define PAYLOAD_SIZE 0
@@ -103,17 +103,19 @@ static void
send_echo_method_call (DBusConnection *connection)
{
DBusMessage *message;
+ const char *hello = "Hello World!";
+ dbus_int32_t i32 = 123456;
message = dbus_message_new_method_call (ECHO_SERVICE,
ECHO_PATH,
ECHO_INTERFACE,
ECHO_PING_METHOD);
dbus_message_append_args (message,
- DBUS_TYPE_STRING, "Hello World!",
- DBUS_TYPE_INT32, 123456,
+ DBUS_TYPE_STRING, &hello,
+ DBUS_TYPE_INT32, &i32,
#if PAYLOAD_SIZE > 0
DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE,
- payload, PAYLOAD_SIZE,
+ &payload, PAYLOAD_SIZE,
#endif
DBUS_TYPE_INVALID);
@@ -277,10 +279,6 @@ no_bus_init_server (ServerData *sd)
{
DBusServer *server;
DBusError error;
-
-#ifndef DBUS_DISABLE_ASSERT
- g_printerr ("You should probably --disable-asserts before you profile as they have noticeable overhead\n");
-#endif
dbus_error_init (&error);
server = dbus_server_listen ("unix:tmpdir="DBUS_TEST_SOCKET_DIR,
@@ -511,14 +509,6 @@ with_bus_init_server (ServerData *sd)
g_printerr ("You have to run with_bus mode with the run-test.sh script\n");
exit (1);
}
-
-#ifndef DBUS_DISABLE_ASSERT
- g_printerr ("You should probably --disable-asserts before you profile as they have noticeable overhead\n");
-#endif
-
-#ifdef DBUS_ENABLE_VERBOSE_MODE
- g_printerr ("You should probably --disable-verbose-mode before you profile as verbose has noticeable overhead\n");
-#endif
/* Note that we use the standard global bus connection for the
* server, and the clients open their own connections so they can
@@ -1111,6 +1101,14 @@ main (int argc, char *argv[])
g_thread_init (NULL);
dbus_g_thread_init ();
+#ifndef DBUS_DISABLE_ASSERT
+ g_printerr ("You should probably --disable-asserts before you profile as they have noticeable overhead\n");
+#endif
+
+#if DBUS_ENABLE_VERBOSE_MODE
+ g_printerr ("You should probably --disable-verbose-mode before you profile as verbose has noticeable overhead\n");
+#endif
+
payload = g_malloc (PAYLOAD_SIZE);
/* The actual size of the DBusMessage on the wire, as of Nov 23 2004,
diff --git a/test/glib/test-thread-client.c b/test/glib/test-thread-client.c
index 3a370671..07a1b12a 100644
--- a/test/glib/test-thread-client.c
+++ b/test/glib/test-thread-client.c
@@ -26,18 +26,18 @@ thread_func (gpointer data)
dbus_message_append_iter_init (message, &iter);
- if (!dbus_message_iter_append_int32 (&iter, threadnr))
+ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &threadnr))
{
g_print ("thread %d: append threadnr failed\n", threadnr);
}
- if (!dbus_message_iter_append_uint32 (&iter, counter))
+ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &counter))
{
g_print ("thread %d: append counter (%d) failed\n", threadnr, counter);
}
str = g_strdup_printf ("Thread %d-%d\n", threadnr, counter);
- if (!dbus_message_iter_append_string (&iter, str))
+ if (!dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &str))
{
g_print ("thread %d: append string (%s) failed\n", threadnr, str);
}
diff --git a/test/glib/test-thread-server.c b/test/glib/test-thread-server.c
index 3d8a3544..e61e3a6a 100644
--- a/test/glib/test-thread-server.c
+++ b/test/glib/test-thread-server.c
@@ -34,7 +34,8 @@ filter_test_message (DBusConnection *connection,
DBusMessageIter iter;
gint32 threadnr;
guint32 counter;
- char *str, *expected_str;
+ const char *str;
+ char *expected_str;
GString *counter_str;
int i;
@@ -49,7 +50,7 @@ filter_test_message (DBusConnection *connection,
g_print ("First arg not right type\n");
goto out;
}
- threadnr = dbus_message_iter_get_int32 (&iter);
+ dbus_message_iter_get_basic (&iter, &threadnr);
if (threadnr < 0 || threadnr >= N_TEST_THREADS)
{
g_print ("Invalid thread nr\n");
@@ -68,7 +69,7 @@ filter_test_message (DBusConnection *connection,
goto out;
}
- counter = dbus_message_iter_get_uint32 (&iter);
+ dbus_message_iter_get_basic (&iter, &counter);
if (counter != data->counters[threadnr])
{
@@ -89,7 +90,7 @@ filter_test_message (DBusConnection *connection,
goto out;
}
- str = dbus_message_iter_get_string (&iter);
+ dbus_message_iter_get_basic (&iter, &str);
if (str == NULL)
{
@@ -103,7 +104,6 @@ filter_test_message (DBusConnection *connection,
g_print ("Wrong string '%s', expected '%s'\n", str, expected_str);
goto out;
}
- g_free (str);
g_free (expected_str);
if (dbus_message_iter_next (&iter))
diff --git a/test/test-service.c b/test/test-service.c
index cb4ff582..3ba16bbf 100644
--- a/test/test-service.c
+++ b/test/test-service.c
@@ -58,7 +58,7 @@ handle_echo (DBusConnection *connection,
die ("No memory\n");
if (!dbus_message_append_args (reply,
- DBUS_TYPE_STRING, s,
+ DBUS_TYPE_STRING, &s,
DBUS_TYPE_INVALID))
die ("No memory");
@@ -67,8 +67,6 @@ handle_echo (DBusConnection *connection,
fprintf (stderr, "Echo service echoed string: \"%s\"\n", s);
- dbus_free (s);
-
dbus_message_unref (reply);
return DBUS_HANDLER_RESULT_HANDLED;
@@ -104,6 +102,7 @@ path_message_func (DBusConnection *connection,
{
/* Emit the Foo signal */
DBusMessage *signal;
+ double v_DOUBLE;
_dbus_verbose ("emitting signal Foo\n");
@@ -112,9 +111,10 @@ path_message_func (DBusConnection *connection,
"Foo");
if (signal == NULL)
die ("No memory\n");
-
+
+ v_DOUBLE = 42.6;
if (!dbus_message_append_args (signal,
- DBUS_TYPE_DOUBLE, 42.6,
+ DBUS_TYPE_DOUBLE, &v_DOUBLE,
DBUS_TYPE_INVALID))
die ("No memory");