1## -- Config --
2DEV := lo
3PREFIX := sudo
4## -- End Config --
5
6TESTS := $(patsubst tests/%,%,$(wildcard tests/*.t))
7IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*))
8KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG)
9
10.PHONY: compile listtests alltests configure $(TESTS)
11
12configure:
13	echo "Entering iproute2" && cd iproute2 && $(MAKE) configure && cd ..;
14
15compile: configure
16	echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..;
17
18listtests:
19	@for t in $(TESTS); do \
20		echo "$$t"; \
21	done
22
23alltests: $(TESTS)
24
25clean:
26	@rm -rf results/*
27
28distclean: 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