[LTP] [PATCH 2/3] kernel/pec: switch to new checkpoint wait/wake interface
Li Wang
liwang@redhat.com
Mon Jun 16 12:26:18 CEST 2025
Some PEC tests were failing due to incorrect checkpoint reinitialization.
This issue was introduced by commit bf9589d5bd ("lib: moves test infrastructure
states into a shared context structure"), where the new tst_reinit() added
magic validation and can no longer be used in a standalone process.
For example:
cn_pec 1 TINFO: Test process events connector
cn_pec 1 TINFO: Testing fork event (nevents=10)
tst_test.c:203: TBROK: Invalid shared memory region (bad magic)
cn_pec 1 TBROK: tst_checkpoint wait 10000 0 failed
This patch updates the PEC test components to use the new futex-based
checkpoint mechanism via `tst_checkpoint.h`, which supports inter-process
synchronization across exec() boundaries.
Changes:
- Replace legacy `tst_reinit()` with `TST_CHECKPOINT_WAIT(id)` and
`TST_CHECKPOINT_WAKE(0)`
- Remove unnecessary braces
- Add `#include "tst_checkpoint.h"`
This improves robustness and aligns with the refactored checkpoint
infrastructure based on shared futex memory.
Follow-up: bf9589d5bd ("lib: moves test infrastructure states into a shared context structure")
Reported-by: Avinesh Kumar <akumar@suse.de>
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/connectors/pec/event_generator.c | 3 ++-
testcases/kernel/connectors/pec/pec_listener.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/connectors/pec/event_generator.c b/testcases/kernel/connectors/pec/event_generator.c
index 4945058ff..3110512ca 100644
--- a/testcases/kernel/connectors/pec/event_generator.c
+++ b/testcases/kernel/connectors/pec/event_generator.c
@@ -18,6 +18,7 @@
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
+#include "tst_checkpoint.h"
extern struct tst_test *tst_test;
static struct tst_test test = {
@@ -186,7 +187,7 @@ int main(int argc, char **argv)
/* ready to generate events */
if (checkpoint_id != -1) {
- tst_reinit();
+ tst_checkpoint_reinit(__FILE__, __LINE__, NULL);
TST_CHECKPOINT_WAIT(checkpoint_id);
}
diff --git a/testcases/kernel/connectors/pec/pec_listener.c b/testcases/kernel/connectors/pec/pec_listener.c
index 01ee91d43..2d04b2842 100644
--- a/testcases/kernel/connectors/pec/pec_listener.c
+++ b/testcases/kernel/connectors/pec/pec_listener.c
@@ -19,6 +19,7 @@
#include <signal.h>
#include <linux/types.h>
#include <linux/netlink.h>
+
#define TST_NO_DEFAULT_MAIN
#include "tst_test.h"
#include "tst_checkpoint.h"
@@ -307,7 +308,7 @@ int main(int argc, char * const argv[])
/* ready to receive events */
if (checkpoint_id != -1) {
- tst_reinit();
+ tst_checkpoint_reinit(__FILE__, __LINE__, NULL);
TST_CHECKPOINT_WAKE(0);
}
--
2.49.0
More information about the ltp
mailing list