iproute2/testsuite/Makefile
vadimk 9ecff68d11 tests: Fix problem with test running
Tests were not allowed to be ran, the following
issues were fixed:
    - creating the results folder before test running
    - sudo $PREFIX moved before variables definition which
        allow to pass them through the sudo to test script.

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
2014-09-29 08:51:51 -07:00

48 lines
1.2 KiB
Makefile

## -- Config --
DEV := lo
PREFIX := sudo -E
RESULTS_DIR := results
## -- End Config --
TESTS := $(patsubst tests/%,%,$(wildcard tests/*.t))
IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*))
KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG)
.PHONY: compile listtests alltests configure $(TESTS)
configure:
echo "Entering iproute2" && cd iproute2 && $(MAKE) configure && cd ..;
compile: configure
echo "Entering iproute2" && cd iproute2 && $(MAKE) && cd ..;
listtests:
@for t in $(TESTS); do \
echo "$$t"; \
done
alltests: $(TESTS)
clean:
@rm -rf $(RESULTS_DIR)
distclean: clean
echo "Entering iproute2" && cd iproute2 && $(MAKE) distclean && cd ..;
$(TESTS):
@mkdir -p $(RESULTS_DIR)
@for i in $(IPVERS); do \
o=`echo $$i | sed -e 's/iproute2\///'`; \
echo -n "Running $@ [$$o/`uname -r`]: "; \
TC="$$i/tc/tc" IP="$$i/ip/ip" DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
if [ "$$?" = "127" ]; then \
echo "SKIPPED"; \
elif [ -e "$(RESULTS_DIR)/$@.$$o.err" ]; then \
echo "FAILED"; \
else \
echo "PASS"; \
fi; \
dmesg > $(RESULTS_DIR)/$@.$$o.dmesg; \
done