git-lfs/script/test
David Calavera 09f9f5f4f6
Abort script/test on error.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2018-07-20 16:16:14 -07:00

40 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Usage: script/test # run all non-vendored tests
# script/test <subpkg> # run just a package's tests
set -e
PACKAGES="$@"
if [ $# -eq 0 ]; then
# The following vendor test-exclusion grep-s typically need to match the same
# set in debian/rules variable DH_GOLANG_EXCLUDES, so update those when adding
# here.
PACKAGES="$(go list ./... \
| grep -v "github.com/kr/pty" \
| grep -v "github.com/kr/text" \
| grep -v "github.com/olekukonko/ts" \
| grep -v "github.com/pkg/errors" \
| grep -v "github.com/stretchr/testify" \
| grep -v "github.com/xeipuuv/gojsonreference" \
| grep -v "github.com/xeipuuv/gojsonschema" \
| grep -v "github.com/alexbrainman/sspi" \
)"
else
PACKAGES="$(echo "$PACKAGES" \
| sed -e 's/ / .\//g' \
| sed -e 's/^\([^\.]\)/.\/\1/g')"
fi
script/fmt
GO15VENDOREXPERIMENT=1 go test $PACKAGES
GO15VENDOREXPERIMENT=1 go tool vet $(
echo "$PACKAGES" \
| grep -v vendor \
| grep -v git-source \
| sed -e 's/github\.com\/git-lfs\/git-lfs//g' \
| sed -e 's/^\///g' \
| xargs \
)