Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2934497ybf; Mon, 2 Mar 2020 19:04:37 -0800 (PST) X-Google-Smtp-Source: ADFU+vu4TXEmKgttGSCJUwNEbukB8rvC92dnYlsjdpRtVwNsS6tfzDMHPWRZbNH7x1/Ne5W5rWfc X-Received: by 2002:aca:3354:: with SMTP id z81mr1074681oiz.129.1583204677762; Mon, 02 Mar 2020 19:04:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583204677; cv=none; d=google.com; s=arc-20160816; b=VYdQ1dCcQk4aYH0p+2d+sZPA9ttjFilcaW1pbPqg+y5h/ueuXR2YOA69RzVN5nU/A/ GuZmkibz4PlDGYQ28S8vfComo0rX3xtsjS4NxGowDkORdKxWRGQ5PDAet+2JsziBFmIn 2WL9gab7iwdQM27/niNhoC1O6UMd7X4z2cRuhtFGGGHwqhIxr9wmY1J+5y2uwVDrULCJ +c5rvTVFUDl6vqfMSZ4haZ4YWrby3It5HN9YE1qZHbVtU1bhsERrVnR0ParxnLRP/7xY 2l9JCV32OIxOL4ZAXncc6T9GFxpIQFWeYCFT9Y1akCoBX8gyOZ2YYe5QB3fpWUuxqq9l faLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HLEvn7wK/NQX/uS4zKCV9hYjm2PgvKXvxl8byNws6N8=; b=eTOrRYLSIdtJOYGc+BL0hHhavvLqxsV2JKHDclcGPT+gwXp/O/jYOI8Vi2Ut5QNj76 JH/L21C8nXKQRe7HMep9oWH0K3/qvs8pq3k7Ho1FctEgyY4AcrGMV7C/aksiKzLgai9q Tt4oZgAdA6kwrry7hcEZVJST7bh9GXQTn3B5DgQBw9/BMJsAqxPqnfDBtanmklm4Looi 9R9lxRZE80hxBhZdn4uovYc/K6jLqpvTOu6nqMLpB8cAbgUDOLoL7SlIhWGWEqLqgtg6 Tcwozt/YbRJfiANQWKN2+t5E+CQnzwvt3dAVrlxAhtHIYGvyRPVveZKF/YtuuF5aNBtj +JzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D1n1+3pN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si7299080oib.207.2020.03.02.19.04.25; Mon, 02 Mar 2020 19:04:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=D1n1+3pN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727408AbgCCCqX (ORCPT + 99 others); Mon, 2 Mar 2020 21:46:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:40606 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727053AbgCCCqX (ORCPT ); Mon, 2 Mar 2020 21:46:23 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B3EA2467B; Tue, 3 Mar 2020 02:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583203582; bh=IL3/wicU8vS8fr/u2xEEigJhcMcCof++SwVTStaXe0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D1n1+3pNCKFLN4z5GnicxGFpN4E/EZFV/9OVRs4tXFDrUF44qOKdSp4RBggA620YD j7JQ0xCiws513uEpbFA3DgSrvSViBP1y2y6ef9iKrRzHDBIDWV8jpSqZ/3Bf/6qECj hzQQHUU9qyGk7bPYaeaEPXr0VNVhF8+BrszQjpRk= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jiri Benc , Yauheni Kaliuta , Shuah Khan , Sasha Levin , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 05/66] selftests: fix too long argument Date: Mon, 2 Mar 2020 21:45:14 -0500 Message-Id: <20200303024615.8889-5-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200303024615.8889-1-sashal@kernel.org> References: <20200303024615.8889-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiri Benc [ Upstream commit c363eb48ada5cf732b3f489fab799fc881097842 ] With some shells, the command construed for install of bpf selftests becomes too large due to long list of files: make[1]: execvp: /bin/sh: Argument list too long make[1]: *** [../lib.mk:73: install] Error 127 Currently, each of the file lists is replicated three times in the command: in the shell 'if' condition, in the 'echo' and in the 'rsync'. Reduce that by one instance by using make conditionals and separate the echo and rsync into two shell commands. (One would be inclined to just remove the '@' at the beginning of the rsync command and let 'make' echo it by itself; unfortunately, it appears that the '@' in the front of mkdir silences output also for the following commands.) Also, separate handling of each of the lists to its own shell command. The semantics of the makefile is unchanged before and after the patch. The ability of individual test directories to override INSTALL_RULE is retained. Reported-by: Yauheni Kaliuta Tested-by: Yauheni Kaliuta Signed-off-by: Jiri Benc Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin --- tools/testing/selftests/lib.mk | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk index 1c8a1963d03f8..3ed0134a764d4 100644 --- a/tools/testing/selftests/lib.mk +++ b/tools/testing/selftests/lib.mk @@ -83,17 +83,20 @@ else $(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS)) endif +define INSTALL_SINGLE_RULE + $(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH)) + $(if $(INSTALL_LIST),@echo rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/) + $(if $(INSTALL_LIST),@rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/) +endef + define INSTALL_RULE - @if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \ - mkdir -p ${INSTALL_PATH}; \ - echo "rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/"; \ - rsync -a $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(INSTALL_PATH)/; \ - fi - @if [ "X$(TEST_GEN_PROGS)$(TEST_CUSTOM_PROGS)$(TEST_GEN_PROGS_EXTENDED)$(TEST_GEN_FILES)" != "X" ]; then \ - mkdir -p ${INSTALL_PATH}; \ - echo "rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/"; \ - rsync -a $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_GEN_PROGS_EXTENDED) $(TEST_GEN_FILES) $(INSTALL_PATH)/; \ - fi + $(eval INSTALL_LIST = $(TEST_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_FILES)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_CUSTOM_PROGS)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_PROGS_EXTENDED)) $(INSTALL_SINGLE_RULE) + $(eval INSTALL_LIST = $(TEST_GEN_FILES)) $(INSTALL_SINGLE_RULE) endef install: all -- 2.20.1