cloudinit/test

38 lines
732 B
Plaintext
Raw Normal View History

2014-03-04 16:50:54 -08:00
#!/bin/bash -e
2014-05-10 01:42:57 -07:00
#
# Run all coreos-cloudinit tests
# ./test
# ./test -v
#
# Run tests for one package
# PKG=initialize ./test
#
2014-03-04 16:50:54 -08:00
2014-05-10 01:42:57 -07:00
# Invoke ./cover for HTML output
COVER=${COVER:-"-cover"}
source ./build
declare -a TESTPKGS=(initialize system datasource httpbackoff)
2014-05-10 01:42:57 -07:00
if [ -z "$PKG" ]; then
GOFMTPATH="$TESTPKGS coreos-cloudinit.go"
# prepend repo path to each package
TESTPKGS=${TESTPKGS[@]/#/${REPO_PATH}/}
else
GOFMTPATH="$TESTPKGS"
# strip out slashes and dots from PKG=./foo/
TESTPKGS=${PKG//\//}
TESTPKGS=${TESTPKGS//./}
TESTPKGS=${TESTPKGS/#/${REPO_PATH}/}
fi
2014-03-04 16:50:54 -08:00
echo "Running tests..."
2014-05-10 01:42:57 -07:00
go test -i ${TESTPKGS}
go test ${COVER} $@ ${TESTPKGS}
echo "Checking gofmt..."
fmtRes=$(gofmt -l $GOFMTPATH)
echo "Success"