From: Avinesh Kumar <akumar@suse.de>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 4/5] alarm06: cleanup and simplify
Date: Thu, 11 Aug 2022 18:43:57 +0530 [thread overview]
Message-ID: <20220811131358.18906-4-akumar@suse.de> (raw)
In-Reply-To: <20220811131358.18906-1-akumar@suse.de>
- turn description comment into docparse and reword
- remove duplicated headers
- make check fix: un-initialize static var
- test using TST_EXP_* macros
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/alarm/alarm06.c | 34 +++++------------------
1 file changed, 7 insertions(+), 27 deletions(-)
diff --git a/testcases/kernel/syscalls/alarm/alarm06.c b/testcases/kernel/syscalls/alarm/alarm06.c
index eee9429a1..e5c0d3768 100644
--- a/testcases/kernel/syscalls/alarm/alarm06.c
+++ b/testcases/kernel/syscalls/alarm/alarm06.c
@@ -5,25 +5,15 @@
* Ported to LTP: Wayne Boyer
*/
-/*
- * Check the functionality of the Alarm system call when the time input
- * parameter is zero.
+/*\
+ * [Description]
*
- * Expected Result:
- * The previously specified alarm request should be cancelled and the
- * SIGALRM should not be received.
+ * Verify that any pending alarm() is canceled when seconds is zero.
*/
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
#include "tst_test.h"
-static volatile int alarms_received = 0;
+static volatile int alarms_received;
static void sigproc(int sig)
{
@@ -38,25 +28,15 @@ static void setup(void)
static void verify_alarm(void)
{
- int ret;
-
- alarm(2);
+ TST_EXP_PASS_SILENT(alarm(2));
sleep(1);
- ret = alarm(0);
+ TST_EXP_VAL(alarm(0), 1);
/* Wait for signal SIGALRM */
sleep(2);
- if (alarms_received)
- tst_res(TFAIL, "Received %i alarms", alarms_received);
- else
- tst_res(TPASS, "Received 0 alarms");
-
- if (ret == 1)
- tst_res(TPASS, "alarm(0) returned 1");
- else
- tst_res(TFAIL, "alarm(0) returned %i, expected 1", ret);
+ TST_EXP_EQ_LU(alarms_received, 0);
}
static struct tst_test test = {
--
2.36.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-08-11 13:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 13:13 [LTP] [PATCH 1/5] alarm02: simplify using TST_EXP_* macros Avinesh Kumar
2022-08-11 13:13 ` [LTP] [PATCH 2/5] alarm03: cleanup and simplify Avinesh Kumar
2022-08-11 13:13 ` [LTP] [PATCH 3/5] alarm05: use TST_EXP_* macros Avinesh Kumar
2022-08-11 13:13 ` Avinesh Kumar [this message]
2022-08-11 13:13 ` [LTP] [PATCH 5/5] alarm07: cleanup and simplify Avinesh Kumar
2022-08-11 14:24 ` Petr Vorel
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=20220811131358.18906-4-akumar@suse.de \
--to=akumar@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox