#!/bin/sh

set -eu

tarball="$1"
shift

tryit()
{
    local image="$1"
    local yaml="$2"
    echo "Testing $yaml"
    ./vmdb2 --rootfs-tarball "$dst/$tarball" \
            --verbose \
            --log "$dst/check.log" \
            --output "$image" \
            "$yaml"
    echo
}

src="$(dirname $0)"
dst="$(pwd)"
cd "$src"

#tryit luks.img "$src/luks.vmdb"
#tryit lvm2.img "$src/lvm2.vmdb"; exit

for x in "$@" pc uefi ansible smoke-pc smoke-uefi
do
    tryit "$dst/$x.img" "$x.vmdb"
done

echo All test images built successfully.
