Skip to content

case-lib: refactor kernel logs collecting#1353

Open
ekurdybx wants to merge 1 commit intothesofproject:mainfrom
ekurdybx:dmesg-collection-vol-2
Open

case-lib: refactor kernel logs collecting#1353
ekurdybx wants to merge 1 commit intothesofproject:mainfrom
ekurdybx:dmesg-collection-vol-2

Conversation

@ekurdybx
Copy link
Contributor

@ekurdybx ekurdybx commented Mar 12, 2026

Refactor kernel messages collecting:

  • save journalctl logs from the start of the test, to avoid losing them in unexpected scenarios
  • move setup_kernel_check_point function to the start_test func, instead of calling it in every test in different place
  • note: some tests setup more kernel checkpoints than one, and check logs for errors every iteration etc. These setup_kernel_check_point calls remain unchanged - the general dmesg.txt since the first checkpoint still will be available though
  • in case of kernel checkpoint not being set, we collect all the journalctl logs
  • additional: fix shellcheck issues

@ekurdybx ekurdybx changed the title Dmesg collection vol 2 case-lib: refactor journalctl logs collecting Mar 12, 2026
@ekurdybx ekurdybx changed the title case-lib: refactor journalctl logs collecting case-lib: refactor kernel logs collecting Mar 12, 2026
@ekurdybx ekurdybx force-pushed the dmesg-collection-vol-2 branch 14 times, most recently from 8a6f5f4 to 5e67990 Compare March 16, 2026 15:55
@ekurdybx ekurdybx marked this pull request as ready for review March 17, 2026 09:30
@ekurdybx ekurdybx requested review from a team, golowanow, lgirdwood and marc-hb as code owners March 17, 2026 09:30
Copy link
Collaborator

@SzymonRichert SzymonRichert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

finish_kmsg_collection()
{
dlogi "Finishing dmesg collection"
sudo pkill -9 journalctl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were already disscussion that pkill -9 should be solved different way. I know there are other files containing this solution but we could do it other way. Like :
Store PID when starting it:

journalctl_cmd ... -f >> dmesg.txt &
PID=$!

and stop only this

kill -TERM "$PID"
wait "$PID"

This avoid killing unrelated journalctl sessions from other jobs

Start collecting kernel logs in the beggining of the test and run
collection in the background.

Signed-off-by: Emilia Kurdybelska <emiliax.kurdybelska@intel.com>
@ekurdybx ekurdybx force-pushed the dmesg-collection-vol-2 branch from 7b06f8e to a4a8d42 Compare March 17, 2026 14:09
# func_exit_handler() is in hijack.sh
trap 'func_exit_handler $?' EXIT
trap 'func_exit_handler $?' EXIT SIGTERM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved checkpoint setup and kmsg collector to run after the EXIT SIGTERM trap. This ensures collector lifecycle is owned by main test flow and always cleaned up by exit handler.

   setup_kernel_check_point
    func_kmsg_collect

    if [ "$SOF_TEST_PIPEWIRE" == true ]; then
        func_lib_enable_pipewire
    fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants