From f8bb9c36533e64c72bf5b2f4f650efe0f83c6d05 Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Thu, 27 Jun 2013 23:32:27 +0400 Subject: [PATCH] posix-timer: Add test non consequent timer ids Add fake timers to inshure that then timer ids don't go one after another c/r go well. Signed-off-by: Pavel Tikhomirov Signed-off-by: Pavel Emelyanov --- test/zdtm/live/static/posix_timers.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/zdtm/live/static/posix_timers.c b/test/zdtm/live/static/posix_timers.c index ae9a88205..31573f6c4 100644 --- a/test/zdtm/live/static/posix_timers.c +++ b/test/zdtm/live/static/posix_timers.c @@ -205,6 +205,8 @@ static void realtime_oneshot_handler(int sig, siginfo_t *si, void *uc) static int setup_timers(void) { + int i; + int ret; struct posix_timers_info *info = posix_timers; struct sigevent sev; struct itimerspec its; @@ -222,6 +224,21 @@ static int setup_timers(void) info = posix_timers; while(info->handler) { + /* Add and delete fake timers to test restoring 'with holes' */ + timer_t timeridt; + for (i = 0; i < 10; i++) { + ret = timer_create(CLOCK_REALTIME, NULL, &timeridt); + if (ret < 0) { + err("Can't create temporary posix timer %lx\n", (long) timeridt); + return -errno; + } + ret = timer_delete(timeridt); + if (ret < 0) { + err("Can't remove temporaty posix timer %lx\n", (long) timeridt); + return -errno; + } + } + info->sa.sa_flags = SA_SIGINFO; info->sa.sa_sigaction = info->handler; sigemptyset(&info->sa.sa_mask);