From patchwork Fri Mar 6 13:59:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Tondo X-Patchwork-Id: 82699 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC364F47CDC for ; Fri, 6 Mar 2026 14:00:18 +0000 (UTC) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.69775.1772805615379738196 for ; Fri, 06 Mar 2026 06:00:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FvCOq5TL; spf=pass (domain: gmail.com, ip: 209.85.128.51, mailfrom: stondo@gmail.com) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-480706554beso100933355e9.1 for ; Fri, 06 Mar 2026 06:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772805613; x=1773410413; darn=lists.openembedded.org; 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=OBt7CulJU87B0qh6JHQuPaZaU6NSLFNJJVdMlErXJC8=; b=FvCOq5TLEGCuax619WbuqdLJ4LVSkutUJPHFM5qNTNlHvO3PZ+Ab7cDnq42Zfn+HHR yaVA8Wp3wObtwg+zxYcaki4d8X2Hu9H3bPW7en2WHlSFIActlImgVdXbo5ErGNJRMv8p x+n0bG0J4dMhfFhsjSoHiKTzacfKUYy23c+Zf2PN4/cwKgTLzzhm1VuVFmOHJ+oorIqG 7ezti1JdoEA2TWBnFz7nm/ZCvoyeTZWqkfwgGhjwYBZqCrWAuf+k2lq2TArv7ZSA/Bru 6pbt30qunoiGeUN6QagS9wdcLWwbOqlpTe6JNNkNpXwHoUo2bZKVt5kTIxzCgr5q9OlS hvwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772805613; x=1773410413; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=OBt7CulJU87B0qh6JHQuPaZaU6NSLFNJJVdMlErXJC8=; b=vNeHzYtzvpgcfV0vjPMkfcGIRFmJlMZo4sg2HhR/YqIL41XFiMAYU7LWytCCgBUc0Q U0NsTvGeWQ0doDdnaOxZLAalNKcQOuiTmVCSPvPgn670Jl4dMztWuRrhakZHqcrEhn56 GoEdtt9eHa6ibUBbInYjEkQj0UaAywP0e0N6qxqXzt5LDbxR34ae30ox+c9vkD8axekO bigp+lJoNDylflqBE4XjSF7hjJhP+S/d6ystS7DPyEO0V3KPpJbTGYyrtWClBWUCSjqj suqZ9eE7tEhYP0+dwJ4L+iNNL8qXen/y7ILdEaA3l9MBkcotYZO6Y+7lMw/R1Ae9nOOp cAYg== X-Gm-Message-State: AOJu0YzKQDcHMCsqqT0vjiaP/X1xE/siYX75JL9ksLoyUP2v7/iGCq69 YHu2ptQrH5xVG5dCCYMjRNA1EwJ7o0QzlSHE1xfw18boNVbbL3odI4OJ1iTLaQ== X-Gm-Gg: ATEYQzzmg1iyTkWWmb4HRktm1Y8cH4mJ1x/F79SZ2QCxfZX+kyLMLLqx+cknWL5ZCFV 84yahwcQYnnfyZtEAlALeyXIr00UhcZZqEWSlLCLsPGxSwdeLabK8tG9cXoy1DNXBKjV6TiBC8l je/Gx5oR7dezqDpUKTwFtmLg//E7FQ7VrvowwR0BLs7hPkPPRueRPDPPbYGkyLCSEeIrhvdqurE SbiV7UOCdOYS1UZPKOY9cKiJN1EecrxbD7/USaeBxkPFisp4pQjlT3w8rQliTO7eGYX61biDra7 y2HhQOyMWzuGdN2GaSfWxQ9SSJAbRh8nOWUIWMe96/L7bmti10llJlmfAHidkJ1/bEolxbO8Kiv VO5kqahY3vrQeeCp2u9QnVx51QDGJx66HxrYkxcy2obuowW71nSr0/LdhxhOhfi2rzyq3Nn+xIH fCUHo2z0ajPzom3SljpSu2JMKRXdiFjlXbpfmkLOPW1VuazXqjv/VyatTo8OxCL48= X-Received: by 2002:a05:600c:3d90:b0:482:f564:d613 with SMTP id 5b1f17b1804b1-48526930529mr36910735e9.15.1772805613341; Fri, 06 Mar 2026 06:00:13 -0800 (PST) Received: from fedora ([81.6.40.67]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851fb4257csm187098845e9.15.2026.03.06.06.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Mar 2026 06:00:12 -0800 (PST) From: Stefano Tondo X-Google-Original-From: Stefano Tondo To: openembedded-core@lists.openembedded.org Cc: mathieu.dubois-briand@bootlin.com, joshua.watt@garmin.com, ross.burton@arm.com, adrian.freihofer@siemens.com, Peter.Marko@siemens.com, Stefano Tondo Subject: [OE-core][PATCH v7 07/10] oeqa/selftest: Add test for download_location defensive handling Date: Fri, 6 Mar 2026 14:59:59 +0100 Message-ID: <4c6578ec4adc1a0fe7eae661c356253822d82a7b.1772805096.git.stefano.tondo.ext@siemens.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 06 Mar 2026 14:00:18 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/232573 Add test to verify that SPDX generation handles download_location failures gracefully and doesn't crash if fetch_data_to_uri() behavior changes. Test verifies: 1. SPDX file generation succeeds for recipes with tarball sources 2. External references are properly structured when generated 3. ExternalRef.locator is a list of strings (SPDX 3.0 spec requirement) 4. Defensive try/except and isinstance() checks prevent crashes The test uses m4 recipe which has tarball sources, allowing verification of the download location handling without requiring complex setup. Test can be run with: oe-selftest -r spdx.SPDX30Check.test_download_location_defensive_handling Signed-off-by: Stefano Tondo --- meta/lib/oeqa/selftest/cases/spdx.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py index 41ef52fce1..9b6fcd335c 100644 --- a/meta/lib/oeqa/selftest/cases/spdx.py +++ b/meta/lib/oeqa/selftest/cases/spdx.py @@ -414,3 +414,37 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase): value, ["enabled", "disabled"], f"Unexpected PACKAGECONFIG value '{value}' for {key}" ) + + def test_download_location_defensive_handling(self): + """Test that download_location handling is defensive. + + Verifies SPDX generation succeeds and external references are + properly structured when download_location retrieval works. + """ + objset = self.check_recipe_spdx( + "m4", + "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/recipes/recipe-m4.spdx.json", + # Use a unique namespace prefix to ensure do_create_spdx runs + # fresh regardless of sstate from prior tests in the same + # oe-selftest worker (see test_extra_opts for rationale) + extraconf="""\ + SPDX_NAMESPACE_PREFIX = "http://spdx.org/spdxdocs/test-download-loc" + """, + ) + + found_external_refs = False + for pkg in objset.foreach_type(oe.spdx30.software_Package): + if hasattr(pkg, 'externalRef') and pkg.externalRef: + found_external_refs = True + for ref in pkg.externalRef: + self.assertIsNotNone(ref.externalRefType) + self.assertIsNotNone(ref.locator) + self.assertGreater(len(ref.locator), 0, "Locator should have at least one entry") + for loc in ref.locator: + self.assertIsInstance(loc, str) + break + + self.logger.info( + f"External references {'found' if found_external_refs else 'not found'} " + f"in SPDX output (defensive handling verified)" + )