[LTP] [PATCH 5/5] alarm07: cleanup and simplify
Avinesh Kumar
akumar@suse.de
Thu Aug 11 15:13:58 CEST 2022
- copyright update
- description comment into docparse format and reword
- remove duplicated headers
- make check fix: un-initialize static var
- use TST_EXP_* macros
Signed-off-by: Avinesh Kumar <akumar@suse.de>
---
testcases/kernel/syscalls/alarm/alarm07.c | 31 +++++++++--------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/testcases/kernel/syscalls/alarm/alarm07.c b/testcases/kernel/syscalls/alarm/alarm07.c
index 47c30dc76..17d81f594 100644
--- a/testcases/kernel/syscalls/alarm/alarm07.c
+++ b/testcases/kernel/syscalls/alarm/alarm07.c
@@ -2,45 +2,38 @@
/*
* Copyright (c) International Business Machines Corp., 2001
* Author: Wayne Boyer
+ * Copyright (c) Linux Test Project, 2009-2022
+ */
+
+/*\
+ * [Description]
*
- * Test Description:
- * By the SIGALRM signal, check whether the previously specified alarm request
- * was cleared in the child process or not.
+ * Verify that SIGALRM signal scheduled by alarm() in the parent process
+ * is not delivered to the child process.
*/
-#include <unistd.h>
#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-
#include "tst_test.h"
-static volatile int alarm_cnt = 0;
+static volatile int alarm_cnt;
static void verify_alarm(void)
{
pid_t pid;
+
alarm_cnt = 0;
- TEST(alarm(1));
+ TST_EXP_PASS_SILENT(alarm(1));
pid = SAFE_FORK();
sleep(3);
if (pid == 0) {
- if (alarm_cnt == 0) {
- tst_res(TPASS, "alarm() request cleared in child");
- } else {
- tst_res(TFAIL, "alarm() request not cleared in "
- "child; alarms received:%d", alarm_cnt);
- }
+ TST_EXP_EQ_LU(alarm_cnt, 0);
exit(0);
}
- if (alarm_cnt != 1)
- tst_res(TFAIL, "Sigalarms in parent %i, expected 1", alarm_cnt);
- else
- tst_res(TPASS, "Got 1 sigalarm in parent");
+ TST_EXP_EQ_LU(alarm_cnt, 1);
}
static void sighandler(int sig LTP_ATTRIBUTE_UNUSED)
--
2.36.1
More information about the ltp
mailing list