Make 'make test' work

This commit is contained in:
Tim Hockin 2023-07-11 11:44:55 -07:00
parent df5924f904
commit ee27153186
2 changed files with 4 additions and 8 deletions

View File

@ -39,8 +39,6 @@ HTTPS_PROXY ?=
### These variables should not need tweaking.
###
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
ALL_PLATFORMS := linux/amd64 linux/arm linux/arm64 linux/ppc64le linux/s390x
# Used internally. Users should pass GOOS and/or GOARCH.
@ -248,7 +246,7 @@ test: $(BUILD_DIRS)
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(BUILD_IMAGE) \
/bin/sh -c " \
./build/test.sh $(SRC_DIRS) \
./build/test.sh ./... \
"
./test_e2e.sh

View File

@ -21,14 +21,12 @@ set -o pipefail
export CGO_ENABLED=0
export GOFLAGS="-mod=vendor"
TARGETS=$(for d in "$@"; do echo ./$d/...; done)
echo "Running tests:"
go test -installsuffix "static" ${TARGETS}
go test -installsuffix "static" "$@"
echo
echo -n "Checking gofmt: "
ERRS=$(find "$@" -type f -name \*.go | xargs gofmt -l 2>&1 || true)
ERRS="$(go fmt "$@")"
if [ -n "${ERRS}" ]; then
echo "FAIL - the following files need to be gofmt'ed:"
for e in ${ERRS}; do
@ -41,7 +39,7 @@ echo "PASS"
echo
echo -n "Checking go vet: "
ERRS=$(go vet ${TARGETS} 2>&1 || true)
ERRS="$(go vet "$@" 2>&1 || true)"
if [ -n "${ERRS}" ]; then
echo "FAIL"
echo "${ERRS}"