Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E48BC678D4 for ; Fri, 3 Mar 2023 00:03:23 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9D8F385A1D; Fri, 3 Mar 2023 01:03:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="GqfrCv0/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E0C5285CC4; Fri, 3 Mar 2023 01:02:57 +0100 (CET) Received: from mail-il1-x133.google.com (mail-il1-x133.google.com [IPv6:2607:f8b0:4864:20::133]) (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 D078B85AFD for ; Fri, 3 Mar 2023 01:02:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x133.google.com with SMTP id k9so212144ilu.13 for ; Thu, 02 Mar 2023 16:02:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677801773; 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=mzp/8BdFdQRk3OIjL8daYsd6tWqYKsqBLHbttccTo7Y=; b=GqfrCv0/vvPqXmf3vS0Hn8hqnRrl6RhOb4L4GhUyQHa3u1PQtAR7qhLs2sN71tlqML qMxivBHrT3u9DjvwaKCBbxPNnt1n+0lrhZgxAbpus8XnIIkaARVTR633jL/MLpWYE+61 Cf5mIjkyzi2Bn5rR/0ILRe9g8vSoZ9M7Mofuw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677801773; 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=mzp/8BdFdQRk3OIjL8daYsd6tWqYKsqBLHbttccTo7Y=; b=rd9mQD4MJ4poU4M0YkUa/aGnyDLRxtFmyZcgcW8vSQuU+XNu8YqE7ztbHY1/B7AQce GmBO07jhPFyHUDbB7J8EeIlkvV28IFInJm2WogVjRK+dT1Ga14z1XMobwsOAfsGMQ/uW I8igb4c79svwuCqbQDzfGNRsg5ZDpb//8eHtpHWWncZgotrNCZm2Snx9mied1B29pCWM YudcIel3BETm54yuxhPUMn5tQWlrGdDMo4JhaJR2haTD1rv1cuhsTNv4bm+ECzr3ycT9 I+ofd/tJb1RWO8w7R6xmZlfUVdPKrOiD1Pqfsu9zcVlm2xlmUgAoph3YwUooIHCEjnbN ZdBA== X-Gm-Message-State: AO0yUKV7l0XHqAFKQ9ufv8lQ5YqQsBSSlQLG1/OUdFWtW5vtqiGutNJ6 SKVxjBVus77djs9bLl7ShwkCj+vH3yUIYFvT X-Google-Smtp-Source: AK7set/qBNq61ESib7RTWqtmAX2mEFsGm+Q8oZG7hHbjk139KdMgkZq6sEH8T8wHQcKvPT8rGgKRcA== X-Received: by 2002:a05:6e02:c03:b0:318:a732:2b6f with SMTP id d3-20020a056e020c0300b00318a7322b6fmr148635ile.20.1677801773272; Thu, 02 Mar 2023 16:02:53 -0800 (PST) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id z1-20020a02cea1000000b003acde48bdc3sm258404jaq.111.2023.03.02.16.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 16:02:53 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Jan Kiszka , Ivan Mikhaylov , Roman Kopytin , Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Simon Glass , Jonas Karlman Subject: [PATCH v2 2/4] binman: Handle missing bintools correctly in fit Date: Thu, 2 Mar 2023 17:02:43 -0700 Message-Id: <20230303000246.2640473-2-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303000246.2640473-1-sjg@chromium.org> References: <20230303000246.2640473-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean At present these are handled as if they are allowed to be missing, but this is only true if the -M flag is provided. Fix this and add a test. Signed-off-by: Simon Glass --- Changes in v2: - Add new patch to handle missing bintools correctly in fit tools/binman/etype/fit.py | 2 ++ tools/binman/ftest.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/binman/etype/fit.py b/tools/binman/etype/fit.py index cd2943533ce..be0cdcc900f 100644 --- a/tools/binman/etype/fit.py +++ b/tools/binman/etype/fit.py @@ -453,6 +453,8 @@ class Entry_fit(Entry_section): args.update({'align': fdt_util.fdt32_to_cpu(align.value)}) if self.mkimage.run(reset_timestamp=True, output_fname=output_fname, **args) is None: + if not self.GetAllowMissing(): + self.Raise("Missing tool: 'mkimage'") # Bintool is missing; just use empty data as the output self.record_missing_bintool(self.mkimage) return tools.get_bytes(0, 1024) diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 062f54adb0e..b4b5019f90c 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -3999,9 +3999,17 @@ class TestFunctional(unittest.TestCase): self.assertEqual(expected, data[image_pos:image_pos+size]) def testFitMissing(self): + """Test that binman complains if mkimage is missing""" + with self.assertRaises(ValueError) as e: + self._DoTestFile('162_fit_external.dts', + force_missing_bintools='mkimage') + self.assertIn("Node '/binman/fit': Missing tool: 'mkimage'", + str(e.exception)) + + def testFitMissingOK(self): """Test that binman still produces a FIT image if mkimage is missing""" with test_util.capture_sys_output() as (_, stderr): - self._DoTestFile('162_fit_external.dts', + self._DoTestFile('162_fit_external.dts', allow_missing=True, force_missing_bintools='mkimage') err = stderr.getvalue() self.assertRegex(err, "Image 'image'.*missing bintools.*: mkimage") -- 2.40.0.rc0.216.gc4246ad0f0-goog