Dan Williams 9ef6f5f723 test: make tests actually work when packages have vendored imports
Go's "..." syntax (eg, ./plugins/...) doesn't traverse symlinks, so
go test wasn't finding the vendor/ directory for imports.  To get around
that we have to specify each testable package specifically rather
than use "...".
2017-04-18 23:40:46 -05:00

27 lines
578 B
Bash
Executable File

#!/usr/bin/env bash
set -e
ORG_PATH="github.com/containernetworking"
export REPO_PATH="${ORG_PATH}/plugins"
if [ ! -h gopath/src/${REPO_PATH} ]; then
mkdir -p gopath/src/${ORG_PATH}
ln -s ../../../.. gopath/src/${REPO_PATH} || exit 255
fi
export GO15VENDOREXPERIMENT=1
export GOPATH=${PWD}/gopath
mkdir -p ${PWD}/bin
echo "Building plugins"
PLUGINS="plugins/*"
for d in $PLUGINS; do
if [ -d $d ]; then
plugin=$(basename $d)
echo " " $plugin
# use go install so we don't duplicate work
GOBIN=${PWD}/bin go install -pkgdir $GOPATH/pkg "$@" $REPO_PATH/$d
fi
done