Hi Martin, all, > Hi, > for both patches:
> Reviewed-by: Martin Doucha <[email protected]> Thanks for review, patchset merged. Kind regards, Petr > On 4/28/26 18:10, Petr Vorel wrote: > > Using checkpoints is a proper way in LTP new API [1] to avoid races and > > waste of time. It reduces 3 sec sleep in ima_mmap.c and 1 sec sleep in > > ima_violations.sh with just checkpoints. > > NOTE: tst_reinit() is really needed instead of .needs_checkpoints = 1 > > as documented in Shell-Test-API.asciidoc. > > [1] > > https://people.kernel.org/metan/why-sleep-is-almost-never-acceptable-in-tests > > Fixes: 0e4cbf753f ("security/ima: Rewrite tests into new API + fixes") > > Suggested-by: Cyril Hrubis <[email protected]> > > Signed-off-by: Petr Vorel <[email protected]> > > --- > > testcases/kernel/security/integrity/ima/src/ima_mmap.c | 7 ++++--- > > .../kernel/security/integrity/ima/tests/ima_violations.sh | 6 +++++- > > 2 files changed, 9 insertions(+), 4 deletions(-) > > diff --git a/testcases/kernel/security/integrity/ima/src/ima_mmap.c > > b/testcases/kernel/security/integrity/ima/src/ima_mmap.c > > index 8596809ef4..09b22fd4f4 100644 > > --- a/testcases/kernel/security/integrity/ima/src/ima_mmap.c > > +++ b/testcases/kernel/security/integrity/ima/src/ima_mmap.c > > @@ -9,7 +9,6 @@ > > #include "tst_test.h" > > -#define SLEEP_AFTER_CLOSE 3 > > #define MMAPSIZE 1024 > > static char *filename; > > @@ -35,8 +34,10 @@ static void run(void) > > file = SAFE_MMAP(NULL, MMAPSIZE, PROT_READ | PROT_WRITE, MAP_SHARED, > > fd, 0); > > SAFE_CLOSE(fd); > > - tst_res(TINFO, "sleep %ds", SLEEP_AFTER_CLOSE); > > - sleep(SLEEP_AFTER_CLOSE); > > + tst_reinit(); > > + TST_CHECKPOINT_WAIT(0); > > + /* keep running until ima_violations.sh open and close file */ > > + TST_CHECKPOINT_WAKE_AND_WAIT(0); > > 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 0c03c30786..d7dcd077b4 100755 > > --- a/testcases/kernel/security/integrity/ima/tests/ima_violations.sh > > +++ b/testcases/kernel/security/integrity/ima/tests/ima_violations.sh > > @@ -8,6 +8,7 @@ > > # test[4-6] test 6.15 commit 5b3cd801155f ("ima: limit the number of > > open-writers integrity violations") > > # test[7-8] test 6.15 commit a414016218ca ("ima: limit the number of > > ToMToU integrity violations") > > +TST_NEEDS_CHECKPOINTS=1 > > TST_SETUP="setup" > > TST_CLEANUP="cleanup" > > TST_CNT=8 > > @@ -171,12 +172,15 @@ test3() > > ima_mmap -f $FILE & > > pid=$! > > + > > # wait for violations appear in logs > > - tst_sleep 1s > > + TST_CHECKPOINT_WAKE_AND_WAIT 0 > > open_file_read > > close_file_read > > + TST_CHECKPOINT_WAKE 0 > > + > > validate $num_violations $count $search > > # wait for ima_mmap to exit, so we can umount
