Makefile: fail if test fails
Change the test to print PASS or FAIL.
If the test fails, cause `make` itself to fail.
Change-Id: Ia9b8fb5d25b70a985b61d107e9ecc35295621bce
Reviewed-on: https://go-review.googlesource.com/c/pkgsite-metrics/+/472056
Reviewed-by: Zvonimir Pavlinovic <zpavlinovic@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/Makefile b/Makefile
index 17a3a77..598a5c4 100644
--- a/Makefile
+++ b/Makefile
@@ -68,8 +68,16 @@
# Test by scanning a small module.
test: docker-run-bg
- curl -s 'http://localhost:8080/vulncheck/scan/github.com/fossas/fossa-cli@v1.1.10?importedby=1&serve=true' | grep GO-2020-0016
+ curl -s 'http://localhost:8080/vulncheck/scan/github.com/fossas/fossa-cli@v1.1.10?importedby=1&serve=true' > /tmp/test.out
docker container stop `cat $(DOCKER_ID_FILE)`
+ if [[ `grep -c GO-2020-0016 /tmp/test.out` -ge 4 ]]; then \
+ echo PASS; \
+ rm /tmp/test.out; \
+ else \
+ echo FAIL; \
+ echo "output in /tmp/test.out"; \
+ exit 1; \
+ fi
clean:
rm -f go-image.tar.gz