#!/bin/bash

# This script is intended to run, locally, the tests we run at circleci,
# precisely as they are run there.
#
# to do so, it:
# o creates a directory to store local artifacts retrieved from docker
#   see TMP= below
# o runs a the standard test container to retrieve a the qemu, kernel, and bios image
# o runs go test with a default set of tests (./...)
#
# NOTE: if you want more complex behavior, don't make this script more
# complex. Convert it to Go. Complex shell scripts suck.

# Take a guess: they are likely running it in this directory
UROOT_SOURCE=${UROOT_SOURCE:-${PWD}/..}
export UROOT_SOURCE

set -e
set -x

. GET_KERNEL_QEMU

go test "$@" ./...
