[LTP] [PATCH] lib: tst_test: tst_reinit() abort when already initialized
Li Wang
li.wang@linux.dev
Thu May 7 11:02:21 CEST 2026
> > I guess that we also need to revert:
I look into Petr's patch, seems we can go another way to replace
the checkpoint method.
How about this:
--- a/testcases/kernel/security/integrity/ima/src/ima_mmap.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_mmap.c
@@ -34,10 +34,7 @@ static void run(void)
file = SAFE_MMAP(NULL, MMAPSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
SAFE_CLOSE(fd);
- tst_reinit();
- TST_CHECKPOINT_WAIT(0);
- /* keep running until ima_violations.sh open and close file */
- TST_CHECKPOINT_WAKE_AND_WAIT(0);
+ raise(SIGSTOP);
tst_res(TPASS, "test completed");
}
diff --git a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
index d7dcd077b..e772cf53b 100755
--- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
+++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh
@@ -156,6 +156,14 @@ test2()
validate $num_violations $count $search
}
+wait_process_stopped()
+{
+ while true; do
+ [ "$(awk '{print $3}' /proc/$1/stat 2>/dev/null)" = "T" ] && break
+ usleep 100000
+ done
+}
+
test3()
{
local pid
@@ -173,13 +181,13 @@ test3()
ima_mmap -f $FILE &
pid=$!
- # wait for violations appear in logs
- TST_CHECKPOINT_WAKE_AND_WAIT 0
+ wait_process_stopped $pid
open_file_read
close_file_read
- TST_CHECKPOINT_WAKE 0
+ kill -CONT $pid
+ wait $pid
validate $num_violations $count $search
--
Regards,
Li Wang
More information about the ltp
mailing list