selftest: Add early kdump test
This patch will introduce early kdump test. It reuses the code of nfs kdump test, in order to setup 2 seperated VMs, one(the client) for trigger the early kdump and crash, the other(the server) for saving vmcore and check if vmcore exists. In order to minimize the repetted code, a soft link is made to copy the same server side code. Signed-off-by: Tao Liu <ltao@redhat.com> Acked-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
parent
f4ab396574
commit
aa9e70349b
1
tests/scripts/testcases/nfs-early-kdump/0-server.sh
Symbolic link
1
tests/scripts/testcases/nfs-early-kdump/0-server.sh
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../nfs-kdump/0-server.sh
|
46
tests/scripts/testcases/nfs-early-kdump/1-client.sh
Executable file
46
tests/scripts/testcases/nfs-early-kdump/1-client.sh
Executable file
@ -0,0 +1,46 @@
|
|||||||
|
# Executed before VM starts
|
||||||
|
on_build() {
|
||||||
|
img_inst_pkg "nfs-utils"
|
||||||
|
img_add_qemu_cmd "-nic socket,connect=127.0.0.1:8010,mac=52:54:00:12:34:57"
|
||||||
|
}
|
||||||
|
|
||||||
|
on_test() {
|
||||||
|
local boot_count=$(get_test_boot_count)
|
||||||
|
local nfs_server=192.168.77.1
|
||||||
|
local earlykdump_path="/usr/lib/dracut/modules.d/99earlykdump/early-kdump.sh"
|
||||||
|
local tmp_file="/tmp/.tmp-file"
|
||||||
|
|
||||||
|
if [[ ! -f $earlykdump_path ]]; then
|
||||||
|
test_failed "early-kdump.sh not exist!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $boot_count -eq 1 ]; then
|
||||||
|
cat << EOF > /etc/kdump.conf
|
||||||
|
nfs $nfs_server:/srv/nfs
|
||||||
|
core_collector makedumpfile -l --message-level 7 -d 31
|
||||||
|
final_action poweroff
|
||||||
|
EOF
|
||||||
|
|
||||||
|
while ! ping -c 1 $nfs_server -W 1; do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
kdumpctl start \
|
||||||
|
|| test_failed "Failed to start kdump"
|
||||||
|
grubby --update-kernel=ALL --args=rd.earlykdump
|
||||||
|
|
||||||
|
cat << EOF > $tmp_file
|
||||||
|
echo 1 > /proc/sys/kernel/sysrq
|
||||||
|
echo c > /proc/sysrq-trigger
|
||||||
|
EOF
|
||||||
|
sed -i "/early_kdump_load$/r $tmp_file" $earlykdump_path
|
||||||
|
dracut -f --add earlykdump
|
||||||
|
kdumpctl restart \
|
||||||
|
|| test_failed "Failed to start earlykdump"
|
||||||
|
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
else
|
||||||
|
test_failed "Unexpected reboot"
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user