-
Notifications
You must be signed in to change notification settings - Fork 59
case-lib: refactor kernel logs collecting #1353
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,10 +83,6 @@ minvalue() { printf '%d' $(( "$1" < "$2" ? "$1" : "$2" )); } | |
| # | ||
| start_test() | ||
| { | ||
| if [ "$SOF_TEST_PIPEWIRE" == true ]; then | ||
| func_lib_enable_pipewire | ||
| fi | ||
|
|
||
| if is_subtest; then | ||
| return 0 | ||
| fi | ||
|
|
@@ -97,7 +93,14 @@ start_test() | |
| } | ||
|
|
||
| # func_exit_handler() is in hijack.sh | ||
| trap 'func_exit_handler $?' EXIT | ||
| trap 'func_exit_handler $?' EXIT SIGTERM | ||
|
|
||
| setup_kernel_check_point | ||
| func_kmsg_collect | ||
|
|
||
| if [ "$SOF_TEST_PIPEWIRE" == true ]; then | ||
| func_lib_enable_pipewire | ||
| fi | ||
|
|
||
| if test -z "$MAX_WAIT_FW_LOADING"; then | ||
| local _pltf; _pltf=$("$SCRIPT_HOME/tools/sof-dump-status.py" -p) | ||
|
|
@@ -157,7 +160,6 @@ start_test() | |
| local start_msg="$prefix: starting" | ||
| dlogi "$start_msg" | ||
| logger -p user.info "$start_msg" | ||
|
|
||
| } | ||
|
|
||
| # See high-level description in start_test header above | ||
|
|
@@ -198,6 +200,23 @@ stop_test() | |
| } | ||
|
|
||
|
|
||
| finish_kmsg_collection() | ||
| { | ||
| dlogi "Finishing dmesg collection" | ||
| sudo pkill -9 journalctl | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 : and stop only this This avoid killing unrelated journalctl sessions from other jobs
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As talked offline - unfortunately this solution doesn't work. The test is stuck at waiting for process to finish |
||
|
|
||
| local journalctl_logs="$LOG_ROOT/dmesg.txt" | ||
| if test -s "${journalctl_logs}"; then | ||
| wcLog=$(wc -l "${journalctl_logs}") | ||
| dlogi "nlines=$wcLog" | ||
| else | ||
| dlogw "Empty ${journalctl_logs}" | ||
| fi | ||
| # Make sure the logs are written on disk just in case of DUT power reset. | ||
| sync | ||
| } | ||
|
|
||
|
|
||
| ktime() | ||
| { | ||
| # Keep it coarse because of various delays. | ||
|
|
@@ -276,7 +295,9 @@ setup_kernel_check_point() | |
| # appear in the next one, see comments in config.sh. Add 3 extra | ||
| # second to account for our own, sof-test delays after PASS/FAIL | ||
| # decision: time spent collecting logs etc. | ||
| if [ -z "$KERNEL_CHECKPOINT" ]; then | ||
| if [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then | ||
| dlogi "KERNEL_CHECKPOINT already set as DISABLED" | ||
| elif [ -z "$KERNEL_CHECKPOINT" ]; then | ||
| KERNEL_CHECKPOINT=$(($(date +%s) - SOF_TEST_INTERVAL - 3)) | ||
| else | ||
| # Not the first time we are called so this is a test | ||
|
|
@@ -408,6 +429,21 @@ func_mtrace_collect() | |
| sudo bash -c "${mtraceCmd[*]} &" >& "$clogfile" | ||
| } | ||
|
|
||
| func_kmsg_collect() { | ||
| local journalctl_logs="$LOG_ROOT/dmesg.txt" | ||
|
|
||
| if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then | ||
| dlogi "Saving kernel messages since ${KERNEL_CHECKPOINT} to ${journalctl_logs}" | ||
| journalctl_cmd --since=@"$KERNEL_CHECKPOINT" -f >> "${journalctl_logs}" & | ||
| elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then | ||
| dlogi "KERNEL_CHECKPOINT set as DISABLED, saving all kernel messages" | ||
| journalctl_cmd -f >> "${journalctl_logs}" & | ||
| else | ||
| dlogi "KERNEL_CHECKPOINT is not properly set, saving all kernel messages" | ||
| journalctl_cmd -f >> "${journalctl_logs}" & | ||
| fi | ||
| } | ||
|
|
||
| func_lib_log_post_process() | ||
| { | ||
| # SyS-T log output a Zephyr feature, no need postprocess | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -325,8 +325,6 @@ main() | |
| { | ||
| init_globals | ||
|
|
||
| setup_kernel_check_point | ||
|
|
||
| start_test | ||
|
|
||
| check_alsa_conformance_suite | ||
|
|
||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done