Skip to content

Commit f947a50

Browse files
committed
Revert "hijack.sh: exit_handler: collect dmesg throughout the whole test"
This reverts commit c341de8.
1 parent c341de8 commit f947a50

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

case-lib/hijack.sh

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ function func_exit_handler()
1212

1313
dlogi "Starting func_exit_handler($exit_status)"
1414

15-
finish_kmsg_collection
16-
1715
func_lib_check_and_disable_pipewire
1816

1917
# call trace
@@ -136,6 +134,32 @@ function func_exit_handler()
136134
storage_checks || exit_status=1
137135
fi
138136

137+
local journalctl_logs="$LOG_ROOT/dmesg.txt"
138+
if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then
139+
# Do not collect the entire duration of the test but only the
140+
# last iteration.
141+
dlogi "Save kernel messages since ${KERNEL_CHECKPOINT} to ${journalctl_logs}"
142+
journalctl_cmd --since=@"$KERNEL_CHECKPOINT" > "${journalctl_logs}"
143+
elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then
144+
dlogi "Save all kernel messages to ${journalctl_logs}"
145+
journalctl_cmd > "${journalctl_logs}"
146+
else
147+
dloge 'Kernel check point "KERNEL_CHECKPOINT" is not properly set'
148+
dloge "KERNEL_CHECKPOINT=$KERNEL_CHECKPOINT"
149+
test "$exit_status" -ne 0 || exit_status=1
150+
fi
151+
if test -s "${journalctl_logs}"; then
152+
wcLog=$(wc -l "${journalctl_logs}")
153+
dlogi "nlines=$wcLog"
154+
else
155+
dlogw "Empty ${journalctl_logs}"
156+
fi
157+
# Make sure the logs are written on disk just in case of DUT power reset.
158+
sync
159+
160+
# After log collected, KERNEL_CHECKPOINT will not be used any more
161+
unset KERNEL_CHECKPOINT
162+
139163
# get ps command result as list
140164
local -a cmd_lst
141165
# $$ as current script pid

case-lib/lib.sh

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ start_test()
9797
}
9898

9999
# func_exit_handler() is in hijack.sh
100-
trap 'func_exit_handler $?' EXIT SIGTERM
100+
trap 'func_exit_handler $?' EXIT
101101

102102
if test -z "$MAX_WAIT_FW_LOADING"; then
103103
local _pltf; _pltf=$("$SCRIPT_HOME/tools/sof-dump-status.py" -p)
@@ -125,7 +125,6 @@ start_test()
125125
die "FW is not loaded for $MAX_WAIT_FW_LOADING"
126126
fi
127127
}
128-
func_kmsg_collect
129128

130129
export SOF_TEST_TOP_PID="$$"
131130
local prefix; prefix="ktime=$(ktime) sof-test PID=${SOF_TEST_TOP_PID}"
@@ -199,26 +198,6 @@ stop_test()
199198
}
200199

201200

202-
finish_kmsg_collection()
203-
{
204-
if [[ -n "$DMESG_PID" ]]; then
205-
kill "$DMESG_PID" 2>/dev/null
206-
wait "$DMESG_PID" 2>/dev/null
207-
unset KERNEL_CHECKPOINT
208-
fi
209-
210-
local journalctl_logs="$LOG_ROOT/dmesg.txt"
211-
if test -s "${journalctl_logs}"; then
212-
wcLog=$(wc -l "${journalctl_logs}")
213-
dlogi "nlines=$wcLog"
214-
else
215-
dlogw "Empty ${journalctl_logs}"
216-
fi
217-
# Make sure the logs are written on disk just in case of DUT power reset.
218-
sync
219-
}
220-
221-
222201
ktime()
223202
{
224203
# Keep it coarse because of various delays.
@@ -429,24 +408,6 @@ func_mtrace_collect()
429408
sudo bash -c "${mtraceCmd[*]} &" >& "$clogfile"
430409
}
431410

432-
func_kmsg_collect() {
433-
local journalctl_logs="$LOG_ROOT/dmesg.txt"
434-
435-
if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then
436-
dlogi "Saving kernel messages since ${KERNEL_CHECKPOINT} to ${journalctl_logs}"
437-
journalctl_cmd --since=@"$KERNEL_CHECKPOINT" -f >> "${journalctl_logs}" &
438-
elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then
439-
dlogi "Saving all kernel messages"
440-
journalctl_cmd -f >> "${journalctl_logs}" &
441-
else
442-
dloge 'Kernel check point "KERNEL_CHECKPOINT" is not properly set'
443-
dloge "KERNEL_CHECKPOINT=$KERNEL_CHECKPOINT"
444-
test "$exit_status" -ne 0 || exit_status=1
445-
return
446-
fi
447-
DMESG_PID=$!
448-
}
449-
450411
func_lib_log_post_process()
451412
{
452413
# SyS-T log output a Zephyr feature, no need postprocess

0 commit comments

Comments
 (0)