Netdev List
 help / color / mirror / Atom feed
From: Stefan Bader <stefan.bader@canonical.com>
To: net-devel <netdev@vger.kernel.org>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Christian Ehrhardt <christian.ehrhardt@canonical.com>,
	Luca <bluca@debian.org>
Subject: [PATCH] testsuite: Handle large number of kernel options
Date: Wed, 22 Aug 2018 10:31:38 +0200	[thread overview]
Message-ID: <1534926698-25163-1-git-send-email-stefan.bader@canonical.com> (raw)

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>
---
 testsuite/Makefile | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/testsuite/Makefile b/testsuite/Makefile
index 8fcbc55..f9f3b19 100644
--- a/testsuite/Makefile
+++ b/testsuite/Makefile
@@ -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 \
-- 
2.7.4

             reply	other threads:[~2018-08-22 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22  8:31 Stefan Bader [this message]
2018-08-22 11:02 ` [PATCH] testsuite: Handle large number of kernel options Luca Boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1534926698-25163-1-git-send-email-stefan.bader@canonical.com \
    --to=stefan.bader@canonical.com \
    --cc=bluca@debian.org \
    --cc=christian.ehrhardt@canonical.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox