All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH V3] syscalls/timer_settime01: Make sure the timer fires
Date: Tue, 14 Jul 2020 16:28:43 +0200	[thread overview]
Message-ID: <20200714142843.GA14905@yuki.lan> (raw)
In-Reply-To: <47e40724c2a7a9612aca0265e493e62c69d65996.1594204153.git.viresh.kumar@linaro.org>

Hi!
Pushed with minor changes, thanks.

Among other fixes I've moved the signal check from the signal handler to
the clear_signal() function, since the tst_res() function is not
signal-async-safe...

diff --git a/testcases/kernel/syscalls/timer_settime/timer_settime01.c b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
index f9d1456da..76f283b81 100644
--- a/testcases/kernel/syscalls/timer_settime/timer_settime01.c
+++ b/testcases/kernel/syscalls/timer_settime/timer_settime01.c
@@ -10,7 +10,7 @@
 /*
  * This tests the timer_settime(2) syscall under various conditions:
  *
- * 1) General initialization: No old_value, no flags, 5-second-timer
+ * 1) General initialization: No old_value, no flags
  * 2) Setting a pointer to a itimerspec struct as old_set parameter
  * 3) Using a periodic timer
  * 4) Using absolute time
@@ -38,10 +38,10 @@ static struct testcase {
 	int			flag;
 	char			*description;
 } tcases[] = {
-	{NULL, 100000, 0, 0, "general initialization"},
-	{&old_set, 100000, 0, 0, "setting old_value"},
-	{&old_set, 100000, 100000, 0, "using periodic timer"},
-	{&old_set, 100000, 0, TIMER_ABSTIME, "using absolute time"},
+	{NULL, 50000, 0, 0, "general initialization"},
+	{&old_set, 50000, 0, 0, "setting old_value"},
+	{&old_set, 50000, 50000, 0, "using periodic timer"},
+	{&old_set, 50000, 0, TIMER_ABSTIME, "using absolute time"},
 };
 
 static struct test_variants {
@@ -71,15 +71,17 @@ static void clear_signal(void)
 	 */
 	while (!caught_signal);
 
+	if (caught_signal != SIGALRM) {
+		tst_res(TFAIL, "Received incorrect signal: %s",
+			tst_strsig(caught_signal));
+	}
+
 	caught_signal = 0;
 }
 
 static void sighandler(int sig)
 {
-	if (sig != SIGALRM)
-		tst_res(TFAIL, "Received incorrect signal: %d", sig);
-
-	caught_signal = 1;
+	caught_signal = sig;
 }
 
 static void setup(void)

-- 
Cyril Hrubis
chrubis@suse.cz

  reply	other threads:[~2020-07-14 14:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 11:43 [LTP] [PATCH 1/2] syscalls/timer_settime01: Improve print messages Viresh Kumar
2020-06-29 11:43 ` [LTP] [PATCH 2/2] syscalls/timer_settime01: Make sure the timer fires Viresh Kumar
2020-06-29 12:05   ` Arnd Bergmann
2020-06-29 12:13     ` Cyril Hrubis
2020-06-30  2:27       ` Viresh Kumar
2020-06-30  2:36 ` [LTP] [PATCH V1.1 " Viresh Kumar
2020-07-02 13:34 ` [LTP] [PATCH 1/2] syscalls/timer_settime01: Improve print messages Cyril Hrubis
2020-07-03  2:22   ` Viresh Kumar
2020-07-03  2:39 ` [LTP] [PATCH V2] syscalls/timer_settime01: Make sure the timer fires Viresh Kumar
2020-07-07 15:02   ` Cyril Hrubis
2020-07-08 10:31   ` [LTP] [PATCH V3] " Viresh Kumar
2020-07-14 14:28     ` Cyril Hrubis [this message]
2020-07-15  2:36       ` Viresh Kumar
2020-07-15  8:53         ` Cyril Hrubis
2020-07-23  2:39       ` Yang Xu
2020-07-24  3:37         ` Viresh Kumar
2020-07-24  5:07           ` Yang Xu
2020-07-24 10:18             ` Viresh Kumar
2020-07-24 10:27               ` Yang Xu
2020-07-24 13:29             ` Cyril Hrubis
2020-07-24 15:01               ` Yang Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714142843.GA14905@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.