From patchwork Wed Aug 22 08:31:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 960854 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41wLPC2mCcz9s0n for ; Wed, 22 Aug 2018 18:31:43 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728445AbeHVLzd (ORCPT ); Wed, 22 Aug 2018 07:55:33 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:59253 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727985AbeHVLzc (ORCPT ); Wed, 22 Aug 2018 07:55:32 -0400 Received: from 1.general.smb.uk.vpn ([10.172.193.28] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fsOYF-0003Vq-9m; Wed, 22 Aug 2018 08:31:39 +0000 From: Stefan Bader To: net-devel Cc: Stephen Hemminger , Christian Ehrhardt , Luca Subject: [PATCH] testsuite: Handle large number of kernel options Date: Wed, 22 Aug 2018 10:31:38 +0200 Message-Id: <1534926698-25163-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 Acked-by: Luca Boccassi --- 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 \