1 ## -- Config -- 2 DEV := lo 3 PREFIX := sudo 4 ## -- End Config -- 5 6 TESTS := $(patsubst tests/%,%,$(wildcard tests/*.t)) 7 IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*)) 8 KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG) 9 10 .PHONY: compile listtests alltests configure $(TESTS) 11 12 configure: 13 echo "Entering iproute2" && cd iproute2 && $(MAKE) configure && cd ..; 14 15 compile: configure 16 echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..; 17 18 listtests: 19 @for t in $(TESTS); do \ 20 echo "$$t"; \ 21 done 22 23 alltests: $(TESTS) 24 25 clean: 26 @rm -rf results/* 27 28 distclean: clean 29 echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..; 30 31 $(TESTS): 32 @for i in $(IPVERS); do \ 33 o=`echo $$i | sed -e 's/iproute2\///'`; \ 34 echo -n "Running $@ [$$o/`uname -r`]: "; \ 35 TC="$$i/tc/tc" IP="$$i/ip/ip" DEV="$(DEV)" IPVER="$@" SNAME="$$i" \ 36 ERRF="results/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > results/$@.$$o.out; \ 37 if [ "$$?" = "127" ]; then \ 38 echo "SKIPPED"; \ 39 elif [ -e "results/$@.$$o.err" ]; then \ 40 echo "FAILED"; \ 41 else \ 42 echo "PASS"; \ 43 fi; \ 44 dmesg > results/$@.$$o.dmesg; \ 45 done 46