[LTP] [PATCH 0/3] checkpoint: Refactor and unify shell/C reinit support

Li Wang liwang@redhat.com
Mon Jun 16 12:26:16 CEST 2025


This patch series refactors the internal checkpointing mechanism to better
support mixed shell and C test cases, especially when using exec() based
processes that synchronize via shared memory.

The changes address long-standing issues with inconsistent reinitialization
of checkpoint files across exec() boundaries, and unify the logic for both
C and Shell initialized checkpoint files.

With this patch series, the following now works correctly:

Shell-C mixed:
  C: init checkpoint + fork()
  Shell: tst_run_script() + tst_checkpint wait 1000 0
  C: TST_CHECKPOINT_WAKE(0)

Shell test:
  TST_NEEDS_CHECKPOINT=1
  Process1: TST_CHECKPOINT_WAIT(0)
  process2: TST_CHECKPOINT_WAKE(0)

C test:
  .needs_checkpoint=1
  fork() + exec("child test") + TST_CHECKPOINT_WAIT(0)
  TST_CHECKPOINT_WAKE(0)

Li Wang (3):
  shell/lib: refactor checkpoint with shared path for exec() support
  kernel/pec: switch to new checkpoint wait/wake interface
  tst_checkpoint: Detect and reinit shell or C style checkpoint file

 include/tst_checkpoint_fn.h                   | 20 +++++-
 lib/tst_checkpoint.c                          | 70 +++++++++++++------
 .../kernel/connectors/pec/event_generator.c   |  3 +-
 .../kernel/connectors/pec/pec_listener.c      |  3 +-
 testcases/lib/tst_checkpoint.c                | 62 +++++++++++++---
 testcases/lib/tst_test.sh                     |  2 +
 6 files changed, 122 insertions(+), 38 deletions(-)

-- 
2.49.0



More information about the ltp mailing list