Skip to contentSkip to conversation

Split waitid02.c test using new LTP API

PATCH Superseded Andrea Cervesato 2 participants 2 messages Jan 28, 2022 – Feb 16, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Split waitid02.c test using new LTP API

waitid02.c has been splitted into multiple tests which are testing a specific waitid functionality. TST_CHECKPOINT_INIT has been replaced by .needs_checkpoints

---
 runtest/syscalls                            |   7 +
 testcases/kernel/syscalls/waitid/.gitignore |   7 +
 testcases/kernel/syscalls/waitid/waitid02.c | 315 ++------------------
 testcases/kernel/syscalls/waitid/waitid03.c |  37 +++
 testcases/kernel/syscalls/waitid/waitid04.c |  54 ++++
 testcases/kernel/syscalls/waitid/waitid05.c |  47 +++
 testcases/kernel/syscalls/waitid/waitid06.c |  45 +++
 testcases/kernel/syscalls/waitid/waitid07.c |  58 ++++
 testcases/kernel/syscalls/waitid/waitid08.c |  65 ++++
 testcases/kernel/syscalls/waitid/waitid09.c |  55 ++++
 10 files changed, 401 insertions(+), 289 deletions(-)
 create mode 100644 testcases/kernel/syscalls/waitid/waitid03.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid04.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid05.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid06.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid07.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid08.c
 create mode 100644 testcases/kernel/syscalls/waitid/waitid09.c
runtest/syscalls +7 -0
index 3b2deb64e..306cc255f 100644
@@ -1696,6 +1696,13 @@ waitpid13 waitpid13
 
 waitid01 waitid01
 waitid02 waitid02
+waitid03 waitid03
+waitid04 waitid04
+waitid05 waitid05
+waitid06 waitid06
+waitid07 waitid07
+waitid08 waitid08
+waitid09 waitid09
 
 write01 write01
 write02 write02
testcases/kernel/syscalls/waitid/.gitignore +7 -0
index e200a061b..315af1690 100644
@@ -1,2 +1,9 @@
 /waitid01
 /waitid02
+/waitid03
+/waitid04
+/waitid05
+/waitid06
+/waitid07
+/waitid08
+/waitid09
testcases/kernel/syscalls/waitid/waitid02.c +26 -289

326 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid03.c new file +37 -0
new file mode 100644
index 000000000..8674ac978
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) Crackerjack Project., 2007
+ * Copyright (c) Manas Kumar Nayak [email protected]>
+ * Copyright (C) 2021 SUSE LLC Andrea Cervesato <[email protected]>
+ */
+
+/*\
+ * [Description]
+ *
+ * This test is checking if waitid() syscall returns ECHILD when the calling
+ * process has no existing unwaited-for child processes.
+ */
+
+#include <sys/wait.h>
+#include "tst_test.h"
+
+static void run(void)
+{
+	siginfo_t infop;
+
+	memset(&infop, 0, sizeof(infop));
+	TEST(waitid(P_ALL, 0, &infop, WNOHANG | WEXITED));
+
+	tst_res(TINFO, "si_pid = %d ; si_code = %d ; si_status = %d",
+		infop.si_pid, infop.si_code, infop.si_status);
+
+	if (TST_RET == -1 && TST_ERR == ECHILD)
+		tst_res(TPASS, "waitid returned ECHILD");
+	else
+		tst_res(TFAIL, "ret=%ld errno=%s", TST_RET,
+			tst_strerrno(TST_ERR));
+}
+
+static struct tst_test test = {
+	.test_all = run,
+};
testcases/kernel/syscalls/waitid/waitid04.c new file +54 -0

54 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid05.c new file +47 -0

47 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid06.c new file +45 -0

45 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid07.c new file +58 -0

58 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid08.c new file +65 -0

65 lines not on this page · raw message

testcases/kernel/syscalls/waitid/waitid09.c new file +55 -0

55 lines not on this page · raw message

Signature · 5 lines
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi!
Generally looks good, but please make use of TST_EXP_PASS() and TST_EXP_FAIL().

Signature · 5 lines
Cyril Hrubis
[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp