test: Show test output as it happens
This commit is contained in:
@@ -7,9 +7,6 @@ ROOT=$(dirname "${BASH_SOURCE}")/..
|
|||||||
cd "${ROOT}"
|
cd "${ROOT}"
|
||||||
. test/util.sh
|
. test/util.sh
|
||||||
|
|
||||||
tmpdir="`$mktemp --tmpdir -d tmp.XXX`" # get a dir outside of the main package
|
|
||||||
log="$tmpdir/$(basename $0 .sh).log"
|
|
||||||
|
|
||||||
failures=''
|
failures=''
|
||||||
function run-test()
|
function run-test()
|
||||||
{
|
{
|
||||||
@@ -17,18 +14,16 @@ function run-test()
|
|||||||
}
|
}
|
||||||
|
|
||||||
base=$(go list .)
|
base=$(go list .)
|
||||||
for pkg in `go list ./... | grep -v "^${base}/vendor/" | grep -v "^${base}/examples/" | grep -v "^${base}/test/" | grep -v "^${base}/old/" | grep -v "^${base}/tmp/"`; do
|
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"
|
echo -e "\ttesting: $pkg"
|
||||||
# FIXME: can we capture and output the stderr from these tests too?
|
run-test go test "$pkg"
|
||||||
run-test go test "$pkg" > "$log"
|
|
||||||
if [ "$1" = "--race" ]; then
|
if [ "$1" = "--race" ]; then
|
||||||
run-test go test -race "$pkg" > "$log"
|
run-test go test -race "$pkg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$failures" ]]; then
|
if [[ -n "$failures" ]]; then
|
||||||
echo 'FAIL'
|
echo 'FAIL'
|
||||||
cat "$log"
|
|
||||||
echo 'The following `go test` runs have failed:'
|
echo 'The following `go test` runs have failed:'
|
||||||
echo -e "$failures"
|
echo -e "$failures"
|
||||||
echo
|
echo
|
||||||
|
|||||||
Reference in New Issue
Block a user