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
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
# Executed before VM starts
|
|
|
|
on_build() {
|
|
|
|
img_add_qemu_cmd "-nic socket,listen=:8010,mac=52:54:00:12:34:56"
|
|
|
|
|
|
|
|
img_run_cmd "echo root:fedora | chpasswd"
|
|
|
|
img_run_cmd 'sed -i "s/^.*PasswordAuthentication .*\$/PasswordAuthentication yes/" /etc/ssh/sshd_config'
|
|
|
|
img_run_cmd 'sed -i "s/^.*PermitRootLogin .*\$/PermitRootLogin yes/" /etc/ssh/sshd_config'
|
|
|
|
img_run_cmd "systemctl enable sshd"
|
|
|
|
|
2020-11-18 15:33:06 +00:00
|
|
|
img_run_cmd "touch /etc/systemd/resolved.conf"
|
|
|
|
img_run_cmd "echo DNSStubListener=no >> /etc/systemd/resolved.conf"
|
|
|
|
|
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
|
|
|
img_run_cmd "echo interface=eth0 > /etc/dnsmasq.conf"
|
|
|
|
img_run_cmd "echo dhcp-authoritative >> /etc/dnsmasq.conf"
|
|
|
|
img_run_cmd "echo dhcp-range=192.168.77.50,192.168.77.100,255.255.255.0,12h >> /etc/dnsmasq.conf"
|
|
|
|
img_run_cmd "systemctl enable dnsmasq"
|
|
|
|
|
2022-10-25 10:02:04 +00:00
|
|
|
img_run_cmd 'echo [connection] > /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'echo type=ethernet >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'echo interface-name=eth0 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'echo [ipv4] >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'echo address1=192.168.77.1/24 >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'echo method=manual >> /etc/NetworkManager/system-connections/eth0.nmconnection'
|
|
|
|
img_run_cmd 'chmod 600 /etc/NetworkManager/system-connections/eth0.nmconnection'
|
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 when VM boots
|
|
|
|
on_test() {
|
|
|
|
while true; do
|
|
|
|
if has_valid_vmcore_dir /var/crash; then
|
|
|
|
test_passed
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
}
|