Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp731161pxm; Fri, 25 Feb 2022 18:35:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxz8GCYZ5fRLUPRzfkog3os+i0PZy80ivwASUvooT4XknDfxAYJfvnYrc7JUns9DPOk527G X-Received: by 2002:a65:6751:0:b0:363:43a5:c7e3 with SMTP id c17-20020a656751000000b0036343a5c7e3mr8406150pgu.46.1645842906471; Fri, 25 Feb 2022 18:35:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645842906; cv=none; d=google.com; s=arc-20160816; b=EuzFZEak13zagEn1TS5T4mdzWDF/SsNTdUYHT+yXIKcBTEu9Py4AwkzYLQFM0PJdnq CLMaCKReLTDl5xp3BSMNuCSyWdDiUOp4m2uGHYH/k2O5UozTosaVwreiWsqr/+yfk+js C22pvjYQnPxzUewm1XjdvAmfqMbzEWUVnQq60HeUBDKqpRETpLJyUjxzPVWYdo5iF5x4 qyFE76yhNjiViIqctNojqR5hig/fdIsWM1fTkPDhLO6tHX4cD3QOcdIi2W9GWgSU71Ai vZFbc6Ay07FnrshCgbuOGmXHeq/RU+McOAOPm4a2rIylXlLwzor9zfkUXm058eOvyZMI UWVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=ouPwvvyML+zmZ/aCyS3qU5ttsZL6n1Cpp6tS7gEhxD8=; b=NbHtyA/N8jpxwzSrVZfhY0aLME4JpY9zbnFcJoJRaraVAniduTI8lCYdUCxIR14OSw GhoresbR3Yf9MQ0tGn3d1L1WvAL6I5yAVIU5gnYG9XDQjC6E2cICpPWsRDx3oACalvMi pbt40Pa5tUq1Xhtx/1VUfONLE30CnJ5v2t17GK5VRlblpsJhYRV36ABYYxwEQoEEkrMZ jh/zXfc5hLkWmw/1/d5fVMYHhOQ2hLQg2TNt1d0tsD9LCoiP5r4v2ak6k0ME4Ll8S5xL YW6RcZKWKQ/SFNySkkM/HgAXIUPfgTPA4txliuO8osU8MDjmb44vHhb5ISbckWtY63Pm qnBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="WijUW/t4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c15-20020a17090a558f00b001bc81f29240si3571268pji.71.2022.02.25.18.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 18:35:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b="WijUW/t4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DCE012F76C6; Fri, 25 Feb 2022 18:01:05 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233195AbiBYSuP (ORCPT + 99 others); Fri, 25 Feb 2022 13:50:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232773AbiBYSuO (ORCPT ); Fri, 25 Feb 2022 13:50:14 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60FC7182D8A; Fri, 25 Feb 2022 10:49:41 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id DED551F4664E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1645814980; bh=W1siran0TDWu7KT1NGueE/mVjJkk8nSZK4wyUM635do=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=WijUW/t4Phhx9H51BK2pBFSQkcaSPVGY+5nyahB6tSqLcsRuGthEKnKM6MTXySYOk dtkboROcim2ASyTrJwugmHjLAIO/htDGkxMCbopG8TIZ6OJiRLjt9t3fuWqc38PLse NkWA8WLGiyPonH80gGYow+LYwyiIeHsBdeh2neu66f0ZI0ksCFGWen6HOHw0X5wA8K wXs+5lXyErJs6pG9+2mS6EAtOJXj09wOI/TFTaWExYF24I4/1bK8svQ1X6jARLdPVg HGbQjB2pKOw15iNAkIimvqxIrHO2zFUVjbX3Q3nt1zVEn9OOqODCNwQGYHWhEb3ypZ B6Hk93T9vDfZQ== Message-ID: <8e88488b-1666-ce1b-6d79-7c6758672ac0@collabora.com> Date: Fri, 25 Feb 2022 18:49:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH] selftests, x86: fix how check_cc.sh is being invoked Content-Language: en-US From: Guillaume Tucker To: Shuah Khan , Andrew Morton Cc: Borislav Petkov , Dave Hansen , kernel@collabora.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org References: <9320d88a3a65350d9bfdc5e258742cd0b162f017.1645794882.git.guillaume.tucker@collabora.com> In-Reply-To: <9320d88a3a65350d9bfdc5e258742cd0b162f017.1645794882.git.guillaume.tucker@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/02/2022 13:15, Guillaume Tucker wrote: > Add quotes around $(CC) when calling check_cc.sh from a Makefile to > pass the value as a single argument to the script even if it has > several words such as "ccache gcc". Conversely, remove quotes in > check_cc.sh when calling $CC to make it a command with potentially > several arguments again. > > Fixes: e9886ace222e ("selftests, x86: Rework x86 target architecture detection") > Tested-by: "kernelci.org bot" > Signed-off-by: Guillaume Tucker > --- > tools/testing/selftests/vm/Makefile | 6 +++--- > tools/testing/selftests/x86/Makefile | 6 +++--- > tools/testing/selftests/x86/check_cc.sh | 2 +- > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile > index 1607322a112c..d934f026ebb5 100644 > --- a/tools/testing/selftests/vm/Makefile > +++ b/tools/testing/selftests/vm/Makefile > @@ -49,9 +49,9 @@ TEST_GEN_FILES += split_huge_page_test > TEST_GEN_FILES += ksm_tests > > ifeq ($(MACHINE),x86_64) > -CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_32bit_program.c -m32) > -CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_64bit_program.c) > -CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh $(CC) ../x86/trivial_program.c -no-pie) > +CAN_BUILD_I386 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_32bit_program.c -m32) > +CAN_BUILD_X86_64 := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_64bit_program.c) > +CAN_BUILD_WITH_NOPIE := $(shell ./../x86/check_cc.sh "$(CC)" ../x86/trivial_program.c -no-pie) > > TARGETS := protection_keys > BINARIES_32 := $(TARGETS:%=%_32) > diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile > index 8a1f62ab3c8e..53df7d3893d3 100644 > --- a/tools/testing/selftests/x86/Makefile > +++ b/tools/testing/selftests/x86/Makefile > @@ -6,9 +6,9 @@ include ../lib.mk > .PHONY: all all_32 all_64 warn_32bit_failure clean > > UNAME_M := $(shell uname -m) > -CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) > -CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) > -CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie) > +CAN_BUILD_I386 := $(shell ./check_cc.sh "$(CC)" trivial_32bit_program.c -m32) > +CAN_BUILD_X86_64 := $(shell ./check_cc.sh "$(CC)" trivial_64bit_program.c) > +CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh "$(CC)" trivial_program.c -no-pie) > > TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ > check_initial_reg_state sigreturn iopl ioperm \ > diff --git a/tools/testing/selftests/x86/check_cc.sh b/tools/testing/selftests/x86/check_cc.sh > index 3e2089c8cf54..aff2c15018b5 100755 > --- a/tools/testing/selftests/x86/check_cc.sh > +++ b/tools/testing/selftests/x86/check_cc.sh > @@ -7,7 +7,7 @@ CC="$1" > TESTPROG="$2" > shift 2 > > -if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then > +if $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then > echo 1 > else > echo 0 I see the change in check_cc.sh is already covered by Usama's patch: selftests/x86: Add validity check and allow field splitting -if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then +if [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then However, the rest of this patch in the Makefiles still needs to be applied. Let me know if I should rebase it on top of Usama's. Thanks, Guillaume