2014-10-31 18:45:51 +00:00
|
|
|
DIRS := \
|
|
|
|
. \
|
|
|
|
nl
|
|
|
|
|
2014-10-31 19:27:21 +00:00
|
|
|
DEPS = \
|
|
|
|
github.com/vishvananda/netns
|
|
|
|
|
2014-10-31 18:45:51 +00:00
|
|
|
uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
|
|
|
|
testdirs = $(call uniq,$(foreach d,$(1),$(dir $(wildcard $(d)/*_test.go))))
|
2014-10-31 19:27:21 +00:00
|
|
|
goroot = $(addprefix ../../../,$(1))
|
|
|
|
unroot = $(subst ../../../,,$(1))
|
2014-12-11 21:48:16 +00:00
|
|
|
fmt = $(addprefix fmt-,$(1))
|
2014-10-31 18:45:51 +00:00
|
|
|
|
2016-03-20 00:12:26 +00:00
|
|
|
all: test
|
2014-10-31 18:45:51 +00:00
|
|
|
|
2014-10-31 19:27:21 +00:00
|
|
|
$(call goroot,$(DEPS)):
|
|
|
|
go get $(call unroot,$@)
|
|
|
|
|
2014-10-31 18:45:51 +00:00
|
|
|
.PHONY: $(call testdirs,$(DIRS))
|
|
|
|
$(call testdirs,$(DIRS)):
|
2016-05-18 17:21:46 +00:00
|
|
|
sudo -E go test -test.parallel 4 -timeout 60s -v github.com/vishvananda/netlink/$@
|
2014-10-31 18:45:51 +00:00
|
|
|
|
2014-12-11 21:48:16 +00:00
|
|
|
$(call fmt,$(call testdirs,$(DIRS))):
|
2017-02-20 17:34:32 +00:00
|
|
|
! gofmt -l $(subst fmt-,,$@)/*.go | grep -q .
|
2014-12-11 21:48:16 +00:00
|
|
|
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt: $(call fmt,$(call testdirs,$(DIRS)))
|
|
|
|
|
|
|
|
test: fmt $(call goroot,$(DEPS)) $(call testdirs,$(DIRS))
|