1#!/bin/bash
2
3set -ex
4
5# variant should be either pv or pvh
6variant=$1
7
8# Install QEMU
9export DEBIAN_FRONTENT=noninteractive
10apt-get -qy update
11apt-get -qy install qemu-system-x86
12
13# Clone and build XTF
14git clone https://xenbits.xen.org/git-http/xtf.git
15cd xtf && make -j$(nproc) && cd -
16
17case $variant in
18    pvh) k=test-hvm32pae-example extra="dom0-iommu=none dom0=pvh" ;;
19    *)   k=test-pv32pae-example  extra= ;;
20esac
21
22rm -f smoke.serial
23set +e
24timeout -k 1 30 \
25qemu-system-x86_64 -nographic -kernel binaries/xen \
26        -initrd xtf/tests/example/$k \
27        -append "loglvl=all com1=115200,,8n1 console=com1 noreboot \
28                 console_timestamps=boot $extra" \
29        -m 512 -monitor none -serial file:smoke.serial
30set -e
31grep -q 'Test result: SUCCESS' smoke.serial || exit 1
32exit 0
33