summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/kdbus/test-daemon.c
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-22 01:12:47 -0300
committerAndré Fabian Silva Delgado <emulatorman@parabola.nu>2016-02-22 01:12:47 -0300
commit6d461a4fe7896faa1aec5a5417888cf179e46b9f (patch)
tree2e0f1a0b7a5418189c8d53592d33a44d0b356fc9 /tools/testing/selftests/kdbus/test-daemon.c
parent5c545e1fb127a4b11ddc5f1a5ed066b853dd1a1a (diff)
Linux-libre 4.4.2-gnupck-4.4.2-gnu
Diffstat (limited to 'tools/testing/selftests/kdbus/test-daemon.c')
-rw-r--r--tools/testing/selftests/kdbus/test-daemon.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/tools/testing/selftests/kdbus/test-daemon.c b/tools/testing/selftests/kdbus/test-daemon.c
deleted file mode 100644
index 8bc238619..000000000
--- a/tools/testing/selftests/kdbus/test-daemon.c
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <errno.h>
-#include <assert.h>
-#include <poll.h>
-#include <stdbool.h>
-
-#include "kdbus-test.h"
-#include "kdbus-util.h"
-#include "kdbus-enum.h"
-
-int kdbus_test_daemon(struct kdbus_test_env *env)
-{
- struct pollfd fds[2];
- int count;
- int ret;
-
- /* This test doesn't make any sense in non-interactive mode */
- if (!kdbus_util_verbose)
- return TEST_OK;
-
- printf("Created connection %llu on bus '%s'\n",
- (unsigned long long) env->conn->id, env->buspath);
-
- ret = kdbus_name_acquire(env->conn, "com.example.kdbus-test", NULL);
- ASSERT_RETURN(ret == 0);
- printf(" Aquired name: com.example.kdbus-test\n");
-
- fds[0].fd = env->conn->fd;
- fds[1].fd = STDIN_FILENO;
-
- printf("Monitoring connections:\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, -1);
- if (ret <= 0)
- break;
-
- if (fds[0].revents & POLLIN) {
- ret = kdbus_msg_recv(env->conn, NULL, NULL);
- ASSERT_RETURN(ret == 0);
- }
-
- /* stdin */
- if (fds[1].revents & POLLIN)
- break;
- }
-
- printf("Closing bus connection\n");
-
- return TEST_OK;
-}