kexec-tools heavily depends on dracut and occasionally breaks because the change of dracut.
I'm now adding kdump test [1] to dracut which will clone kexec-tools' rawhide branch and run kexec-tools' basic functionality tests.
This patch set prepares kexec-tools for running the tests by dracut.
[1] https://github.com/coiby/dracut/tree/kexec_tools_tests
Coiby Xu (3): selftest: Fix bug of collecting test RPMs from argument selftest: add DRACUT_RPMs so dracut RPMs can be installed onto the image to run the tests selftest: replace qemu-kvm with one based on dracut's run-qemu
tests/Makefile | 2 +- .../scripts/build-scripts/test-base-image.sh | 2 +- tests/scripts/run-qemu | 23 +++++++++++++++++++ tests/scripts/test-lib.sh | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 tests/scripts/run-qemu
Currently, TEST_RPMS would be only using the last RPM. Append each RPM path to TEST_RPMs instead,
Signed-off-by: Coiby Xu coxu@redhat.com --- tests/scripts/build-scripts/test-base-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/scripts/build-scripts/test-base-image.sh b/tests/scripts/build-scripts/test-base-image.sh index 5e2d86a..afe1a97 100755 --- a/tests/scripts/build-scripts/test-base-image.sh +++ b/tests/scripts/build-scripts/test-base-image.sh @@ -6,7 +6,7 @@ for _rpm in $@; do if [[ ! -e $_rpm ]]; then perror_exit "'$_rpm' not found" else - TEST_RPMS=$(realpath "$_rpm") + TEST_RPMS="$TEST_RPMS $(realpath "$_rpm")" fi done
dracut will build the PRMs which will be installed onto the image to run the tests.
Signed-off-by: Coiby Xu coxu@redhat.com --- tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile index 71b329b..3403e6f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -74,7 +74,7 @@ $(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS $(BUILD_ROOT)/inst-base-image \ $(TEST_ROOT)/output/test-base-image \ $(TEST_ROOT)/scripts/build-scripts/test-base-image.sh \ - $(KEXEC_TOOLS_RPM) + $(KEXEC_TOOLS_RPM) $(DRACUT_RPMs)
test-run: $(TEST_ROOT)/output/test-base-image ifeq ($(strip $(TEST_CASE)),)
On Thu, Feb 25, 2021 at 6:02 PM Coiby Xu coxu@redhat.com wrote:
dracut will build the PRMs which will be installed onto the image to run the tests.
Signed-off-by: Coiby Xu coxu@redhat.com
tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile index 71b329b..3403e6f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -74,7 +74,7 @@ $(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS $(BUILD_ROOT)/inst-base-image \ $(TEST_ROOT)/output/test-base-image \ $(TEST_ROOT)/scripts/build-scripts/test-base-image.sh \
$(KEXEC_TOOLS_RPM)
$(KEXEC_TOOLS_RPM) $(DRACUT_RPMs)
Looks good, just two suggestion: 1. Keep the whole variable name capitalized 2. Can we use a more generic name, like EXTRA_RPMS, so if we want to install something else, we can keep reusing this variable.
test-run: $(TEST_ROOT)/output/test-base-image ifeq ($(strip $(TEST_CASE)),) -- 2.30.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
-- Best Regards, Kairui Song
On Thu, Mar 18, 2021 at 04:13:42PM +0800, Kairui Song wrote:
On Thu, Feb 25, 2021 at 6:02 PM Coiby Xu coxu@redhat.com wrote:
dracut will build the PRMs which will be installed onto the image to run the tests.
Signed-off-by: Coiby Xu coxu@redhat.com
tests/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile index 71b329b..3403e6f 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -74,7 +74,7 @@ $(TEST_ROOT)/output/test-base-image: $(BUILD_ROOT)/inst-base-image $(KEXEC_TOOLS $(BUILD_ROOT)/inst-base-image \ $(TEST_ROOT)/output/test-base-image \ $(TEST_ROOT)/scripts/build-scripts/test-base-image.sh \
$(KEXEC_TOOLS_RPM)
$(KEXEC_TOOLS_RPM) $(DRACUT_RPMs)
Looks good, just two suggestion: 1. Keep the whole variable name capitalized 2. Can we use a more generic name, like EXTRA_RPMS, so if we want to install something else, we can keep reusing this variable.
Thanks! I've applied your suggestions in v2.
test-run: $(TEST_ROOT)/output/test-base-image ifeq ($(strip $(TEST_CASE)),) -- 2.30.1 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
-- Best Regards, Kairui Song
Dracut's run-qemu could find which virtualization technology to the user in the order of kvm, kqemu, userspace. Using run-qemu could allow running tests where qemu-kvm doesn't exist.
Signed-off-by: Coiby Xu coxu@redhat.com --- tests/scripts/run-qemu | 23 +++++++++++++++++++++++ tests/scripts/test-lib.sh | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100755 tests/scripts/run-qemu
diff --git a/tests/scripts/run-qemu b/tests/scripts/run-qemu new file mode 100755 index 0000000..836387a --- /dev/null +++ b/tests/scripts/run-qemu @@ -0,0 +1,23 @@ +#!/bin/bash +# Check which virtualization technology to use +# We prefer kvm, kqemu, userspace in that order. + +# This script is based on https://github.com/dracutdevs/dracut/blob/master/test/run-qemu + +export PATH=/sbin:/bin:/usr/sbin:/usr/bin + +[[ -x /usr/bin/qemu ]] && BIN=/usr/bin/qemu && ARGS="-cpu max" +$(lsmod | grep -q '^kqemu ') && BIN=/usr/bin/qemu && ARGS="-kernel-kqemu -cpu host" +[[ -c /dev/kvm && -x /usr/bin/kvm ]] && BIN=/usr/bin/kvm && ARGS="-cpu host" +[[ -c /dev/kvm && -x /usr/bin/qemu-kvm ]] && BIN=/usr/bin/qemu-kvm && ARGS="-cpu host" +[[ -c /dev/kvm && -x /usr/libexec/qemu-kvm ]] && BIN=/usr/libexec/qemu-kvm && ARGS="-cpu host" +[[ -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-cpu max" +[[ -c /dev/kvm && -x /usr/bin/qemu-system-$(uname -i) ]] && BIN=/usr/bin/qemu-system-$(uname -i) && ARGS="-enable-kvm -cpu host" + +[[ $BIN ]] || { + echo "Could not find a working KVM or QEMU to test with!" >&2 + echo "Please install kvm or qemu." >&2 + exit 1 +} + +exec $BIN $ARGS "$@" diff --git a/tests/scripts/test-lib.sh b/tests/scripts/test-lib.sh index aff5cd3..f8a2249 100644 --- a/tests/scripts/test-lib.sh +++ b/tests/scripts/test-lib.sh @@ -89,7 +89,7 @@ run_test_sync() { local qemu_cmd=$(get_test_qemu_cmd $1)
if [ -n "$qemu_cmd" ]; then - timeout --foreground 10m qemu-kvm $(get_test_qemu_cmd $1) + timeout --foreground 10m $BASEDIR/run-qemu $(get_test_qemu_cmd $1) else echo "error: test qemu command line is not configured" > /dev/stderr return 1
Sorry the email subject is confusing. It should be "Preparing for running kexec-tools tests by dracut".
On Thu, Feb 25, 2021 at 05:57:37PM +0800, Coiby Xu wrote:
kexec-tools heavily depends on dracut and occasionally breaks because the change of dracut.
I'm now adding kdump test [1] to dracut which will clone kexec-tools' rawhide branch and run kexec-tools' basic functionality tests.
This patch set prepares kexec-tools for running the tests by dracut.
[1] https://github.com/coiby/dracut/tree/kexec_tools_tests
Coiby Xu (3): selftest: Fix bug of collecting test RPMs from argument selftest: add DRACUT_RPMs so dracut RPMs can be installed onto the image to run the tests selftest: replace qemu-kvm with one based on dracut's run-qemu
tests/Makefile | 2 +- .../scripts/build-scripts/test-base-image.sh | 2 +- tests/scripts/run-qemu | 23 +++++++++++++++++++ tests/scripts/test-lib.sh | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 tests/scripts/run-qemu
-- 2.30.1