Files
mgmt/test/test-gotest.sh
2018-02-18 17:31:45 -05:00

33 lines
759 B
Bash
Executable File

#!/bin/bash
echo "running test-gotest.sh $1"
#ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" # dir!
ROOT=$(dirname "${BASH_SOURCE}")/..
cd "${ROOT}"
. test/util.sh
failures=''
function run-test()
{
$@ || failures=$( [ -n "$failures" ] && echo "$failures\\n$@" || echo "$@" )
}
base=$(go list .)
for pkg in `go list -e ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old/" | grep -v "^${base}/tmp/"`; do
echo -e "\ttesting: $pkg"
run-test go test "$pkg"
if [ "$1" = "--race" ]; then
run-test go test -race "$pkg"
fi
done
if [[ -n "$failures" ]]; then
echo 'FAIL'
echo 'The following `go test` runs have failed:'
echo -e "$failures"
echo
exit 1
fi
echo 'PASS'