From 13d0624c5db670892746e7e22d768d306812da27 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 9 Mar 2021 11:37:35 +0100 Subject: [PATCH] mount: also test against local mountinfo source code mount depends on mountinfo, but defaults to the release specified in go.mod. This change adds a new test to also run against the local code so that we can catch regressions / breaking changes. Signed-off-by: Sebastiaan van Stijn --- .gitignore | 1 + Makefile | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 .gitignore 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