selftest: Add basic test framework
Now, by execute `make test-run` in tests/, kexec-tools sanity tests
will be performed using VMs. There are currently 3 test cases, for local
kdump, nfs kdump and ssh kdump.
For each test VM, the selftest framework will create a snapshot layer,
do setup as required by the test case, this ensure each test runs in a
clean VM.
This framework will install a custom systemd service that starts when
system have finished booting, and the service will do basic routine
(fetch and set boot counter, etc..), then call the test case which is
installed in /kexec-kdump-test/test.sh in VM.
Each VM will have two serial consoles, one for ordinary console usage,
one for the test communication and log. The test script will watch the
second test console to know the test status.
The test cases are located in tests/scripts/testcases, documents about
the test cases structure will be provided in following commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-07-31 07:34:40 +00:00
|
|
|
# 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
|
|
|
|
|
|
|
|
if [ "$boot_count" -eq 1 ]; then
|
|
|
|
cat << EOF > /etc/kdump.conf
|
|
|
|
nfs $nfs_server:/srv/nfs
|
2020-10-26 08:27:05 +00:00
|
|
|
core_collector makedumpfile -l --message-level 7 -d 31
|
selftest: Add basic test framework
Now, by execute `make test-run` in tests/, kexec-tools sanity tests
will be performed using VMs. There are currently 3 test cases, for local
kdump, nfs kdump and ssh kdump.
For each test VM, the selftest framework will create a snapshot layer,
do setup as required by the test case, this ensure each test runs in a
clean VM.
This framework will install a custom systemd service that starts when
system have finished booting, and the service will do basic routine
(fetch and set boot counter, etc..), then call the test case which is
installed in /kexec-kdump-test/test.sh in VM.
Each VM will have two serial consoles, one for ordinary console usage,
one for the test communication and log. The test script will watch the
second test console to know the test status.
The test cases are located in tests/scripts/testcases, documents about
the test cases structure will be provided in following commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-07-31 07:34:40 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
while ! ping -c 1 $nfs_server -W 1; do
|
2020-11-18 15:33:06 +00:00
|
|
|
sleep 1
|
selftest: Add basic test framework
Now, by execute `make test-run` in tests/, kexec-tools sanity tests
will be performed using VMs. There are currently 3 test cases, for local
kdump, nfs kdump and ssh kdump.
For each test VM, the selftest framework will create a snapshot layer,
do setup as required by the test case, this ensure each test runs in a
clean VM.
This framework will install a custom systemd service that starts when
system have finished booting, and the service will do basic routine
(fetch and set boot counter, etc..), then call the test case which is
installed in /kexec-kdump-test/test.sh in VM.
Each VM will have two serial consoles, one for ordinary console usage,
one for the test communication and log. The test script will watch the
second test console to know the test status.
The test cases are located in tests/scripts/testcases, documents about
the test cases structure will be provided in following commits.
Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Dave Young <dyoung@redhat.com>
2020-07-31 07:34:40 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
kdumpctl start || test_failed "Failed to start kdump"
|
|
|
|
|
|
|
|
sync
|
|
|
|
|
|
|
|
echo 1 > /proc/sys/kernel/sysrq
|
|
|
|
echo c > /proc/sysrq-trigger
|
|
|
|
else
|
|
|
|
shutdown -h 0
|
|
|
|
fi
|
|
|
|
}
|