From patchwork Sat Feb 21 05:10:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Tondo X-Patchwork-Id: 81558 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 BA2D9C5DF9F for ; Sat, 21 Feb 2026 05:10:43 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.14947.1771650633508607061 for ; Fri, 20 Feb 2026 21:10:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OOcx+74E; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: stondo@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-4359228b7c6so2091371f8f.2 for ; Fri, 20 Feb 2026 21:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771650631; x=1772255431; 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=59ZsUGoqVrBnDcGbYd0rbYibIx0NPhs9aBFqqhvhP/s=; b=OOcx+74EdfhdZFYPPRBkS01PXfezYvLhfe1ar8ojFU5p/nfkEQzcbBgu80Pz7tfqWH 02ow7QChPZhMmJGSTsrfUJIV87EAtgfAth43oUIIznnbUtJ2gKtageQ+TH2VavcuXELf 1mDoQpssvz7kF7a3SUzhwTeGTIZVbwhjWh+MqjLOBUHOlfEiF6CB3qsdHxJX7M4PgagK ngjwKOcTyVmdZXZxgDl4HRjVsXup8NK3idor72o4IcAF8zxjz/lUHbhDaiC5TGUCKM20 9JFThne5MiWQK9eXXMkOuSnnysBBteh8cw8FrmgNewWqQI8h5E+jgWFSw/0CxQkuDbxa xvDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771650631; x=1772255431; 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=59ZsUGoqVrBnDcGbYd0rbYibIx0NPhs9aBFqqhvhP/s=; b=N73ytWiwuEDI6QOEaDVAsh0Yot/0GGxDXb4PG4gfTqS8y0sJxQhivO4LiwDP7vxWEP Qd+eLUJ5tH5uAH+J3zfRXoWZFyTsnZIlHp788+D+hbtUmx+HfP54ZP6HBgHwWtG/rL+T IbFQRebGeuwSGogjgTory9f2RawqrJWDvZOA3x8Pn10FFFRk8kIRV6iQpiUnrsblOTdW +mRXToL91PwjzpfWVs2G+hYPDl+8va1AmcpD0WkSjhImK/1ye+5W8d8ZkAO+agxhKy1m 3lh7EgUJMwm3c7dAGqbj75AxtpHGOEmkKHZjCop3K32G4Ri5IDf/m84EiGACBlZOzuvJ 5Dsw== X-Gm-Message-State: AOJu0YwoBNwikk07zaibq49EHRJuEsu05vMb7FWyOEdz8mq+xafFxHSU hDrjuw8OdyOkTzeSLnmSIyhe3bWZhC6sJvbE8dxuGx94XKzRJvHAFt4JHYhCeg== X-Gm-Gg: AZuq6aI+jIap0C3j3CG7VVGNhPR9jpvcuVJOaJquYFCyfGOlPgTmbW5b337J8TTAxEq L5dUXx9FV3zRRkpoQpPwfVqBruQJpkUG6AHwKauOcA5duuinbVwERR9sHtME6TJQ6eeD2btEtuV bgTCiqbTDE+TdYSa1FrAXykHq8uRefqZqHdbjVLI8Psl+8wKi5i4mUQ8+M7gJbHo8PyEiNQxzWM 84OvpGZ/hvH586gFMh8nxrNbsfZaLcQabEeXmqwz+tU+AKnIeme3J06JcckrWXVHKMKNGYIbhYL 2TyOjkEDvT7YvTZH3UzgGuFNJv84/5KFF4hEvl+hrZdsh5978KyP84FlTMU6p/1HDBMviLF76wE PtYg6yVgscxOR1DwoS0MzzCQeOTBPnwF6u0KGo0+C2QjP+0m98IgWMkMPkvEGE/Np9nrDCaE6Mx yZ8uZ7SnxZV5N2sPFB6mQNFTFwIFEzl9/5tOyHe3Lgch+pww== X-Received: by 2002:a5d:584c:0:b0:432:5c34:fb32 with SMTP id ffacd0b85a97d-4396f169d00mr3601796f8f.23.1771650631528; Fri, 20 Feb 2026 21:10:31 -0800 (PST) Received: from fedora ([81.6.40.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43970bfa1bdsm2455901f8f.3.2026.02.20.21.10.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Feb 2026 21:10:30 -0800 (PST) From: Stefano Tondo To: openembedded-core@lists.openembedded.org Cc: stefano.tondo.ext@siemens.com, adrian.freihofer@siemens.com, Peter.Marko@siemens.com, jpewhacker@gmail.com, Ross.Burton@arm.com Subject: [PATCH v2 12/18] oeqa/selftest: Add test for download_location defensive handling Date: Sat, 21 Feb 2026 06:10:00 +0100 Message-ID: <20260221051006.335141-13-stondo@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260221051006.335141-1-stondo@gmail.com> References: <20260221051006.335141-1-stondo@gmail.com> 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 ; Sat, 21 Feb 2026 05:10:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/231592 From: Stefano Tondo 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 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py index 41ef52fce1..cae5c95f43 100644 --- a/meta/lib/oeqa/selftest/cases/spdx.py +++ b/meta/lib/oeqa/selftest/cases/spdx.py @@ -414,3 +414,31 @@ 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", + ) + + 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.assertIsInstance(ref.locator, list) + 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)" + )