From patchwork Tue Sep 3 08:37:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 824877 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c1:0:b0:367:895a:4699 with SMTP id p1csp2297766wrs; Tue, 3 Sep 2024 01:39:12 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUSj4AWJPhJbknMuKl3goMV38PVViQGuBfYk8HFgTd5GdHK9Vyed8AQv0LlQi6qNLMRn/jENw==@linaro.org X-Google-Smtp-Source: AGHT+IHGC7DFU1jDkj43Fl8Q3XJZ6Aoeo647nY5HyZeY+vA8Nc12KePXKvkkWdUi1pg+HGDLq3uN X-Received: by 2002:a17:907:7d93:b0:a86:ac05:2112 with SMTP id a640c23a62f3a-a897fa75845mr1265803666b.51.1725352752696; Tue, 03 Sep 2024 01:39:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725352752; cv=none; d=google.com; s=arc-20240605; b=Dz/RL1jb4JjRLXl9QK6yyeRiAWR3L1jg9b6+f7NlHF5q7BDd9H8YNwAUbHA1D1d1WY BfE5HCWAyyFi/tXoNMsKRZ5yhSHQgVjgp0mADxm1sYp9uvC5YIYtCEhS7cLpprma9hZ7 x0rmv6l7UpjefnIJ6zgAYX4MjJ9KFFBdv5QyeAL3Ejqr8XUlkQ21JYFCyCgUkfG0xQFP rBJGW91vfhv8Sa7whX9DNH1LRH9MRFtz0pv9EclBieyGMY7gWvtaSUTDUSYtdeQFFyor dJfvHuj8Q6QyYaADlwKmnKdePXBP2H2cWA14x7otfV5ztf1+b1gobFDZlGkPjPpta/SD gfIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rNk71n5E6pjt2UwcXalyjEEUKv5jtsxHr6voRWPzPlU=; fh=Ml11yGlGMDDCs4gB3YGjuzID7dvLW1iXR8zEFklcGgM=; b=hRvU1DkF8gsFLqnCnfvD4k7hfCzlfUjEk/JhkGnta+N5lYLgi7AkHjnPxJOACqzyf5 TKKhabm1iIOl0DrTJIzG+xNUtwdbYUcQccFLaV5NJbp2Jz+XOd+umsOXxqvi9PNHDDT0 LEh9sSoAaOIoyLA3klMLX19lvLPzvV53Eg7MaE9HpVzNDHh6tkPmIOr4TPhTdQaKo/Gd bbTGAjzFcHo190fShFc8h0Nye/vLyEXJ0vtyOwr5LZjeTV0C0xrxZD49B/FoXCDzeB5d TPqBxTXdCE1GwRMLfnhwCixVxT0yDQsMkS4kWJWABMjhkG2DW/kpwrVCTpxw1zUT6y0L YGuA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WhtLZZ3O; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id a640c23a62f3a-a898912eff2si825895266b.473.2024.09.03.01.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 01:39:12 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WhtLZZ3O; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B23AE88C91; Tue, 3 Sep 2024 10:38:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WhtLZZ3O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0022588C87; Tue, 3 Sep 2024 10:38:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 014D788AB1 for ; Tue, 3 Sep 2024 10:38:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42c5347b2f7so26759195e9.0 for ; Tue, 03 Sep 2024 01:38:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725352728; x=1725957528; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rNk71n5E6pjt2UwcXalyjEEUKv5jtsxHr6voRWPzPlU=; b=WhtLZZ3Omq5ncGFMqMEGNASBduqTHYvGK0vItnk6B3oCGfFOPbIGjRLvIXlz/9KzWM /IyGBAeKtIT7l6hnm4plJD7DMSfmWSPCl0tpShOTipwOzg3M08TtNJcuad2xpy1/evvv RSRQ1YRzOEX0D9Nw23jKzwg+vUbGLZjrnwoZ2rarVu0+SpyVCXPkoGy9r3spj8CDLJtt j+rrtPoSM7qPPSkuONv/A+FWNWBwjHsXBIsEgRgJoM0Zdg7rijMR3xFODipFrBo2ctWE h6lvOXiy6aFBEXIR1h/2QnC1kxwK2lqPQwGsu3MnXkf5IJRk1YqZIv2gfG4g5gZXrMSs 1oRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725352728; x=1725957528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rNk71n5E6pjt2UwcXalyjEEUKv5jtsxHr6voRWPzPlU=; b=Je2JxwCCJbEuFdJjVQDRs7AQyO0pf6wBgjQXTm8W/Iq+/lwXizQUv3aG3a60kOUrh0 3SDDDmv2bXMf3/H/XJ4aSGjyBhGzqKYckjA9hDoqn5mHkJhhQUgp+RW+R1xBwTE5BNvK bZWlUb9+4He5pL5UssJEhOrkw+KPbPIsW+lTQ0yLBl6480AatmdVt7uFKEzjRsdjZ1OX fB+yogp22bsyiWpcR1gl1LyHP+l91EKk8rA6Z/JhObz1NAXj8y+Cm5ybPx5g8yl5k3Oh E0GWb3tip8qgxXj69lNlixd9/cQp08q0s7GYkWmJATN8IfOrSAUvCFGWUf9dtqgaTJFM gkDA== X-Gm-Message-State: AOJu0Yw23rbSjF1MkFgTHZ1wZ180znAx7kYRaYBfUhrmBO5Bn1OLNGty 0KDgEPVNbLTOzNb4hxYr19aDOw8YTfjlJZ7o0GaPBXodvDBk+TUqajWdYmfIXSSHfpz7ROBEjCp yXoYrOg== X-Received: by 2002:a05:600c:1c83:b0:426:6ed5:d682 with SMTP id 5b1f17b1804b1-42bb01b4419mr115014325e9.12.1725352727630; Tue, 03 Sep 2024 01:38:47 -0700 (PDT) Received: from builder.. ([2a01:e0a:3cb:7bb0:6417:8cf6:a7f7:ee38]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6df795asm163103325e9.21.2024.09.03.01.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 01:38:47 -0700 (PDT) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Peter Robinson , Jerome Forissier , Simon Glass , Tom Rini , Andrejs Cainikovs , Brandon Maier , Heinrich Schuchardt Subject: [PATCH v3 02/16] buildman/toolchain.py: do not set CROSS_COMPILE for sandbox Date: Tue, 3 Sep 2024 10:37:59 +0200 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When building for sandbox, self.cross is empty. In MakeEnvironment(), CROSS_COMPILE is defined to be self.cross (with or without a full path), optionally prefixed by the toolchain wrapper defined in ~/.buildman. This is fine when self.cross is not empty, but it doesn't make sense when it is: - Either there is no wrapper and we end up with an empty CROSS_COMPILE which is the same as not defining it (the host compiler will be used), - Or there is a wrapper and CROSS_COMPILE will contain only the wrapper which obviously is not a valid compiler, hence an error. Test case: $ sudo apt install ccache $ grep -q toolchain-wrapper ~/.buildman || \ printf "[toolchain-wrapper]\nwrapper = ccache\n" >>~/.buildman $ make mrproper $ ./tools/buildman/buildman sandbox_noinst $ ./tools/buildman/buildman sandbox_noinst Building current source for 1 boards (1 thread, 24 jobs per thread) sandbox: + sandbox_noinst +arch/sandbox/lib/reloc_sandbox_efi.c:10:15: error: operator '==' has no left operand + 10 | #if HOST_ARCH == HOST_ARCH_X86_64 + | ^~ [...] The GetEnvArgs function is modified too, since the VAR_CROSS_COMPILE case has the same issue. In tools/buildman/test.py, testGetEnvArgs is extended and testMakeEnvironment is added. They check the 'arm' and 'sandbox' toolchains, with and without a wrapper. Signed-off-by: Jerome Forissier --- tools/buildman/test.py | 46 +++++++++++++++++++++++++++++++++++++ tools/buildman/toolchain.py | 6 +++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index bfad3093030..bda6596bde8 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -36,6 +36,16 @@ main: /usr/sbin x86: i386 x86_64 ''' +settings_data_wrapper = ''' +# Buildman settings file + +[toolchain] +main: /usr/sbin + +[toolchain-wrapper] +wrapper = ccache +''' + migration = '''===================== WARNING ====================== This board does not use CONFIG_DM. CONFIG_DM will be compulsory starting with the v2020.01 release. @@ -605,6 +615,9 @@ class TestBuild(unittest.TestCase): tc.GetEnvArgs(toolchain.VAR_ARCH)) self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS)) + tc = self.toolchains.Select('sandbox') + self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + self.toolchains.Add('/path/to/x86_64-linux-gcc', test=False) tc = self.toolchains.Select('x86') self.assertEqual('/path/to', @@ -613,6 +626,39 @@ class TestBuild(unittest.TestCase): self.assertEqual('HOSTCC=clang CC=clang', tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS)) + # Test config with ccache wrapper + bsettings.setup(None) + bsettings.add_file(settings_data_wrapper) + + tc = self.toolchains.Select('arm') + self.assertEqual('ccache arm-linux-', + tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + + tc = self.toolchains.Select('sandbox') + self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + + def testMakeEnvironment(self): + """Test the MakeEnvironment function""" + tc = self.toolchains.Select('arm') + env = tc.MakeEnvironment(False) + self.assertEqual(env[b'CROSS_COMPILE'], b'arm-linux-') + + tc = self.toolchains.Select('sandbox') + env = tc.MakeEnvironment(False) + self.assertTrue(b'CROSS_COMPILE' not in env) + + # Test config with ccache wrapper + bsettings.setup(None) + bsettings.add_file(settings_data_wrapper) + + tc = self.toolchains.Select('arm') + env = tc.MakeEnvironment(False) + self.assertEqual(env[b'CROSS_COMPILE'], b'ccache arm-linux-') + + tc = self.toolchains.Select('sandbox') + env = tc.MakeEnvironment(False) + self.assertTrue(b'CROSS_COMPILE' not in env) + def testPrepareOutputSpace(self): def _Touch(fname): tools.write_file(os.path.join(base_dir, fname), b'') diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 324ad0e0821..cbd8ce03d30 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -159,6 +159,8 @@ class Toolchain: if which == VAR_CROSS_COMPILE: wrapper = self.GetWrapper() base = '' if self.arch == 'sandbox' else self.path + if (base == '' and self.cross == ''): + return '' return wrapper + os.path.join(base, self.cross) elif which == VAR_PATH: return self.path @@ -201,10 +203,10 @@ class Toolchain: if self.override_toolchain: # We'll use MakeArgs() to provide this pass - elif full_path: + elif full_path and self.cross: env[b'CROSS_COMPILE'] = tools.to_bytes( wrapper + os.path.join(self.path, self.cross)) - else: + elif self.cross: env[b'CROSS_COMPILE'] = tools.to_bytes(wrapper + self.cross) env[b'PATH'] = tools.to_bytes(self.path) + b':' + env[b'PATH']