mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 13:38:24 -05:00
selftests/vsock: add vm_dmesg_{warn,oops}_count() helpers
These functions are reused by the VM tests to collect and compare dmesg warnings and oops counts. The future VM-specific tests use them heavily. This patches relies on vm_ssh() already supporting namespaces. Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260121-vsock-vmtest-v16-7-2859a7512097@meta.com Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
fd1b41725d
commit
4e870ac81d
@@ -380,6 +380,17 @@ host_wait_for_listener() {
|
||||
fi
|
||||
}
|
||||
|
||||
vm_dmesg_oops_count() {
|
||||
local ns=$1
|
||||
|
||||
vm_ssh "${ns}" -- dmesg 2>/dev/null | grep -c -i 'Oops'
|
||||
}
|
||||
|
||||
vm_dmesg_warn_count() {
|
||||
local ns=$1
|
||||
|
||||
vm_ssh "${ns}" -- dmesg --level=warn 2>/dev/null | grep -c -i 'vsock'
|
||||
}
|
||||
|
||||
vm_vsock_test() {
|
||||
local ns=$1
|
||||
@@ -587,8 +598,8 @@ run_shared_vm_test() {
|
||||
|
||||
host_oops_cnt_before=$(dmesg | grep -c -i 'Oops')
|
||||
host_warn_cnt_before=$(dmesg --level=warn | grep -c -i 'vsock')
|
||||
vm_oops_cnt_before=$(vm_ssh "init_ns" -- dmesg | grep -c -i 'Oops')
|
||||
vm_warn_cnt_before=$(vm_ssh "init_ns" -- dmesg --level=warn | grep -c -i 'vsock')
|
||||
vm_oops_cnt_before=$(vm_dmesg_oops_count "init_ns")
|
||||
vm_warn_cnt_before=$(vm_dmesg_warn_count "init_ns")
|
||||
|
||||
name=$(echo "${1}" | awk '{ print $1 }')
|
||||
eval test_"${name}"
|
||||
@@ -606,13 +617,13 @@ run_shared_vm_test() {
|
||||
rc=$KSFT_FAIL
|
||||
fi
|
||||
|
||||
vm_oops_cnt_after=$(vm_ssh "init_ns" -- dmesg | grep -i 'Oops' | wc -l)
|
||||
vm_oops_cnt_after=$(vm_dmesg_oops_count "init_ns")
|
||||
if [[ ${vm_oops_cnt_after} -gt ${vm_oops_cnt_before} ]]; then
|
||||
echo "FAIL: kernel oops detected on vm" | log_host
|
||||
rc=$KSFT_FAIL
|
||||
fi
|
||||
|
||||
vm_warn_cnt_after=$(vm_ssh "init_ns" -- dmesg --level=warn | grep -c -i 'vsock')
|
||||
vm_warn_cnt_after=$(vm_dmesg_warn_count "init_ns")
|
||||
if [[ ${vm_warn_cnt_after} -gt ${vm_warn_cnt_before} ]]; then
|
||||
echo "FAIL: kernel warning detected on vm" | log_host
|
||||
rc=$KSFT_FAIL
|
||||
|
||||
Reference in New Issue
Block a user