mem: Convert shmt02 to new API
PATCH v4 1/1 mem: Convert shmt02 to new API
From: Ricardo B. Marlière <[email protected]>
---
Changes in v4:
- Drop unneeded errno and register
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Use GETIPCKEY()
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Use tst_rand_data and TST_EXP_EQ_STRN()
- Link to v1: https://lore.kernel.org/r/[email protected]
--- testcases/kernel/mem/shmt/Makefile | 5 ++ testcases/kernel/mem/shmt/shmt02.c | 124 +++++++------------------------------ 2 files changed, 28 insertions(+), 101 deletions(-)
testcases/kernel/mem/shmt/Makefile +5 -0
@@ -22,5 +22,10 @@ top_srcdir ?= ../../../.. +LTPLIBS = newipc + include $(top_srcdir)/include/mk/testcases.mk + +shmt02: LTPLDLIBS = -lltpnewipc + include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/shmt/shmt02.c +23 -101
143 lines not on this page · raw message
---
base-commit: df591113afeb31107bc45bd5ba28a99b556d1028
change-id: 20250623-conversions-shmt-46f5b6ac96de
Best regards,
Signature · 5 lines
Ricardo B. Marlière <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Merged with a small change because I realized my suggestion to use TST_EXP_EQ_STRN() was not matching LTP standards (data != strings).
testcases/kernel/mem/shmt/shmt02.c +0 -0
@@ -34,7 +34,12 @@ static void run(void)
SAFE_SHMCTL(shmid, IPC_RMID, NULL);
- TST_EXP_EQ_STRN(cp, tst_rand_data, SHMSIZE);
+ if (memcmp(cp, tst_rand_data, SHMSIZE) != 0) {
+ tst_res(TFAIL, "Copied data changed after IPC_RMID"); + return;
+ }
+
+ tst_res(TPASS, "Copied data has been read back"); }
static struct tst_test test = {
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Quoted 11 lines · Andrea Cervesato
Hi!
Merged with a small change because I realized my suggestion to use
TST_EXP_EQ_STRN()was not matching LTP standards (data != strings).testcases/kernel/mem/shmt/shmt02.c +0
-0
testcases/kernel/mem/shmt/shmt02.c static void run(void) · line 42
Quoted 10 lines
testcases/kernel/mem/shmt/shmt02.c +6
-1@@ -34,7 +34,12 @@ static void run(void) SAFE_SHMCTL(shmid, IPC_RMID, NULL); - TST_EXP_EQ_STRN(cp, tst_rand_data, SHMSIZE); + if (memcmp(cp, tst_rand_data, SHMSIZE) != 0) { + tst_res(TFAIL, "Copied data changed after IPC_RMID"); + return; + } + + tst_res(TPASS, "Copied data has been read back");
Ah, indeed. Thank you!
Quoted 5 lines
testcases/kernel/mem/shmt/shmt02.c +0
-1} static struct tst_test test = { - Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp