#!/bin/bash

# This script is normally executed by ./test in the topdir source directory.
# In this case, $GOPATH is already set.
#
# However, when developing a new functional test, it is useful to run the
# tests manually without recompiling rkt. GOPATH is set to the same directory
# as ./build in the topdir source directory does.
#
# To run all tests:
#     $ cd tests && ./test
#
# To run only one test:
#     $ cd tests && ./test -run=TestEnv

# Sudo does not preserve $PATH. Use go from the user's $PATH instead of
# root's $PATH. It is needed when a home-built go does not have the same
# version as the system-wide installed go.
GO=`which go`

sudo GOPATH="${PWD}/../gopath" GOROOT="$GOROOT" $GO test -v $*
