From ae48b5d676e90e998cf6b12d3a36d5f73c45f5ea Mon Sep 17 00:00:00 2001 From: Vitaly Ostrosablin Date: Mon, 9 Jan 2017 15:26:00 +0300 Subject: [PATCH] test: add variable delta for poll.c test For ZDTM purposes, poll.c uses delta of 5 seconds, which is fine, since tests don't take a very long time to pass. However, in vzt-cpt, we start a batch with multitude of tests and starting them all could take over an hour. Hence, the test is bound to fail. An easy solution would be to introduce an environment variable, which would allow to specify the delta - ZDTM_DELTA. If it's unset (which is default behaviour in ZDTM) - it would default to 5 seconds. However, if it's set (what we can do from vzt-cpt) - then it will use delta which is set by our test. travis-ci: success for test: add variable delta for poll.c test (rev2) Signed-off-by: Vitaly Ostrosablin Reviewed-by: Cyrill Gorcunov Signed-off-by: Pavel Emelyanov --- test/zdtm/static/poll.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/zdtm/static/poll.c b/test/zdtm/static/poll.c index c0f757452..33bc0bd4a 100644 --- a/test/zdtm/static/poll.c +++ b/test/zdtm/static/poll.c @@ -43,6 +43,7 @@ int main(int argc, char *argv[]) int delta, status; task_waiter_t t; pid_t pid; + char *deltaenv; test_init(argc, argv); task_waiter_init(&t); @@ -80,7 +81,11 @@ int main(int argc, char *argv[]) show_timestamp("Start", time1.tv_sec, time1.tv_usec); task_waiter_complete(&t, 1); - delta = 5; + deltaenv = getenv("ZDTM_DELTA"); + if (deltaenv) + delta = atoi(deltaenv); + else + delta = 5; while (test_go()) { ret = poll(ufds, 2, delta * 1000); show_pollfd(ufds, 2);