From 1b1eae69ce52ef6c89a1200e8d3758549b291991 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 19 Nov 2015 13:13:31 +0100 Subject: [PATCH 1/4] test: increase loop device size to 400MB It turns out the full OS tree which is assembled into the loop-dev mount point is bigger than 300MB. Increase the size. --- test/test-functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test-functions b/test/test-functions index a6eea662fc..0a9d4f80ac 100644 --- a/test/test-functions +++ b/test/test-functions @@ -142,12 +142,12 @@ install_missing_libraries() { create_empty_image() { rm -f "$TESTDIR/rootdisk.img" # Create the blank file to use as a root filesystem - dd if=/dev/null of="$TESTDIR/rootdisk.img" bs=1M seek=300 + dd if=/dev/null of="$TESTDIR/rootdisk.img" bs=1M seek=400 LOOPDEV=$(losetup --show -P -f $TESTDIR/rootdisk.img) [ -b "$LOOPDEV" ] || return 1 echo "LOOPDEV=$LOOPDEV" >> $STATEFILE sfdisk "$LOOPDEV" < Date: Thu, 19 Nov 2015 13:17:15 +0100 Subject: [PATCH 2/4] test: make qemu use kvm if available If we're running in a KVM virtualized environment (such as Semaphore's Docker enabled platform), pass '-cpu host' to QEMU. --- test/test-functions | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test-functions b/test/test-functions index 0a9d4f80ac..5d223dbc63 100644 --- a/test/test-functions +++ b/test/test-functions @@ -68,8 +68,7 @@ selinux=0 \ $KERNEL_APPEND \ " - QEMU_OPTIONS="-machine accel=kvm:tcg \ --smp $QEMU_SMP \ + QEMU_OPTIONS="-smp $QEMU_SMP \ -net none \ -m 512M \ -nographic \ @@ -80,6 +79,10 @@ $KERNEL_APPEND \ QEMU_OPTIONS="$QEMU_OPTIONS -initrd $INITRD" fi + if [ -c /dev/kvm ]; then + QEMU_OPTIONS="$QEMU_OPTIONS -machine accel=kvm -enable-kvm -cpu host" + fi + ( set -x $QEMU_BIN $QEMU_OPTIONS -append "$KERNEL_APPEND" $TESTDIR/rootdisk.img ) || return 1 } From 3f5c306d3810673364f8eae662f3735ffd645a1d Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 19 Nov 2015 14:39:18 +0100 Subject: [PATCH 3/4] test: disable nspawn checks if machine wasn't booted with systemd Sempaphore containers are not booted with systemd, so machined is not available, which makes nspawn bail. Just skip nspawn tests in such environments. [ -d /run/systemd/system ] is esentially what sd_booted(3) is doing, but on Ubuntu 15.05, without 'systemd-container' installed, we also need to check for the presence of the systemd-machined binary. --- test/test-functions | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test-functions b/test/test-functions index 5d223dbc63..f8f89996b4 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1131,7 +1131,9 @@ inst_libdir_file() { } check_nspawn() { - [[ -d /sys/fs/cgroup/systemd ]] + [[ -d /sys/fs/cgroup/systemd ]] && \ + [[ -d /run/systemd/system ]] && \ + [[ -e /lib/systemd/systemd-machined ]] } From 6f9d3b08cf3e50d3903282d2ce36244bb86c7b7c Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Thu, 19 Nov 2015 13:27:39 +0100 Subject: [PATCH 4/4] test: 01-basic: mask some services that currently don't run in qemu --- test/TEST-01-BASIC/test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh index b6b474393d..c709993638 100755 --- a/test/TEST-01-BASIC/test.sh +++ b/test/TEST-01-BASIC/test.sh @@ -61,6 +61,13 @@ EOF ) setup_nspawn_root + # mask some services that we do not want to run in these tests + ln -s /dev/null $initdir/etc/systemd/system/systemd-hwdb-update.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-journal-catalog-update.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.service + ln -s /dev/null $initdir/etc/systemd/system/systemd-networkd.socket + ln -s /dev/null $initdir/etc/systemd/system/systemd-resolved.service + ddebug "umount $TESTDIR/root" umount $TESTDIR/root }