Skip to content

Commit 39043a3

Browse files
rbmarlieremetan-ucw
authored andcommitted
syscalls/pause01: Extend test to other signals
Currently, the test only covers SIGINT. Add more to the mix by parametrizing the main test function. Signed-off-by: Ricardo B. Marlière <rbm@suse.com> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
1 parent f648128 commit 39043a3

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

testcases/kernel/syscalls/pause/pause01.c

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,50 @@
1111

1212
#include "tst_test.h"
1313

14-
static void sig_handler(int sig LTP_ATTRIBUTE_UNUSED)
14+
static void sig_handler(int signal LTP_ATTRIBUTE_UNUSED)
1515
{
1616
}
1717

18-
static void do_child(void)
18+
static void do_child(int signal)
1919
{
20-
SAFE_SIGNAL(SIGINT, sig_handler);
20+
SAFE_SIGNAL(signal, sig_handler);
2121
TST_CHECKPOINT_WAKE(0);
2222
TST_EXP_FAIL(pause(), EINTR);
2323
tst_res(TPASS, "Process resumed from pause()");
2424
}
2525

26-
static void run(void)
26+
static void run(int signal)
2727
{
28-
int pid, status;
28+
int pid;
2929

3030
pid = SAFE_FORK();
3131
if (!pid) {
32-
do_child();
32+
do_child(signal);
3333
exit(0);
3434
}
3535

3636
TST_CHECKPOINT_WAIT(0);
3737
TST_PROCESS_STATE_WAIT(pid, 'S', 0);
38-
SAFE_KILL(pid, SIGINT);
38+
SAFE_KILL(pid, signal);
39+
}
40+
41+
static void run_all(void)
42+
{
43+
run(SIGHUP);
44+
run(SIGINT);
45+
run(SIGQUIT);
46+
run(SIGILL);
47+
run(SIGTRAP);
48+
run(SIGABRT);
49+
run(SIGFPE);
50+
run(SIGSEGV);
51+
run(SIGPIPE);
52+
run(SIGALRM);
53+
run(SIGTERM);
3954
}
4055

4156
static struct tst_test test = {
4257
.forks_child = 1,
4358
.needs_checkpoints = 1,
44-
.test_all = run,
59+
.test_all = run_all,
4560
};

0 commit comments

Comments
 (0)