Skip to content

Commit 9b7fa3e

Browse files
committed
hijack.sh: Track dmesg.txt collection
Log dmesg.txt collection and warn if it is empty. Signed-off-by: Dmitrii Golovanov <dmitrii.golovanov@intel.com>
1 parent d675ecf commit 9b7fa3e

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

case-lib/hijack.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,28 @@ function func_exit_handler()
132132
storage_checks || exit_status=1
133133
fi
134134

135+
dmesg_txt="$LOG_ROOT/dmesg.txt"
135136
if [[ "$KERNEL_CHECKPOINT" =~ ^[0-9]{10} ]]; then
136137
# Do not collect the entire duration of the test but only the
137138
# last iteration.
138-
journalctl_cmd --since=@"$KERNEL_CHECKPOINT" > "$LOG_ROOT/dmesg.txt"
139+
dlogi "Save kernel messages since ${KERNEL_CHECKPOINT} to ${dmesg_txt}"
140+
journalctl_cmd --since=@"$KERNEL_CHECKPOINT" > "${dmesg_txt}"
139141
elif [[ "$KERNEL_CHECKPOINT" == "disabled" ]]; then
140-
journalctl_cmd > "$LOG_ROOT/dmesg.txt"
142+
dlogi "Save all kernel messages to ${dmesg_txt}"
143+
journalctl_cmd > "${dmesg_txt}"
141144
else
142145
dloge 'Kernel check point "KERNEL_CHECKPOINT" is not properly set'
143146
dloge "KERNEL_CHECKPOINT=$KERNEL_CHECKPOINT"
144147
test "$exit_status" -ne 0 || exit_status=1
145148
fi
149+
# Check the dmesg.txt
150+
if test -s "${dmesg_txt}"; then
151+
wcLog=$(wc -l "${dmesg_txt}")
152+
dlogi "nlines=$wcLog"
153+
else
154+
dlogw "Empty ${dmesg_txt}"
155+
fi
156+
146157
# After log collected, KERNEL_CHECKPOINT will not be used any more
147158
unset KERNEL_CHECKPOINT
148159

0 commit comments

Comments
 (0)