summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorRiku Voipio <riku.voipio@linaro.org>2015-03-11 14:52:01 +0200
committerRiku Voipio <riku.voipio@linaro.org>2015-03-12 13:18:31 +0200
commit06acc8c9de3acff468687773418e2b7c817b0696 (patch)
treea9b66412da242a56c1e87f1df11d639098038f46 /common
parent917ad655ad4910ffa3c756eb6721201a2bc40422 (diff)
downloadtest-definitions-pipe-06acc8c9de3acff468687773418e2b7c817b0696.tar.gz
kvm: arm32 on arm64 tests
Refactor tests to allow testing multiple guests in one run. In this first version, we add armv7 tests on aarch64 host. Also some long-standing issues have been fixed. v2: prefix ping commands so we don't kvm-guest-net-1 twice v3: move binaries to testdata.l.o - download hackbench binaries instead of building. - avoids the question "howto compile armv7 binary on arm64" - lets us drop build-essential from install list - fix host host test-rt-tests.sh invocation - refactor downloads to download both armv7 and aarch64 images - rename logs from *.txt to *.log - avoids error with test-rt-parse.sh - make test-rt-parse.sh show what .txt file it is going to parse - add timeout kill reaper - add armv7 image run to aarch64 build Change-Id: I4f9759328c459b06de3be3062f0fb26d3b98d102 Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'common')
-rwxr-xr-xcommon/scripts/kvm/test-host.sh13
-rwxr-xr-xcommon/scripts/kvm/test-kvm.sh174
-rwxr-xr-xcommon/scripts/kvm/test-rt-parse.sh1
3 files changed, 122 insertions, 66 deletions
diff --git a/common/scripts/kvm/test-host.sh b/common/scripts/kvm/test-host.sh
index 42089eb..e654116 100755
--- a/common/scripts/kvm/test-host.sh
+++ b/common/scripts/kvm/test-host.sh
@@ -18,7 +18,7 @@
#
# Maintainer: Riku Voipio <riku.voipio@linaro.org>
-echo "Compile hackbench"
+echo "Download hackbench"
curl 2>/dev/null
if [ $? = 2 ]; then
DOWNLOAD_FILE="curl -SOk"
@@ -26,9 +26,12 @@ else
DOWNLOAD_FILE="wget --progress=dot -e dotbytes=2M --no-check-certificate"
fi
-$DOWNLOAD_FILE http://people.redhat.com/mingo/cfs-scheduler/tools/hackbench.c
-gcc -g -Wall -O2 -o hackbench hackbench.c -lpthread
-cp hackbench /usr/bin/
+# source http://people.redhat.com/mingo/cfs-scheduler/tools/hackbench.c
+$DOWNLOAD_FILE http://testdata.validation.linaro.org/tools/hackbench-armv7l
+$DOWNLOAD_FILE http://testdata.validation.linaro.org/tools/hackbench-aarch64
+chmod a+x hackbench*
+ARCH=`uname -m`
+cp hackbench-${ARCH} /usr/bin/hackbench
echo "Test hackbench on host"
-sh ./common/scripts/kvm/test-rt-tests.sh
+sh ./common/scripts/kvm/test-rt-tests.sh host
diff --git a/common/scripts/kvm/test-kvm.sh b/common/scripts/kvm/test-kvm.sh
index 4e54659..09d1010 100755
--- a/common/scripts/kvm/test-kvm.sh
+++ b/common/scripts/kvm/test-kvm.sh
@@ -18,6 +18,92 @@
#
# Maintainer: Riku Voipio <riku.voipio@linaro.org>
+tamper_guest()
+{
+ guest=$1
+ prefix=$2
+ KVM_BOOT=${prefix}-$KVM_BOOT
+ KVM_GUEST_NET=${prefix}-$KVM_GUEST_NET
+
+ if [ ! -r $guest ]; then
+ echo "$KVM_HOST_NET 0 pc skip"
+ echo "$KVM_BOOT 0 pc skip"
+ echo "$KVM_GUEST_NET 0 pc skip"
+ exit 0
+ fi
+
+ qemu-nbd -c /dev/nbd0 $guest
+ sleep 2
+ mount /dev/nbd0p2 /mnt/
+
+ cp common/scripts/kvm/kvm-lava.conf /mnt/etc/init/kvm-lava.conf
+
+ # Build up file test-guest.sh
+ if [ "x$1" = "xbenchmark" ]; then
+ cp /usr/bin/lat_ctx /mnt/usr/bin/lat_ctx
+ cp common/scripts/lmbench.sh /mnt/root/lmbench.sh
+ TEST_SCRIPT=/root/lmbench.sh
+ else
+ cp hackbench-${prefix} /mnt/usr/bin/hackbench
+ cp common/scripts/kvm/test-rt-tests.sh /mnt/root/test-rt-tests.sh
+ TEST_SCRIPT="/root/test-rt-tests.sh ${prefix}-guest"
+ fi
+
+ cat >> /mnt/usr/bin/test-guest.sh <<EOF
+#!/bin/sh
+ exec > /root/guest.log 2>&1
+ echo "$KVM_BOOT 0 pc pass"
+ ping -w 20 -c 10 10.0.0.1 && echo "$KVM_GUEST_NET 0 pc pass" || echo "$KVM_GUEST_NET 0 pc fail"
+ sh $TEST_SCRIPT
+EOF
+ chmod a+x /mnt/usr/bin/test-guest.sh
+
+ umount /mnt
+ sync
+ qemu-nbd -d /dev/nbd0
+}
+
+get_results()
+{
+ guest=$1
+ prefix=$2
+ qemu-nbd -c /dev/nbd0 $guest
+ sleep 2
+ mount /dev/nbd0p2 /mnt/
+
+ if ! grep -q "kvm-boot-1:" /mnt/root/guest.log
+ then
+ echo "${prefix}-${KVM_BOOT} 0 pc fail"
+ fi
+ echo ${prefix}-guest logs:
+ cp /mnt/*.txt .
+ cp /mnt/root/guest.log ./${prefix}-guest.log
+ cat ./${prefix}-guest.log
+ umount /mnt
+ sync
+ qemu-nbd -d /dev/nbd0
+}
+
+deadline() {
+ timeout=$1
+ binary=$2
+ set +o errexit
+ while [ true ]; do
+ pid=`pidof $binary`
+ if [ $? -ne 0 ]; then
+ break
+ fi
+ sleep 60
+ timeout=$((timeout - 1))
+ if [ $timeout -eq 0 ]; then
+ kill $pid
+ sleep 10
+ kill -9 $pid
+ break
+ fi
+ done
+}
+
KVM_HOST_NET="kvm-host-net-1:"
KVM_GUEST_NET="kvm-guest-net-1:"
KVM_INIT="kvm-init-1:"
@@ -46,18 +132,18 @@ if [ $? = 2 ]; then
DOWNLOAD_FILE="curl -SOk"
else
EXTRACT_BUILD_NUMBER="wget -q --no-check-certificate -O -"
- DOWNLOAD_FILE="wget --progress=dot -e dotbytes=2M --no-check-certificate"
+ DOWNLOAD_FILE="wget --no-clobber --progress=dot -e dotbytes=2M --no-check-certificate"
fi
BUILD_NUMBER_GUEST=`$(echo $EXTRACT_BUILD_NUMBER) https://ci.linaro.org/job/kvm-guest-image/lastSuccessfulBuild/buildNumber`
+$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/kvm-arm32.qcow2.gz
+$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/zImage-vexpress
+$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/vexpress-v2p-ca15-tc1.dtb
+gunzip kvm-arm32.qcow2.gz
+
case ${ARCH} in
armv7l)
- $DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/kvm-arm32.qcow2.gz
- $DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/zImage-vexpress
- $DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/vexpress-v2p-ca15-tc1.dtb
- gunzip kvm-arm32.qcow2.gz
- mv kvm-arm32.qcow2 kvm.qcow2
modprobe nbd max_part=16
;;
aarch64)
@@ -67,9 +153,9 @@ case ${ARCH} in
$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm/$BUILD_NUMBER_HOST/Image-${hwpack}
$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm/$BUILD_NUMBER_HOST/nbd-${hwpack}.ko.gz
gunzip kvm-arm64.qcow2.gz
- mv kvm-arm64.qcow2 kvm.qcow2
zcat nbd-${hwpack}.ko.gz > nbd.ko
insmod nbd.ko max_part=16
+ tamper_guest kvm-arm64.qcow2 aarch64
;;
*)
echo unknown arch ${ARCH}
@@ -77,44 +163,10 @@ case ${ARCH} in
;;
esac
-if [ ! -r kvm.qcow2 ]; then
- echo "$KVM_HOST_NET 0 pc skip"
- echo "$KVM_BOOT 0 pc skip"
- echo "$KVM_GUEST_NET 0 pc skip"
- exit 0
-fi
-
-qemu-nbd -c /dev/nbd0 kvm.qcow2
-sleep 2
-mount /dev/nbd0p2 /mnt/
-
-cp common/scripts/kvm/kvm-lava.conf /mnt/etc/init/kvm-lava.conf
-
-# Build up file test-guest.sh
-if [ "x$1" = "xbenchmark" ]; then
- cp /usr/bin/lat_ctx /mnt/usr/bin/lat_ctx
- cp common/scripts/lmbench.sh /mnt/root/lmbench.sh
- TEST_SCRIPT=/root/lmbench.sh
-else
- cp /usr/bin/hackbench /mnt/usr/bin/hackbench
- cp common/scripts/kvm/test-rt-tests.sh /mnt/root/test-rt-tests.sh
- TEST_SCRIPT='/root/test-rt-tests.sh guest'
-fi
echo 0 2000000 > /proc/sys/net/ipv4/ping_group_range
-cat >> /mnt/usr/bin/test-guest.sh <<EOF
-#!/bin/sh
- exec > /root/guest.log 2>&1
- echo "$KVM_BOOT 0 pc pass"
- ping -W 4 -c 10 10.0.0.1 && echo "$KVM_GUEST_NET 0 pc pass" || echo "$KVM_GUEST_NET 0 pc fail"
- sh $TEST_SCRIPT
-EOF
-chmod a+x /mnt/usr/bin/test-guest.sh
-
-umount /mnt
-sync
-qemu-nbd -d /dev/nbd0
+tamper_guest kvm-arm32.qcow2 armv7l
case ${ARCH} in
armv7l)
@@ -132,25 +184,37 @@ ping -W 4 -c 10 10.0.0.1 && echo "$KVM_HOST_NET 0 pc pass" || echo "$KVM_HOST_NE
case ${ARCH} in
armv7l)
+ deadline 60 qemu-system-arm &
qemu-system-arm --version
qemu-system-arm -smp 2 -m 1024 -cpu cortex-a15 -M vexpress-a15 \
-kernel ./zImage-vexpress -dtb ./vexpress-v2p-ca15-tc1.dtb \
-append 'root=/dev/vda2 rw rootwait mem=1024M console=ttyAMA0,38400n8' \
- -drive if=none,id=image,file=kvm.qcow2 \
+ -drive if=none,id=image,file=kvm-arm32.qcow2 \
-netdev tap,id=tap0,script=no,downscript=no,ifname="tap0" \
-device virtio-net-device,netdev=tap0 \
-device virtio-blk-device,drive=image \
- -nographic -enable-kvm 2>&1|tee kvm-log.txt
+ -nographic -enable-kvm 2>&1|tee kvm-arm32.log
;;
aarch64)
+ deadline 60 qemu-system-aarch64 &
qemu-system-aarch64 --version
+ echo "64bit guest test"
taskset -c 0,1,2,3 qemu-system-aarch64 -smp 2 -m 1024 -cpu host -M virt \
-kernel ./Image-${hwpack} \
-append 'root=/dev/vda2 rw rootwait mem=1024M earlyprintk=pl011,0x9000000 console=ttyAMA0,38400n8' \
- -drive if=none,id=image,file=kvm.qcow2 \
+ -drive if=none,id=image,file=kvm-arm64.qcow2 \
-netdev user,id=user0 -device virtio-net-device,netdev=user0 \
-device virtio-blk-device,drive=image \
- -nographic -enable-kvm 2>&1|tee kvm-log.txt
+ -nographic -enable-kvm 2>&1|tee kvm-arm64.log
+ echo "32bit guest test"
+ taskset -c 4 qemu-system-aarch64 -m 1024 -cpu host,aarch64=off -M virt \
+ -kernel ./zImage-vexpress \
+ -append 'root=/dev/vda2 rw rootwait mem=1024M console=ttyAMA0,38400n8' \
+ -drive if=none,id=image,file=kvm-arm32.qcow2 \
+ -netdev user,id=user0 -device virtio-net-device,netdev=user0 \
+ -device virtio-blk-device,drive=image \
+ -nographic -enable-kvm 2>&1|tee kvm-arm32.log
+ get_results kvm-arm64.qcow2 aarch64
;;
*)
echo unknown arch ${ARCH}
@@ -158,19 +222,7 @@ case ${ARCH} in
;;
esac
-qemu-nbd -c /dev/nbd0 kvm.qcow2
-sleep 2
-mount /dev/nbd0p2 /mnt/
-
-if ! grep -q "kvm-boot-1:" /mnt/root/guest.log
-then
- echo "$KVM_BOOT 0 pc fail"
-fi
-
-cat /mnt/root/guest.log
-cp /mnt/*.txt .
-cp /mnt/root/guest.log .
+get_results kvm-arm32.qcow2 armv7l
-umount /mnt
-sync
-qemu-nbd -d /dev/nbd0
+ls *log *txt
+rm -f md5sum.txt
diff --git a/common/scripts/kvm/test-rt-parse.sh b/common/scripts/kvm/test-rt-parse.sh
index eca64d0..70ad7db 100755
--- a/common/scripts/kvm/test-rt-parse.sh
+++ b/common/scripts/kvm/test-rt-parse.sh
@@ -28,5 +28,6 @@ fi
for FILE in *.txt
do
+ echo $FILE
$PARSE_SCRIPT $FILE "Time:" "Seconds"
done