From: Konrad Lipinski Date: Mon, 16 Jan 2017 13:11:12 +0000 (+0100) Subject: kdbus-test: -n/--notimeout getopt X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c551ea913c06313d7e193cd9bf1e28bd596d4156;p=platform%2Fkernel%2Flinux-exynos.git kdbus-test: -n/--notimeout getopt --- diff --git a/tools/testing/selftests/kdbus/kdbus-test.c b/tools/testing/selftests/kdbus/kdbus-test.c index 90dbd107cae1..cf2a6b1a8826 100644 --- a/tools/testing/selftests/kdbus/kdbus-test.c +++ b/tools/testing/selftests/kdbus/kdbus-test.c @@ -39,6 +39,7 @@ struct kdbus_test_args { bool mntns; bool pidns; bool userns; + bool no_timeout; char *uid_map; char *gid_map; int loop; @@ -453,12 +454,14 @@ static wur int test_run_forked(const struct kdbus_test *t, exit(ret); } - timer_pid = fork(); - if (timer_pid < 0) { - return TEST_ERR; - } else if (timer_pid == 0) { - sleep(t->timeout); - exit(1); + if (!kdbus_args->no_timeout) { + timer_pid = fork(); + if (timer_pid < 0) { + return TEST_ERR; + } else if (timer_pid == 0) { + sleep(t->timeout); + exit(1); + } } result = -1; @@ -469,6 +472,8 @@ static wur int test_run_forked(const struct kdbus_test *t, if (result >= 0) break; result = !WIFEXITED(ret) || WEXITSTATUS(ret) ? TEST_ERR + (timer_pid==wpid) : TEST_OK; + if (kdbus_args->no_timeout) + break; kill(wpid ^ pid ^ timer_pid, SIGKILL); } @@ -907,6 +912,7 @@ wur int main(int argc, char *argv[]) { "list", no_argument, NULL, 'l' }, { "module", required_argument, NULL, 'm' }, { "tap", no_argument, NULL, 'a' }, + { "notimeout", no_argument, NULL, 'n' }, { "mntns", no_argument, NULL, ARG_MNTNS }, { "pidns", no_argument, NULL, ARG_PIDNS }, { "userns", no_argument, NULL, ARG_USERNS }, @@ -919,7 +925,7 @@ wur int main(int argc, char *argv[]) bool gotT = 0; - while ((t = getopt_long(argc, argv, "hxftm:R:b:w:a:l", options, NULL)) >= 0) { + while ((t = getopt_long(argc, argv, "xhtflnm:R:b:w:a:", options, NULL)) >= 0) { switch (t) { case 'x': kdbus_args.loop = 1; @@ -953,6 +959,10 @@ wur int main(int argc, char *argv[]) kdbus_args.tap_output = 1; break; + case 'n': + kdbus_args.no_timeout = 1; + break; + case 'l': { unsigned i = 0;