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