mirror of
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git
synced 2024-11-15 22:15:13 +08:00
9ecff68d11
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>
48 lines
1.2 KiB
Makefile
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
|