]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
testsuite: Handle large number of kernel options
authorStefan Bader <stefan.bader@canonical.com>
Wed, 22 Aug 2018 08:31:38 +0000 (10:31 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Sat, 25 Aug 2018 06:13:26 +0000 (23:13 -0700)
Once there are more than a certain number of kernel config options
set (this happened for us with kernel 4.17), the method of passing
those as command line arguments exceeds the maximum number of
arguments the shell supports. This causes the whole testsuite to
fail.
Instead, create a temporary file and modify its contents so that
the config option variables are exported. Then this file can be
sourced in before running the tests.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
testsuite/Makefile

index 8fcbc557ff9a74c26603530ce5c088e7b4ebf0af..f9f3b198471b5a0be92b11e571860ef40dcd9b6e 100644 (file)
@@ -14,15 +14,13 @@ TESTS_DIR := $(dir $(TESTS))
 
 IPVERS := $(filter-out iproute2/Makefile,$(wildcard iproute2/*))
 
+KENVFN := $(shell mktemp /tmp/tc_testkenv.XXXXXX)
 ifneq (,$(wildcard /proc/config.gz))
-       KENV := $(shell cat /proc/config.gz | gunzip | grep ^CONFIG)
+       KCPATH := /proc/config.gz
 else
 KVER := $(shell uname -r)
 KCPATHS := /lib/modules/$(KVER)/config /boot/config-$(KVER)
 KCPATH := $(firstword $(wildcard $(KCPATHS)))
-ifneq (,$(KCPATH))
-       KENV := $(shell cat ${KCPATH} | grep ^CONFIG)
-endif
 endif
 
 .PHONY: compile listtests alltests configure $(TESTS)
@@ -59,14 +57,22 @@ endif
            mkdir -p $(RESULTS_DIR)/$$d; \
        done
        
+       @if [ "$(KCPATH)" = "/proc/config.gz" ]; then \
+               gunzip -c $(KCPATH) >$(KENVFN); \
+       elif [ "$(KCPATH)" != "" ]; then \
+               cat $(KCPATH) >$(KENVFN); \
+       fi
+       @sed -i -e 's/^CONFIG_/export CONFIG_/' $(KENVFN)
+
        @for i in $(IPVERS); do \
                o=`echo $$i | sed -e 's/iproute2\///'`; \
                echo -n "Running $@ [$$o/`uname -r`]: "; \
                TMP_ERR=`mktemp /tmp/tc_testsuite.XXXXXX`; \
                TMP_OUT=`mktemp /tmp/tc_testsuite.XXXXXX`; \
+               . $(KENVFN); \
                STD_ERR="$$TMP_ERR" STD_OUT="$$TMP_OUT" \
                TC="$$i/tc/tc" IP="$$i/ip/ip" SS=$$i/misc/ss DEV="$(DEV)" IPVER="$@" SNAME="$$i" \
-               ERRF="$(RESULTS_DIR)/$@.$$o.err" $(KENV) $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
+               ERRF="$(RESULTS_DIR)/$@.$$o.err" $(PREFIX) tests/$@ > $(RESULTS_DIR)/$@.$$o.out; \
                if [ "$$?" = "127" ]; then \
                        echo "SKIPPED"; \
                elif [ -e "$(RESULTS_DIR)/$@.$$o.err" ]; then \