diff options
Diffstat (limited to 'test/name-test/test-pending-call-timeout.c')
-rw-r--r-- | test/name-test/test-pending-call-timeout.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/test/name-test/test-pending-call-timeout.c b/test/name-test/test-pending-call-timeout.c index d051faba..a204db01 100644 --- a/test/name-test/test-pending-call-timeout.c +++ b/test/name-test/test-pending-call-timeout.c @@ -17,7 +17,7 @@ _method_call (DBusConnection *conn, DBusPendingCall *pending; DBusMessage *method; DBusMessage *reply; - char *echo = "echo"; + const char *echo = "echo"; /* send the message */ method = dbus_message_new_method_call ("org.freedesktop.DBus.TestSuiteEchoService", @@ -25,8 +25,13 @@ _method_call (DBusConnection *conn, "org.freedesktop.TestSuite", "DelayEcho"); - dbus_message_append_args (method, DBUS_TYPE_STRING, &echo, NULL); - dbus_connection_send_with_reply (conn, method, &pending, timeout_milliseconds); + if (method == NULL || + !dbus_message_append_args (method, DBUS_TYPE_STRING, &echo, NULL) || + !dbus_connection_send_with_reply (conn, method, &pending, timeout_milliseconds)) + { + printf ("Bail out! OOM when building and sending message ***\n"); + exit (1); + } dbus_message_unref (method); /* block on the message */ @@ -39,13 +44,13 @@ _method_call (DBusConnection *conn, if (reply == NULL) { - printf ("Failed: Reply is NULL ***\n"); + printf ("Bail out! Reply is NULL ***\n"); exit (1); } if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR) { - printf ("Failed: Reply is error: %s ***\n", dbus_message_get_error_name (reply)); + printf ("Bail out! Reply is error: %s ***\n", dbus_message_get_error_name (reply)); exit (1); } @@ -61,6 +66,7 @@ _run_iteration (DBusConnection *conn) _method_call (conn, INT_MAX); } +/* This test outputs TAP syntax: http://testanything.org/ */ int main (int argc, char *argv[]) { @@ -71,7 +77,7 @@ main (int argc, char *argv[]) DBusConnection *conn; DBusError error; - printf ("*** Testing pending call timeouts\n"); + printf ("# Testing pending call timeouts\n"); dbus_error_init (&error); @@ -88,7 +94,7 @@ main (int argc, char *argv[]) /* we just care about seconds */ delta = end_tv_sec - start_tv_sec; - printf ("Iter %i: %lis\n", i, delta); + printf ("ok %d - %lis\n", i + 1, delta); } method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService", @@ -98,6 +104,6 @@ main (int argc, char *argv[]) dbus_connection_send (conn, method, NULL); dbus_message_unref (method); - printf ("Success ***\n"); + printf ("# Testing completed\n1..%d\n", i); exit (0); } |