Thanks for the patch!
Acked-by: Coiby Xu coxu@redhat.com
On Thu, Dec 30, 2021 at 11:26:43AM +0800, Tao Liu wrote:
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
.../testcases/nfs-early-kdump/0-server.sh | 1 + .../testcases/nfs-early-kdump/1-client.sh | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 120000 tests/scripts/testcases/nfs-early-kdump/0-server.sh create mode 100755 tests/scripts/testcases/nfs-early-kdump/1-client.sh
diff --git a/tests/scripts/testcases/nfs-early-kdump/0-server.sh b/tests/scripts/testcases/nfs-early-kdump/0-server.sh new file mode 120000 index 0000000..3f888ce --- /dev/null +++ b/tests/scripts/testcases/nfs-early-kdump/0-server.sh @@ -0,0 +1 @@ +../nfs-kdump/0-server.sh \ No newline at end of file diff --git a/tests/scripts/testcases/nfs-early-kdump/1-client.sh b/tests/scripts/testcases/nfs-early-kdump/1-client.sh new file mode 100755 index 0000000..dfef4d8 --- /dev/null +++ b/tests/scripts/testcases/nfs-early-kdump/1-client.sh @@ -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
+}
2.33.1