Files
rkt/tests/test
T
Alban Crequy 3f1d704716 functional tests: use the correct version of go when using sudo
The functional tests use sudo because the tests need to be run as root.
Sudo does not preserve $PATH. When the user use a home-built go, it
might have a different version thatn the system-wide installed go.  It
causes problems when linking the tests with github.com/coreos/rkt/common

This patch fixes the issue by using the go environment of the user.
2015-04-23 12:33:56 +02:00

23 lines
778 B
Bash
Executable File

#!/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" RKT_ENABLE_DESTRUCTIVE_TESTS="$RKT_ENABLE_DESTRUCTIVE_TESTS" GOROOT="$GOROOT" $GO test -v $*