diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..5ec4c027 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/mount/go-local.* diff --git a/Makefile b/Makefile index 3342a7b4..13557575 100644 --- a/Makefile +++ b/Makefile @@ -6,15 +6,31 @@ CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \ SUDO ?= sudo -n .PHONY: all -all: lint test cross +all: clean lint test test-local cross + +.PHONY: clean +clean: + $(RM) mount/go-local.* .PHONY: test test: RUN_VIA_SUDO = $(shell $(SUDO) true && echo -exec \"$(SUDO)\") -test: +test: test-local for p in $(PACKAGES); do \ (cd $$p && go test $(RUN_VIA_SUDO) -v .); \ done +# test the mount module against the local mountinfo source code instead of the +# release specified in go.mod. This allows catching regressions / breaking +# changes in mountinfo. +.PHONY: test-local +test-local: RUN_VIA_SUDO = $(shell $(SUDO) true && echo -exec \"$(SUDO)\") +test-local: + echo 'replace github.com/moby/sys/mountinfo => ../mountinfo' | cat mount/go.mod - > mount/go-local.mod + cd mount \ + && go mod download -modfile=go-local.mod \ + && go test -modfile=go-local.mod $(RUN_VIA_SUDO) -v . + $(RM) mount/go-local.* + .PHONY: lint lint: $(BINDIR)/golangci-lint $(BINDIR)/golangci-lint version