diff options
author | Yongqin Liu <yongqin.liu@linaro.org> | 2015-04-10 19:29:25 +0800 |
---|---|---|
committer | Yongqin Liu <yongqin.liu@linaro.org> | 2015-04-10 19:29:25 +0800 |
commit | f09abccc2587ab55b8f3ca3a0c7dbd909c893f00 (patch) | |
tree | 85cd7f123d30277c374da8cff5eb8b1b9c1812f9 /common | |
parent | 0893457a010dccb742a6e0170de48278b904d74e (diff) |
sync with qa repository
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'common')
-rwxr-xr-x | common/scripts/kvm/test-host.sh | 13 | ||||
-rwxr-xr-x | common/scripts/kvm/test-kvm.sh | 213 | ||||
-rwxr-xr-x | common/scripts/kvm/test-rt-parse.sh | 1 |
3 files changed, 156 insertions, 71 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 9cf6596..e2f338f 100755 --- a/common/scripts/kvm/test-kvm.sh +++ b/common/scripts/kvm/test-kvm.sh @@ -18,6 +18,104 @@ # # Maintainer: Riku Voipio <riku.voipio@linaro.org> +tamper_guest() +{ + guest=$1 + prefix=$2 + PREFIX_KVM_BOOT=${prefix}-$KVM_BOOT + PREFIX_KVM_GUEST_NET=${prefix}-$KVM_GUEST_NET + + if [ ! -r $guest ]; then + echo "$PREFIX_KVM_BOOT 0 pc skip" + echo "$PREFIX_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 "$PREFIX_KVM_BOOT 0 pc pass" + ping -w 20 -c 10 10.0.0.1 && echo "$PREFIX_KVM_GUEST_NET 0 pc pass" || echo "$PREFIX_KVM_GUEST_NET 0 pc fail" + sh $TEST_SCRIPT +EOF + chmod a+x /mnt/usr/bin/test-guest.sh + + umount /mnt + mount /dev/nbd0p1 /mnt/ + case $prefix in + aarch64) + cp Image /mnt + echo 'FS0:\Image root=/dev/vda2 rw rootwait mem=1024M earlyprintk=pl011,0x9000000 console=ttyAMA0,38400n8' > /mnt/startup.nsh + ;; + armv7l) + cp zImage-vexpress /mnt/zImage + echo 'FS0:\zImage root=/dev/vda2 rw rootwait mem=1024M console=ttyAMA0,38400n8' > /mnt/startup.nsh + ;; + esac + 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,30 +144,34 @@ 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` +BUILD_NUMBER_HOST=`$(echo $EXTRACT_BUILD_NUMBER) https://ci.linaro.org/job/linux-kvm/lastSuccessfulBuild/buildNumber` + +$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/armhf/kvm-armhf.qcow2.xz +$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm/$BUILD_NUMBER_HOST/zImage-armv7 +mv zImage-armv7 zImage-vexpress +$DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm/$BUILD_NUMBER_HOST/vexpress-v2p-ca15-tc1.dtb + +xz -d kvm-armhf.qcow2.xz 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) hwpack=`uname -r|sed -e's,.*-,,'` - BUILD_NUMBER_HOST=`$(echo $EXTRACT_BUILD_NUMBER) https://ci.linaro.org/job/linux-kvm/hwpack=${hwpack},label=docker/lastSuccessfulBuild/buildNumber` - $DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/kvm-arm64.qcow2.gz + $DOWNLOAD_FILE http://snapshots.linaro.org/ubuntu/images/kvm-guest/$BUILD_NUMBER_GUEST/arm64/kvm-arm64.qcow2.xz $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 + $DOWNLOAD_FILE http://releases.linaro.org/15.01/components/kernel/uefi-linaro/release/qemu64-intelbds/QEMU_EFI.fd + xz -d kvm-arm64.qcow2.xz zcat nbd-${hwpack}.ko.gz > nbd.ko insmod nbd.ko max_part=16 + mv Image-${hwpack} Image + tamper_guest kvm-arm64.qcow2 aarch64 ;; *) echo unknown arch ${ARCH} @@ -77,43 +179,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 -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 192.168.1.10 && 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-armhf.qcow2 armv7l case ${ARCH} in armv7l) @@ -127,29 +196,52 @@ case ${ARCH} in udhcpc -t 10 -i br0 esac -ping -W 4 -c 10 192.168.1.10 && echo "$KVM_HOST_NET 0 pc pass" || echo "$KVM_HOST_NET 0 pc fail" +ping -W 4 -c 10 10.0.0.1 && echo "$KVM_HOST_NET 0 pc pass" || echo "$KVM_HOST_NET 0 pc fail" 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-armhf.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) + # handle big.LITTLE + hwloc-ls + case ${hwpack} in + juno) + # run on a53 cluster + echo run on a53 + bind="hwloc-bind socket:0" + ;; + *) + bind="" + ;; + esac + deadline 60 qemu-system-aarch64 & qemu-system-aarch64 --version - 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 \ + echo "64bit guest test" + $bind qemu-system-aarch64 -smp 2 -m 1024 -cpu host -M virt \ + -bios QEMU_EFI.fd \ + -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" + $bind qemu-system-aarch64 -smp 2 -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-armhf.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} @@ -157,18 +249,7 @@ case ${ARCH} in ;; esac -qemu-nbd -c /dev/nbd0 kvm.qcow2 -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-armhf.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 |