Merge pull request #1135 from joe-lawrence/integration-old-dmesg

kpatch-test dmesg fixes
This commit is contained in:
Joe Lawrence 2020-08-04 12:41:00 -04:00 committed by GitHub
commit 6c0592d401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -296,6 +296,18 @@ run_combined_test() {
}
# save existing dmesg so we can detect new content
save_dmesg() {
SAVED_DMESG="$(dmesg | tail -n1)"
}
# new dmesg entries since our saved entry
new_dmesg() {
if ! dmesg | awk -v last="$SAVED_DMESG" 'p; $0 == last{p=1} END {exit !p}'; then
error "dmesg overflow, try increasing kernel log buffer size"
fi
}
# shellcheck disable=SC1091
source /etc/os-release
if [[ "${ID}" == "rhel" && "${VERSION_ID%%.*}" == "7" && "${VERSION_ID##*.}" -le "6" ]]; then
@ -303,9 +315,6 @@ if [[ "${ID}" == "rhel" && "${VERSION_ID%%.*}" == "7" && "${VERSION_ID##*.}" -le
echo "Dynamic debug is not supported on '${PRETTY_NAME}', disabling."
fi
echo "clearing printk buffer"
sudo dmesg -C
for file in "${PATCH_LIST[@]}"; do
if [[ $QUICK != 1 || "$file" =~ -FAIL ]]; then
build_module "$file"
@ -316,6 +325,8 @@ build_combined_module
unload_all
save_dmesg
if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
prev_dyndebug=$(grep klp_try_switch_task "${DYNDEBUG_CONTROL}" | awk '{print $3;}')
echo "func klp_try_switch_task +p" >"${DYNDEBUG_CONTROL}" 2>/dev/null
@ -345,8 +356,8 @@ if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
echo "func klp_try_switch_task ${prev_dyndebug}" >"${DYNDEBUG_CONTROL}" 2>/dev/null
fi
if dmesg | grep -q "Call Trace"; then
dmesg > dmesg.log
if new_dmesg | grep -q "Call Trace"; then
new_dmesg > dmesg.log
error "kernel error detected in printk buffer"
fi