This patch series adds the VM based selftest framework for
Fedora kexec-tools. Currently there are 3 test cases, more could be
added later. And the usage and details are included in the document for
selftest.
This help do quick sanity check of new patches, also help debug issues
when developing kexec-tools.
The test output looks like this:
==== Starting all tests: ====
local-kdump nfs-kdump ssh-kdump
======== Running Test Case local-kdump ========
---- Building image for: 0-local.sh ----
-------- Output image is:
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.img
-------- Building log is:
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.img.log
---- Starting test VM: 0-local.sh ----
-------- Qemu cmdline:
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.qemu_cmd
-------- Console log:
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.console
-------- Test log:
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.output
--------Test finished: local-kdump TEST PASSED
You can retrive the verify the vmcore file using following command:
./scripts/copy-from-image.sh \
/home/kasong/fedpkg/kexec-tools/tests/output/local-kdump/0-local.img \
/var/crash/127.0.0.1-2020-09-02-05:13:05/vmcore ./
Kernel package verion is: kernel-core-5.6.6-300.fc32.x86_64
======== Running Test Case nfs-kdump ========
---- Building image for: 1-client.sh ----
-------- Output image is:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/1-client.img
-------- Building log is:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/1-client.img.log
---- Building image for: 0-server.sh ----
-------- Output image is:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.img
-------- Building log is:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.img.log
---- Starting VM: 0-server.sh ----
-------- Qemu cmdline:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.qemu_cmd
-------- Console log:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.console
-------- Test log:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.output
---- Starting test VM: 1-client.sh ----
-------- Qemu cmdline:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/1-client.qemu_cmd
-------- Console log:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/1-client.console
-------- Test log:
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/1-client.output
/home/kasong/fedpkg/kexec-tools/tests/scripts/run-test.sh: line 6: kill: (2156757) - No
such process
--------Test finished: nfs-kdump TEST PASSED
You can retrive the verify the vmcore file using following command:
./scripts/copy-from-image.sh \
/home/kasong/fedpkg/kexec-tools/tests/output/nfs-kdump/0-server.img \
/srv/nfs/var/crash/192.168.77.62-2020-09-02-05:15:24/vmcore ./
Kernel package verion is: kernel-core-5.6.6-300.fc32.x86_64
======== Running Test Case ssh-kdump ========
---- Building image for: 1-client.sh ----
-------- Output image is:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/1-client.img
-------- Building log is:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/1-client.img.log
---- Building image for: 0-server.sh ----
-------- Output image is:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.img
-------- Building log is:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.img.log
---- Starting VM: 0-server.sh ----
-------- Qemu cmdline:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.qemu_cmd
-------- Console log:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.console
-------- Test log:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.output
---- Starting test VM: 1-client.sh ----
-------- Qemu cmdline:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/1-client.qemu_cmd
-------- Console log:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/1-client.console
-------- Test log:
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/1-client.output
/home/kasong/fedpkg/kexec-tools/tests/scripts/run-test.sh: line 6: kill: (2158504) - No
such process
--------Test finished: ssh-kdump TEST PASSED
You can retrive the verify the vmcore file using following command:
./scripts/copy-from-image.sh \
/home/kasong/fedpkg/kexec-tools/tests/output/ssh-kdump/0-server.img \
/var/crash/192.168.77.62-2020-09-02-05:16:26/vmcore.flat ./
Kernel package verion is: kernel-core-5.6.6-300.fc32.x86_64
======== Test results ========
----------------
nfs-kdump: TEST PASSED
----------------
ssh-kdump: TEST PASSED
----------------
local-kdump: TEST PASSED
Update from V2:
- Print the kernel version used in VM when vmcore is dumped
Update from V1:
- Add a tool and log output to let user know how to retrive the
dumped vmcore
- Fix usage of makedumpfile when extracting dmesg from vmcore to
verify vmcore is valid
- Fix some misc problems found during testing patches using selftest
framework, including Makefile dependency issue
Kairui Song (4):
selftest: Add basic infrastructure to build test image
selftest: Add basic test framework
selftest: Add document for selftests
selftest: Show the path of dumped vmcore on test end
tests/Makefile | 88 ++++++
tests/README | 65 +++++
tests/scripts/build-image.sh | 57 ++++
tests/scripts/build-scripts/base-image.sh | 10 +
.../scripts/build-scripts/test-base-image.sh | 21 ++
tests/scripts/build-scripts/test-image.sh | 21 ++
tests/scripts/copy-from-image.sh | 25 ++
tests/scripts/image-init-lib.sh | 252 ++++++++++++++++++
tests/scripts/kexec-kdump-test/init.sh | 114 ++++++++
.../kexec-kdump-test/kexec-kdump-test.service | 9 +
tests/scripts/kexec-kdump-test/test.sh | 15 ++
tests/scripts/run-test.sh | 148 ++++++++++
tests/scripts/spawn-image-shell.sh | 16 ++
tests/scripts/test-lib.sh | 177 ++++++++++++
.../scripts/testcases/local-kdump/0-local.sh | 32 +++
tests/scripts/testcases/nfs-kdump/0-server.sh | 38 +++
tests/scripts/testcases/nfs-kdump/1-client.sh | 30 +++
tests/scripts/testcases/ssh-kdump/0-server.sh | 34 +++
tests/scripts/testcases/ssh-kdump/1-client.sh | 40 +++
19 files changed, 1192 insertions(+)
create mode 100644 tests/Makefile
create mode 100644 tests/README
create mode 100755 tests/scripts/build-image.sh
create mode 100755 tests/scripts/build-scripts/base-image.sh
create mode 100755 tests/scripts/build-scripts/test-base-image.sh
create mode 100755 tests/scripts/build-scripts/test-image.sh
create mode 100755 tests/scripts/copy-from-image.sh
create mode 100644 tests/scripts/image-init-lib.sh
create mode 100755 tests/scripts/kexec-kdump-test/init.sh
create mode 100644 tests/scripts/kexec-kdump-test/kexec-kdump-test.service
create mode 100755 tests/scripts/kexec-kdump-test/test.sh
create mode 100755 tests/scripts/run-test.sh
create mode 100755 tests/scripts/spawn-image-shell.sh
create mode 100644 tests/scripts/test-lib.sh
create mode 100755 tests/scripts/testcases/local-kdump/0-local.sh
create mode 100755 tests/scripts/testcases/nfs-kdump/0-server.sh
create mode 100755 tests/scripts/testcases/nfs-kdump/1-client.sh
create mode 100755 tests/scripts/testcases/ssh-kdump/0-server.sh
create mode 100755 tests/scripts/testcases/ssh-kdump/1-client.sh
--
2.26.2
Show replies by date