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