Skip to contentSkip to conversation

syscalls: consolidate getpid02 into getppid02

PATCH Superseded Jinseok Kim 2 participants 2 messages Jul 29 – Jul 30

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 syscalls: consolidate getpid02 into getppid02

Although named getpid02, the test verifies both getpid() and getppid() across fork(). Reuse its broader coverage in getppid02 and remove the duplicated getpid02 test.

---
 runtest/syscalls                              |  1 -
 testcases/kernel/syscalls/getpid/.gitignore   |  1 -
 testcases/kernel/syscalls/getpid/getpid02.c   | 67 -------------------
 testcases/kernel/syscalls/getppid/getppid02.c | 45 +++++++++++--
 4 files changed, 38 insertions(+), 76 deletions(-)
 delete mode 100644 testcases/kernel/syscalls/getpid/getpid02.c
runtest/syscalls +0 -1
index a38743ded..62a33e3a6 100644
@@ -517,7 +517,6 @@ getpgid02 getpgid02
 getpgrp01 getpgrp01
 
 getpid01 getpid01
-getpid02 getpid02
 
 getppid01 getppid01
 getppid02 getppid02
testcases/kernel/syscalls/getpid/.gitignore +0 -1
index f44bc9eac..8e7ab0185 100644
@@ -1,2 +1 @@
 /getpid01
-/getpid02
testcases/kernel/syscalls/getpid/getpid02.c deleted +0 -67

67 lines not on this page · raw message

testcases/kernel/syscalls/getppid/getppid02.c +38 -7

69 lines not on this page · raw message

--
2.43.0

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

Hi Jinseok,

Quoted 4 lines
testcases/kernel/syscalls/getppid/getppid02.c +1 -0
+
 	if (pid == 0) {
 		pproc_id = getppid();
 

testcases/kernel/syscalls/getppid/getppid02.c static void verify_getppid(void) · line 36

Quoted 10 lines
testcases/kernel/syscalls/getppid/getppid02.c +5 -4
-		if (pproc_id != proc_id)
-			tst_res(TFAIL, "child's ppid(%d) not equal to parent's pid(%d)",
+		if (pproc_id != proc_id) {
+			tst_res(TFAIL, "child getppid() (%d) != parent getpid() (%d)",
 				pproc_id, proc_id);
-		else
-			tst_res(TPASS, "getppid() returned parent pid (%d)", proc_id);
+		} else {
+			tst_res(TPASS, "child getppid() == parent getpid() (%d)", proc_id);
+		}

You can use TST_EXP_EQ_LI.

testcases/kernel/syscalls/getppid/getppid02.c static void verify_getppid(void) · line 49

Quoted 13 lines
testcases/kernel/syscalls/getppid/getppid02.c +12 -0
+
+		*child_pid = getpid();
+
+		return;
 	}
+
+	tst_reap_children();
+
+	if (*child_pid != pid)
+		tst_res(TFAIL, "child getpid() (%d) != parent fork() (%d)", *child_pid, pid);
+	else
+		tst_res(TPASS, "child getpid() == parent fork() (%d)", pid);
+}

Here as well.

--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp