From 6d461a4fe7896faa1aec5a5417888cf179e46b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Fabian=20Silva=20Delgado?= Date: Mon, 22 Feb 2016 01:12:47 -0300 Subject: Linux-libre 4.4.2-gnu --- tools/testing/selftests/kdbus/test-chat.c | 124 ------------------------------ 1 file changed, 124 deletions(-) delete mode 100644 tools/testing/selftests/kdbus/test-chat.c (limited to 'tools/testing/selftests/kdbus/test-chat.c') diff --git a/tools/testing/selftests/kdbus/test-chat.c b/tools/testing/selftests/kdbus/test-chat.c deleted file mode 100644 index 41e5b53fe..000000000 --- a/tools/testing/selftests/kdbus/test-chat.c +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "kdbus-test.h" -#include "kdbus-util.h" -#include "kdbus-enum.h" - -int kdbus_test_chat(struct kdbus_test_env *env) -{ - int ret, cookie; - struct kdbus_conn *conn_a, *conn_b; - struct pollfd fds[2]; - uint64_t flags; - int count; - - conn_a = kdbus_hello(env->buspath, 0, NULL, 0); - conn_b = kdbus_hello(env->buspath, 0, NULL, 0); - ASSERT_RETURN(conn_a && conn_b); - - flags = KDBUS_NAME_ALLOW_REPLACEMENT; - ret = kdbus_name_acquire(conn_a, "foo.bar.test", &flags); - ASSERT_RETURN(ret == 0); - - ret = kdbus_name_acquire(conn_a, "foo.bar.baz", NULL); - ASSERT_RETURN(ret == 0); - - flags = KDBUS_NAME_QUEUE; - ret = kdbus_name_acquire(conn_b, "foo.bar.baz", &flags); - ASSERT_RETURN(ret == 0); - - ret = kdbus_name_acquire(conn_a, "foo.bar.double", NULL); - ASSERT_RETURN(ret == 0); - - flags = 0; - ret = kdbus_name_acquire(conn_a, "foo.bar.double", &flags); - ASSERT_RETURN(ret == 0); - ASSERT_RETURN(!(flags & KDBUS_NAME_ACQUIRED)); - - ret = kdbus_name_release(conn_a, "foo.bar.double"); - ASSERT_RETURN(ret == 0); - - ret = kdbus_name_release(conn_a, "foo.bar.double"); - ASSERT_RETURN(ret == -ESRCH); - - ret = kdbus_list(conn_b, KDBUS_LIST_UNIQUE | - KDBUS_LIST_NAMES | - KDBUS_LIST_QUEUED | - KDBUS_LIST_ACTIVATORS); - ASSERT_RETURN(ret == 0); - - ret = kdbus_add_match_empty(conn_a); - ASSERT_RETURN(ret == 0); - - ret = kdbus_add_match_empty(conn_b); - ASSERT_RETURN(ret == 0); - - cookie = 0; - ret = kdbus_msg_send(conn_b, NULL, 0xc0000000 | cookie, 0, 0, 0, - KDBUS_DST_ID_BROADCAST); - ASSERT_RETURN(ret == 0); - - fds[0].fd = conn_a->fd; - fds[1].fd = conn_b->fd; - - kdbus_printf("-- entering poll loop ...\n"); - - for (count = 0;; count++) { - int i, nfds = sizeof(fds) / sizeof(fds[0]); - - for (i = 0; i < nfds; i++) { - fds[i].events = POLLIN | POLLPRI | POLLHUP; - fds[i].revents = 0; - } - - ret = poll(fds, nfds, 3000); - ASSERT_RETURN(ret >= 0); - - if (fds[0].revents & POLLIN) { - if (count > 2) - kdbus_name_release(conn_a, "foo.bar.baz"); - - ret = kdbus_msg_recv(conn_a, NULL, NULL); - ASSERT_RETURN(ret == 0); - ret = kdbus_msg_send(conn_a, NULL, - 0xc0000000 | cookie++, - 0, 0, 0, conn_b->id); - ASSERT_RETURN(ret == 0); - } - - if (fds[1].revents & POLLIN) { - ret = kdbus_msg_recv(conn_b, NULL, NULL); - ASSERT_RETURN(ret == 0); - ret = kdbus_msg_send(conn_b, NULL, - 0xc0000000 | cookie++, - 0, 0, 0, conn_a->id); - ASSERT_RETURN(ret == 0); - } - - ret = kdbus_list(conn_b, KDBUS_LIST_UNIQUE | - KDBUS_LIST_NAMES | - KDBUS_LIST_QUEUED | - KDBUS_LIST_ACTIVATORS); - ASSERT_RETURN(ret == 0); - - if (count > 10) - break; - } - - kdbus_printf("-- closing bus connections\n"); - kdbus_conn_free(conn_a); - kdbus_conn_free(conn_b); - - return TEST_OK; -} -- cgit v1.2.3