summaryrefslogtreecommitdiff
path: root/test/name-test/test-pending-call-timeout.c
diff options
context:
space:
mode:
authorAdrian Szyndela <adrian.s@samsung.com>2020-04-16 12:36:37 +0200
committerAdrian Szyndela <adrian.s@samsung.com>2020-04-16 12:38:07 +0200
commit039155ecf6e61dc17705aa033756ec621003c5af (patch)
tree8bcc1262f84fc29f2bbaa60b944464590ea9453c /test/name-test/test-pending-call-timeout.c
parent4255f571aea9dbd7eba3accd1144c7df53958a7d (diff)
parentfafbca9f7ec2d004024547dda3df32becc46cf56 (diff)
downloaddbus-039155ecf6e61dc17705aa033756ec621003c5af.tar.gz
dbus-039155ecf6e61dc17705aa033756ec621003c5af.tar.bz2
dbus-039155ecf6e61dc17705aa033756ec621003c5af.zip
Merge dbus-1.12.16 into tizensubmit/tizen/20200417.133959
Change-Id: Ie55319b9a3075a1f1f12afadecc6c06c39e3dd3b
Diffstat (limited to 'test/name-test/test-pending-call-timeout.c')
-rw-r--r--test/name-test/test-pending-call-timeout.c22
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);
}