@@ -8,10 +8,17 @@ SUDO_CMD=$(command -v sudo)
88# re-use separately instead of all this or nothing.
99function func_exit_handler()
1010{
11+ trap - EXIT SIGTERM
1112 local exit_status=${1:- 0}
1213
1314 dlogi " Starting func_exit_handler($exit_status )"
1415
16+ if [[ -n " $DMESG_PID " ]]; then
17+ kill " $DMESG_PID " 2> /dev/null
18+ wait " $DMESG_PID " 2> /dev/null
19+ unset KERNEL_CHECKPOINT
20+ fi
21+
1522 func_lib_check_and_disable_pipewire
1623
1724 # call trace
@@ -134,32 +141,6 @@ function func_exit_handler()
134141 storage_checks || exit_status=1
135142 fi
136143
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-
163144 # get ps command result as list
164145 local -a cmd_lst
165146 # $$ as current script pid
0 commit comments