3 PREFIX
:= sudo
-E unshare
-n
7 HAVE_UNSHARED_UTIL
:= $(shell unshare
--version
2> /dev
/null
)
9 rwildcard
=$(wildcard $1$2) $(foreach d
,$(wildcard $1*),$(call rwildcard
,$d/,$2))
11 TESTS
:= $(patsubst tests
/%,%,$(call rwildcard
,tests
/,*.t
))
12 TESTS_DIR
:= $(dir $(TESTS
))
14 IPVERS
:= $(filter-out iproute2
/Makefile
,$(wildcard iproute2
/*))
16 ifneq (,$(wildcard /proc
/config.gz
))
17 KENV
:= $(shell cat
/proc
/config.gz | gunzip | grep ^CONFIG
)
20 .PHONY
: compile listtests alltests configure
$(TESTS
)
23 echo
"Entering iproute2" && cd iproute2
&& $(MAKE
) configure
&& cd ..
;
26 echo
"Entering iproute2" && cd iproute2
&& $(MAKE
) && cd ..
;
29 @for t in
$(TESTS
); do \
36 @echo
"Removing $(RESULTS_DIR) dir ..."
37 @
rm -rf
$(RESULTS_DIR
)
40 echo
"Entering iproute2" && cd iproute2
&& $(MAKE
) distclean && cd ..
;
43 ifeq (,$(HAVE_UNSHARED_UTIL
))
44 $(error Please
install util-linux tools to run tests in separated network namespace
)
46 @mkdir
-p
$(RESULTS_DIR
)
48 @for d in
$(TESTS_DIR
); do \
49 mkdir
-p
$(RESULTS_DIR
)/$$d; \
52 @for i in
$(IPVERS
); do \
53 o
=`echo $$i | sed -e 's/iproute2\///'`; \
54 echo
-n
"Running $@ [$$o/`uname -r`]: "; \
55 TC
="$$i/tc/tc" IP
="$$i/ip/ip" DEV
="$(DEV)" IPVER
="$@" SNAME
="$$i" \
56 ERRF
="$(RESULTS_DIR)/$@.$$o.err" $(KENV
) $(PREFIX
) tests
/$@
> $(RESULTS_DIR
)/$@.
$$o.out
; \
57 if
[ "$$?" = "127" ]; then \
59 elif
[ -e
"$(RESULTS_DIR)/$@.$$o.err" ]; then \
64 dmesg
> $(RESULTS_DIR
)/$@.
$$o.dmesg
; \