mirror of
https://github.com/clearlinux/clr-installer.git
synced 2026-09-07 06:03:53 +00:00
build: fix build
Make the "check" target as a single shell block, and 1) improve the fail output display (by showing the left over files) and 2) ignore the /tmp directory itself (avoiding to consider it as a left over when some process has touched /tmp for example). Signed-off-by: Leandro Dorileo <leandro.maciel.dorileo@intel.com>
This commit is contained in:
committed by
Leandro Dorileo
parent
f1b632ad64
commit
b65ac90313
@@ -82,12 +82,21 @@ check-coverage: build-local-travis
|
||||
|
||||
check: gopath
|
||||
@# Ensure no temp files are left behind
|
||||
@$(eval BEFORESHA = $(shell ls -art /tmp | sha512sum))
|
||||
go test -cover ${GO_PACKAGE_PREFIX}/...
|
||||
@if [ "$(BEFORESHA)" != "$$(ls -art /tmp | sha512sum)" ] ; then \
|
||||
@LSCMD='ls -lart --ignore="." /tmp'; \
|
||||
SHACMD='ls -art --ignore="." /tmp | sha512sum'; \
|
||||
BEFORELS=`eval $$LSCMD`; \
|
||||
BEFORESHA=`eval $$SHACMD`; \
|
||||
go test -cover ${GO_PACKAGE_PREFIX}/...; \
|
||||
AFTERSHA=`eval $$SHACMD`; \
|
||||
AFTERLS=`eval $$LSCMD`; \
|
||||
if [ "$$BEFORESHA" != "$$AFTERSHA" ] ; then \
|
||||
echo "Test Failed: Temporary directory may not be clean!"; \
|
||||
echo "Left-over files:"; \
|
||||
echo "$$BEFORELS" > /tmp/beforels; \
|
||||
echo "$$AFTERLS" > /tmp/afterls; \
|
||||
diff -Nr /tmp/beforels /tmp/afterls; \
|
||||
/bin/false ; \
|
||||
fi \
|
||||
fi; \
|
||||
|
||||
check-clean: gopath
|
||||
go clean -testcache
|
||||
|
||||
Reference in New Issue
Block a user