From eb82d3dab5119c019ec201beb1ccc6ef92934975 Mon Sep 17 00:00:00 2001 From: =?utf8?q?G=C3=A9za=20G=C3=A9mes?= Date: Sat, 25 Mar 2017 20:28:54 +0100 Subject: [PATCH] Introduce cirros tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add support for using cirros images in raisin tests Signed-off-by: Géza Gémes Reviewed-by: Stefano Stabellini --- lib/common-functions.sh | 33 +++++++++ lib/common-tests.sh | 109 +++++++++++++++++++++++++++++ tests-configs/config-cirros_x86_32 | 13 ++++ tests-configs/config-cirros_x86_64 | 13 ++++ 4 files changed, 168 insertions(+) create mode 100644 tests-configs/config-cirros_x86_32 create mode 100644 tests-configs/config-cirros_x86_64 diff --git a/lib/common-functions.sh b/lib/common-functions.sh index d4476f3..efc92ff 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -439,3 +439,36 @@ function uninstall_package() { error_echo "Don't know how to uninstall packages on $DISTRO" fi } + +function get-qemu-img() { + set +e + QEMU_IMG=`which qemu-img` + set -e + if [[ -z "$QEMU_IMG" ]] + then + QEMU_IMG="/usr/lib/xen/bin/qemu-img" + fi + if [[ -x $QEMU_IMG ]] + then + export QEMU_IMG + else + error_echo "No working qemu-img found! Some tests may fail!" + fi +} + +function get-pvgrub() { + local arch=$1 + set +e + PVGRUB=`which grub-${arch}-xen` + set -e + if [[ -z "$PVGRUB" ]] + then + PVGRUB="/usr/lib/xen/boot/grub-${arch}-xen" + fi + if [[ -f $PVGRUB ]] + then + export PVGRUB + else + error_echo "No working pvgrub found! Some tests may fail!" + fi +} diff --git a/lib/common-tests.sh b/lib/common-tests.sh index d346af4..c07bb18 100644 --- a/lib/common-tests.sh +++ b/lib/common-tests.sh @@ -178,3 +178,112 @@ function get_host_initrd() { exit 1 fi } + +function cirros_network_init() { + rootdir=$1 + ifile=`mktemp` + # Create static network config + cat >$ifile </dev/null | head -1` +} + +function get_cirros_initrd() { + bootdir=$1 + basename `find $bootdir -name initrd* 2>/dev/null | head -1` +} + +function cirros_grub_cfg() { + rootdir=$1 + get-pvgrub $CIRROS_ARCH + grubroot="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 1`)" + grubcfg="`echo $CIRROS_GRUB_CFG | cut -d ')' -f 2`" + grubdir=`dirname $grubcfg` + bootdir=`dirname $grubdir` + tmpgrubcfg=`mktemp` + cat > $tmpgrubcfg <