From: Konrad Lipinski Date: Wed, 16 Nov 2016 12:35:18 +0000 (+0100) Subject: kdbus-test: conform to test runner spec X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1ae904b80c683c1a07af4f8afbdd70c420b70f2d;p=platform%2Fkernel%2Flinux-exynos.git kdbus-test: conform to test runner spec --- diff --git a/packaging/kdbusTest.spec b/packaging/kdbusTest.spec index 8d8944534ebe..ef224aaafeef 100644 --- a/packaging/kdbusTest.spec +++ b/packaging/kdbusTest.spec @@ -8,6 +8,8 @@ Source: %{name}-%{version}.tar.gz Source1001: packaging/%{name}.manifest BuildRequires: libcap-devel +%define _test_runner_dir /usr/lib/dbus-tests/runner + %description A single binary that tests kdbus operation. @@ -18,10 +20,10 @@ A single binary that tests kdbus operation. make -C tools/testing/selftests/kdbus %install -mkdir -p %{buildroot}%{_bindir} -make -C tools/testing/selftests/kdbus INSTALL_PATH=%{buildroot}%{_bindir} TEST_PROGS=kdbus-test install +mkdir -p %{buildroot}%{_test_runner_dir} +make -C tools/testing/selftests/kdbus INSTALL_PATH=%{buildroot}%{_test_runner_dir} TEST_PROGS=kdbus-test install %files %defattr(-,root,root) -%{_bindir}/kdbus-test +%{_test_runner_dir}/kdbus-test %manifest packaging/%{name}.manifest diff --git a/tools/testing/selftests/kdbus/Makefile b/tools/testing/selftests/kdbus/Makefile index 22627fa83da1..689f7efda688 100644 --- a/tools/testing/selftests/kdbus/Makefile +++ b/tools/testing/selftests/kdbus/Makefile @@ -1,7 +1,7 @@ CFLAGS += -I../../../../usr/include/ CFLAGS += -I../../../../samples/kdbus/ CFLAGS += -I../../../../include/uapi/ -CFLAGS += -std=c11 +CFLAGS += -std=c11 -Wall -Wextra -Wno-maybe-uninitialized -Wno-missing-field-initializers CFLAGS += -DKBUILD_MODNAME=\"kdbus\" -D_GNU_SOURCE LDLIBS = -pthread -lcap -lm diff --git a/tools/testing/selftests/kdbus/kdbus-test.c b/tools/testing/selftests/kdbus/kdbus-test.c index d9888a1e052a..9f39c8d0ba9f 100644 --- a/tools/testing/selftests/kdbus/kdbus-test.c +++ b/tools/testing/selftests/kdbus/kdbus-test.c @@ -32,6 +32,7 @@ struct kdbus_test { const char *desc; int (*func)(struct kdbus_test_env *env); unsigned int flags; + unsigned timeout; }; struct kdbus_test_args { @@ -44,9 +45,10 @@ struct kdbus_test_args { int wait; int fork; int tap_output; + unsigned nTests; + char const * const *tests; char *module; char *root; - char *test; char *busname; }; @@ -58,258 +60,301 @@ static const struct kdbus_test tests[] = { .desc = "bus make functions", .func = kdbus_test_bus_make, .flags = 0, + .timeout = 10, }, { .name = "hello", .desc = "the HELLO command", .func = kdbus_test_hello, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "byebye", .desc = "the BYEBYE command", .func = kdbus_test_byebye, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "chat", .desc = "a chat pattern", .func = kdbus_test_chat, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "daemon", .desc = "a simple daemon", .func = kdbus_test_daemon, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "fd-passing", .desc = "file descriptor passing", .func = kdbus_test_fd_passing, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "endpoint", .desc = "custom endpoint", .func = kdbus_test_custom_endpoint, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "monitor", .desc = "monitor functionality", .func = kdbus_test_monitor, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "name-basics", .desc = "basic name registry functions", .func = kdbus_test_name_basic, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "name-conflict", .desc = "name registry conflict details", .func = kdbus_test_name_conflict, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "name-queue", .desc = "queuing of names", .func = kdbus_test_name_queue, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "name-takeover", .desc = "takeover of names", .func = kdbus_test_name_takeover, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "message-basic", .desc = "basic message handling", .func = kdbus_test_message_basic, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "message-prio", .desc = "handling of messages with priority", .func = kdbus_test_message_prio, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "activator-quota", .desc = "activator message quotas are enforced", .func = kdbus_test_activator_quota, .flags = TEST_CREATE_BUS, + .timeout = 60, }, { .name = "message-quota", .desc = "message quotas are enforced", .func = kdbus_test_message_quota, .flags = TEST_CREATE_BUS, + .timeout = 30, }, { .name = "memory-access", .desc = "memory access", .func = kdbus_test_memory_access, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "timeout", .desc = "timeout", .func = kdbus_test_timeout, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "sync-byebye", .desc = "synchronous replies vs. BYEBYE", .func = kdbus_test_sync_byebye, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "sync-reply", .desc = "synchronous replies", .func = kdbus_test_sync_reply, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "big-meta", .desc = "big metadata", .func = kdbus_test_big_metadata, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "message-free", .desc = "freeing of memory", .func = kdbus_test_free, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "connection-info", .desc = "retrieving connection information", .func = kdbus_test_conn_info, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "connection-update", .desc = "updating connection information", .func = kdbus_test_conn_update, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "writable-pool", .desc = "verifying pools are never writable", .func = kdbus_test_writable_pool, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "policy", .desc = "policy", .func = kdbus_test_policy, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "policy-priv", .desc = "unprivileged bus access", .func = kdbus_test_policy_priv, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "policy-ns", .desc = "policy in user namespaces", .func = kdbus_test_policy_ns, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "metadata", .desc = "metadata", .func = kdbus_test_metadata, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "metadata-conn-info", .desc = "metadata in connection-info", .func = kdbus_test_metadata_conn_info, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "metadata-ns", .desc = "metadata in different namespaces", .func = kdbus_test_metadata_ns, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-id-add", .desc = "adding of matches by id", .func = kdbus_test_match_id_add, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-id-remove", .desc = "removing of matches by id", .func = kdbus_test_match_id_remove, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-replace", .desc = "replace of matches with the same cookie", .func = kdbus_test_match_replace, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-name-add", .desc = "adding of matches by name", .func = kdbus_test_match_name_add, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-name-remove", .desc = "removing of matches by name", .func = kdbus_test_match_name_remove, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-name-change", .desc = "matching for name changes", .func = kdbus_test_match_name_change, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-bloom", .desc = "matching with bloom filters", .func = kdbus_test_match_bloom, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "match-all", .desc = "itemless catch-all matching", .func = kdbus_test_match_itemless, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "activator", .desc = "activator connections", .func = kdbus_test_activator, .flags = TEST_CREATE_BUS | TEST_CREATE_CONN, + .timeout = 10, }, { .name = "benchmark", .desc = "benchmark", .func = kdbus_test_benchmark, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "benchmark-nomemfds", .desc = "benchmark without using memfds", .func = kdbus_test_benchmark_nomemfds, .flags = TEST_CREATE_BUS, + .timeout = 10, }, { .name = "benchmark-uds", .desc = "benchmark comparison to UDS", .func = kdbus_test_benchmark_uds, .flags = TEST_CREATE_BUS, + .timeout = 10, }, }; @@ -395,26 +440,39 @@ static wur int test_run(const struct kdbus_test *t, static wur int test_run_forked(const struct kdbus_test *t, const struct kdbus_test_args *kdbus_args, - int wait) + int _wait) { - int ret; - pid_t pid; + int ret, result; + pid_t pid, timer_pid; pid = fork(); if (pid < 0) { return TEST_ERR; } else if (pid == 0) { - ret = test_run(t, kdbus_args, wait); - _exit(ret); + ret = test_run(t, kdbus_args, _wait); + exit(ret); } - pid = waitpid(pid, &ret, 0); - if (pid <= 0) - return TEST_ERR; - else if (!WIFEXITED(ret)) + timer_pid = fork(); + if (timer_pid < 0) { return TEST_ERR; - else - return WEXITSTATUS(ret); + } else if (timer_pid == 0) { + sleep(t->timeout); + exit(1); + } + + result = -1; + for (;;) { + pid_t wpid = wait(&ret); + if (wpid <= 0) + return TEST_ERR; + if (result >= 0) + break; + result = !WIFEXITED(ret) || WEXITSTATUS(ret) ? TEST_ERR + (timer_pid==wpid) : TEST_OK; + kill(wpid ^ pid ^ timer_pid, SIGKILL); + } + + return result; } static void print_test_result(int ret) @@ -432,6 +490,10 @@ static void print_test_result(int ret) } } +static void print_res(struct kdbus_test const *t, int ret) { + printf("%s;%s\n", t->name, !ret ? "PASS" : TEST_TIME==ret ? "FAIL;TIMEOUT" : "FAIL"); +} + static wur int start_all_tests(struct kdbus_test_args const *kdbus_args) { int ret; @@ -468,18 +530,20 @@ static wur int start_all_tests(struct kdbus_test_args const *kdbus_args) skip_cnt++; break; case TEST_ERR: + case TEST_TIME: fail_cnt++; break; } if (kdbus_args->tap_output) { print("%sok %d - %s%s (%s)\n", - (ret == TEST_ERR) ? "not " : "", i + 1, + (ret >= TEST_ERR) ? "not " : "", i + 1, (ret == TEST_SKIP) ? "# SKIP " : "", t->desc, t->name); fflush(stdout); } else { print_test_result(ret); + print_res(t, ret); print("\n"); } } @@ -494,43 +558,45 @@ static wur int start_all_tests(struct kdbus_test_args const *kdbus_args) return fail_cnt > 0 ? TEST_ERR : TEST_OK; } -static wur int start_one_test(struct kdbus_test_args const *kdbus_args) +static wur int start_some_tests(struct kdbus_test_args const *kdbus_args) { int i, ret; bool test_found = false; + unsigned j=0, nTests = kdbus_args->nTests; + + do { + char const *tName = kdbus_args->tests[j]; + for (i = 0; i < N_TESTS; i++) { + const struct kdbus_test *t = tests + i; + + if (strcmp(t->name, tName)) + continue; + + do { + test_found = true; + if (kdbus_args->fork) + ret = test_run_forked(t, kdbus_args, + kdbus_args->wait); + else + ret = test_run(t, kdbus_args, + kdbus_args->wait); + + print("Testing %s: ", t->desc); + print_test_result(ret); + print_res(t, ret); + print("\n"); + + if (ret != TEST_OK) + break; + } while (kdbus_args->loop); + } - for (i = 0; i < N_TESTS; i++) { - const struct kdbus_test *t = tests + i; - - if (strcmp(t->name, kdbus_args->test)) - continue; - - do { - test_found = true; - if (kdbus_args->fork) - ret = test_run_forked(t, kdbus_args, - kdbus_args->wait); - else - ret = test_run(t, kdbus_args, - kdbus_args->wait); - - print("Testing %s: ", t->desc); - print_test_result(ret); - print("\n"); - - if (ret != TEST_OK) - break; - } while (kdbus_args->loop); - - return ret; - } - - if (!test_found) { - print("Unknown test-id '%s'\n", kdbus_args->test); - return TEST_ERR; - } + if (!test_found) { + print("%s;UNKNOWN\n", tName); + } + } while (++j < nTests); - return TEST_OK; + return ret; } static void usage(const char *argv0) @@ -544,7 +610,7 @@ static void usage(const char *argv0) "\t-x, --loop Run in a loop\n" "\t-f, --fork Fork before running a test\n" "\t-h, --help Print this help\n" - "\t-r, --root Toplevel of the kdbus hierarchy\n" + "\t-R, --root Toplevel of the kdbus hierarchy\n" "\t-t, --test Run one specific test only, in verbose mode\n" "\t-b, --bus Instead of generating a random bus name, take .\n" "\t-w, --wait Wait before actually starting test\n" @@ -622,8 +688,8 @@ wur int run_tests(struct kdbus_test_args const *kdbus_args) return TEST_ERR; } - if (kdbus_args->test) { - ret = start_one_test(kdbus_args); + if (kdbus_args->nTests) { + ret = start_some_tests(kdbus_args); } else { do { ret = start_all_tests(kdbus_args); @@ -718,7 +784,7 @@ wur int run_tests_in_namespaces(struct kdbus_test_args const *kdbus_args) if (ret < 0) { ret = -errno; print("error prctl(): %d (%m)\n", ret); - _exit(TEST_ERR); + exit(TEST_ERR); } /* reset sighandlers of childs */ @@ -726,25 +792,25 @@ wur int run_tests_in_namespaces(struct kdbus_test_args const *kdbus_args) if (ret < 0) { ret = -errno; print("sigaction() failed: %d (%m)\n", ret); - _exit(TEST_ERR); + exit(TEST_ERR); } ret = eventfd_read(efd, &event_status); if (ret < 0 || event_status != 1) { print("error eventfd_read()\n"); - _exit(TEST_ERR); + exit(TEST_ERR); } if (kdbus_args->mntns) { ret = test_prepare_mounts(kdbus_args); if (ret < 0) { print("error preparing mounts\n"); - _exit(TEST_ERR); + exit(TEST_ERR); } } ret = run_tests(kdbus_args); - _exit(ret); + exit(ret); } /* Setup userns mapping */ @@ -833,8 +899,8 @@ wur int main(int argc, char *argv[]) static const struct option options[] = { { "loop", no_argument, NULL, 'x' }, { "help", no_argument, NULL, 'h' }, - { "root", required_argument, NULL, 'r' }, - { "test", required_argument, NULL, 't' }, + { "root", required_argument, NULL, 'R' }, + { "test", no_argument, NULL, 't' }, { "bus", required_argument, NULL, 'b' }, { "wait", required_argument, NULL, 'w' }, { "fork", no_argument, NULL, 'f' }, @@ -851,7 +917,9 @@ wur int main(int argc, char *argv[]) srand(time(NULL)); - while ((t = getopt_long(argc, argv, "hxfm:r:t:b:w:a:l", options, NULL)) >= 0) { + bool gotT = 0; + + while ((t = getopt_long(argc, argv, "hxftm:R:b:w:a:l", options, NULL)) >= 0) { switch (t) { case 'x': kdbus_args.loop = 1; @@ -861,12 +929,12 @@ wur int main(int argc, char *argv[]) kdbus_args.module = optarg; break; - case 'r': + case 'R': kdbus_args.root = optarg; break; case 't': - kdbus_args.test = optarg; + gotT = 1; break; case 'b': @@ -887,12 +955,11 @@ wur int main(int argc, char *argv[]) case 'l': { - int i = 0; + unsigned i = 0; do { const struct kdbus_test *t = &tests[i]; printf("%s;%s\n", t->name, t->desc); } while (++i < TABSIZE(tests)-1); - } return 0; @@ -916,9 +983,13 @@ wur int main(int argc, char *argv[]) kdbus_args.gid_map = optarg; break; - default: case 'h': usage(argv[0]); + + default: + kdbus_args.tests = (char const * const *)&argv[optind]; + if (1 < (kdbus_args.nTests = argc-optind) || !gotT) + kdbus_args.fork = 1; } } diff --git a/tools/testing/selftests/kdbus/kdbus-test.h b/tools/testing/selftests/kdbus/kdbus-test.h index 9a1f5b994a69..f2c955ac3004 100644 --- a/tools/testing/selftests/kdbus/kdbus-test.h +++ b/tools/testing/selftests/kdbus/kdbus-test.h @@ -16,6 +16,7 @@ enum { TEST_OK, TEST_SKIP, TEST_ERR, + TEST_TIME, }; extern pthread_mutex_t global_print_lock; @@ -56,7 +57,7 @@ extern pthread_mutex_t global_print_lock; } while (0) #define ASSERT_RETURN_VAL(val0, relop, val1, retval) _ASSERT_REL_(val0, relop, val1, return retval) -#define ASSERT_EXIT_VAL(val0, relop, val1, exitval) _ASSERT_REL_(val0, relop, val1, _exit(exitval)) +#define ASSERT_EXIT_VAL(val0, relop, val1, exitval) _ASSERT_REL_(val0, relop, val1, exit(exitval)) #define ASSERT_RETURN(val0, relop, val1) ASSERT_RETURN_VAL(val0, relop, val1, TEST_ERR) #define ASSERT_EXIT(val0, relop, val1) ASSERT_EXIT_VAL(val0, relop, val1, TEST_ERR) diff --git a/tools/testing/selftests/kdbus/kdbus-util.h b/tools/testing/selftests/kdbus/kdbus-util.h index 3ca545cf89b5..bdcd571b0e52 100644 --- a/tools/testing/selftests/kdbus/kdbus-util.h +++ b/tools/testing/selftests/kdbus/kdbus-util.h @@ -111,7 +111,7 @@ extern int kdbus_util_verbose; ASSERT_EXIT_VAL(ret,==,0, ret); \ \ _child_; \ - _exit(0); \ + exit(0); \ } else if (pid > 0) { \ _parent_; \ rpid = waitpid(pid, &ret, 0); \ @@ -151,10 +151,10 @@ extern int kdbus_util_verbose; ret = eventfd_read(efd, &event_status); \ if (ret < 0 || event_status != 1) { \ kdbus_printf("error eventfd_read()\n"); \ - _exit(EXIT_FAILURE); \ + exit(EXIT_FAILURE); \ } \ _child_body_; \ - _exit(0); \ + exit(0); \ } else if (pid > 0) { \ _parent_setup_; \ ASSERT_RETURN(eventfd_write(efd, 1),>=,0); \ diff --git a/tools/testing/selftests/kdbus/test-endpoint.c b/tools/testing/selftests/kdbus/test-endpoint.c index c71678ec0fa0..a3e143fb26b5 100644 --- a/tools/testing/selftests/kdbus/test-endpoint.c +++ b/tools/testing/selftests/kdbus/test-endpoint.c @@ -143,7 +143,7 @@ static wur int unpriv_test_custom_ep(const char *buspath) kdbus_conn_free(ep_conn); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); }), ({})); diff --git a/tools/testing/selftests/kdbus/test-fd.c b/tools/testing/selftests/kdbus/test-fd.c index 596d977d6d4b..6f315a99496d 100644 --- a/tools/testing/selftests/kdbus/test-fd.c +++ b/tools/testing/selftests/kdbus/test-fd.c @@ -363,7 +363,7 @@ static wur int kdbus_test_no_fds(struct kdbus_test_env *env, free(msg_sync_reply); kdbus_msg_free(msg); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); } ASSERT_RETURN(-ETIMEDOUT,==,kdbus_msg_recv_poll(conn_dummy, 100, NULL, NULL)); diff --git a/tools/testing/selftests/kdbus/test-metadata-ns.c b/tools/testing/selftests/kdbus/test-metadata-ns.c index 19fec9087915..6b02ba7d7c0c 100644 --- a/tools/testing/selftests/kdbus/test-metadata-ns.c +++ b/tools/testing/selftests/kdbus/test-metadata-ns.c @@ -271,7 +271,7 @@ static wur int kdbus_clone_userns_test(const char *bus, ASSERT_EXIT_VAL(ret,==,0, -errno); ret = __kdbus_clone_userns_test(bus, conn, ppid, efd); - _exit(ret); + exit(ret); } diff --git a/tools/testing/selftests/kdbus/test-monitor.c b/tools/testing/selftests/kdbus/test-monitor.c index 979f1ea17551..a5918e51890d 100644 --- a/tools/testing/selftests/kdbus/test-monitor.c +++ b/tools/testing/selftests/kdbus/test-monitor.c @@ -146,7 +146,7 @@ wur int kdbus_test_monitor(struct kdbus_test_env *env) ASSERT_EXIT(errno,==,EPERM); ASSERT_EXIT_ZERO(monitor); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); }), ({})); diff --git a/tools/testing/selftests/kdbus/test-policy-ns.c b/tools/testing/selftests/kdbus/test-policy-ns.c index 5a28de175bac..0a630b73d0dd 100644 --- a/tools/testing/selftests/kdbus/test-policy-ns.c +++ b/tools/testing/selftests/kdbus/test-policy-ns.c @@ -300,9 +300,9 @@ static wur int kdbus_fork_test_by_id(const char *bus, * value. */ if (child_timedout) - _exit(ret == -ETIMEDOUT ? EXIT_SUCCESS : EXIT_FAILURE); + exit(ret == -ETIMEDOUT ? EXIT_SUCCESS : EXIT_FAILURE); - _exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE); + exit(ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE); } ret = kdbus_msg_recv_poll(conn_db[0], 1009, &msg, &offset); @@ -359,7 +359,7 @@ static wur int kdbus_fork_test(const char *bus, const char *name, ASSERT_EXIT_ZERO(drop_privileges(65534, 65534)); ret = kdbus_recv_in_threads(bus, name, conn_db); - _exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE); + exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE); } ASSERT_RETURN(0,<=,waitpid(pid, &status, 0)); @@ -439,7 +439,7 @@ static wur int __kdbus_clone_userns_test(const char *bus, ret = kdbus_msg_send(conn_src, name, 0xabcd1234, 0, 0, 0, KDBUS_DST_ID_NAME); kdbus_conn_free(conn_src); - _exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE); + exit(ret == expected_status ? EXIT_SUCCESS : EXIT_FAILURE); } ret = userns_map_uid_gid(pid, "0 65534 1", "0 65534 1"); @@ -472,10 +472,9 @@ static wur int kdbus_clone_userns_test(const char *bus, if (pid == 0) { ret = prctl(PR_SET_PDEATHSIG, SIGKILL); if (ret < 0) - _exit(EXIT_FAILURE); + exit(EXIT_FAILURE); - ret = __kdbus_clone_userns_test(bus, name, expected_status); - _exit(ret); + exit(__kdbus_clone_userns_test(bus, name, expected_status)); } /* diff --git a/tools/testing/selftests/kdbus/test-sync.c b/tools/testing/selftests/kdbus/test-sync.c index 265639eda194..3e7212c2be30 100644 --- a/tools/testing/selftests/kdbus/test-sync.c +++ b/tools/testing/selftests/kdbus/test-sync.c @@ -44,7 +44,7 @@ static int interrupt_sync(struct kdbus_conn *conn_src, ASSERT_EXIT(-ETIMEDOUT,==,kdbus_msg_send_sync(conn_dst, NULL, cookie, KDBUS_MSG_EXPECT_REPLY, 100000000ULL, 0, conn_src->id, -1)); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); } ASSERT_ZERO(kdbus_msg_recv_poll(conn_src, 100, &msg, NULL)); @@ -101,7 +101,7 @@ static int close_epipe_sync(const char *bus) if (-EPIPE != ret) ASSERT_EXIT(-ECONNRESET,==,ret); /* need big timeout because we're not synchronized wrt dst_id closing */ - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); } ASSERT_ZERO(kdbus_msg_send(conn_dst, NULL, cookie, 0, 0, 0, KDBUS_DST_ID_BROADCAST)); @@ -143,7 +143,7 @@ static int cancel_fd_sync(struct kdbus_conn *conn_src, if (pid == 0) { ASSERT_EXIT(-ECANCELED,==,kdbus_msg_send_sync(conn_dst, NULL, cookie, KDBUS_MSG_EXPECT_REPLY, 500000000000ULL, 0, conn_src->id, cancel_fd)); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); } ASSERT_ZERO(kdbus_msg_recv_poll(conn_src, 100, &msg, NULL)); @@ -181,7 +181,7 @@ static int no_cancel_sync(struct kdbus_conn *conn_src, if (pid == 0) { ASSERT_EXIT_ZERO(kdbus_msg_send_sync(conn_dst, NULL, cookie, KDBUS_MSG_EXPECT_REPLY, 500000000000ULL, 0, conn_src->id, cancel_fd)); - _exit(EXIT_SUCCESS); + exit(EXIT_SUCCESS); } ret = kdbus_msg_recv_poll(conn_src, 100, &msg, NULL);