From patchwork Mon Mar 2 16:01:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Tondo X-Patchwork-Id: 82276 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 30C2FEA4E30 for ; Mon, 2 Mar 2026 16:01:56 +0000 (UTC) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.164110.1772467306746799581 for ; Mon, 02 Mar 2026 08:01:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OOOJGedN; spf=pass (domain: gmail.com, ip: 209.85.128.54, mailfrom: stondo@gmail.com) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4836f4cbe0bso39709085e9.3 for ; Mon, 02 Mar 2026 08:01:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772467305; x=1773072105; 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=ZpxKqKQQbnR2TxREyNR2rmqBUSh4IJYH9av9Fh9I1uc=; b=OOOJGedNtQVf3v17de7YNge7KzzUdrac5tKMKrqjs8HyThsxErEuPdAelqQZMQBXhH cuNBlk/OjVtMZDYGHlvxb2idmSkU92SjjY7islSNYRySre35e4zYSx0c4GI/vSp0Ox/J rx/JM4QGgkruP6TNzBp2iCnT7FeTzkasVSABMGU1h2KAEwMzFtjCKvG5xY6WcrFEGh2Z 57zqrR3bSxjIe+85FaV3Lp7ogZvcH4sRMo3fWp2DhJb9eJEsIrG24mdJeLq31HlLx6p3 7qCHCUds1jnAJBIx19ph6gtYPyJelxIpnm17WUOBXB8InQMXrT8FpYtlk/TLZp7bwelS yH1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772467305; x=1773072105; 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=ZpxKqKQQbnR2TxREyNR2rmqBUSh4IJYH9av9Fh9I1uc=; b=n4OL698afYiBYSt/ELVPtTwSYebnqsov6m3SZzd1tEGdT0q0B22vfh201CENnwP+tH rZREpmvkRAW/PTfMoaZDLzTxnzKvTgSmdqI8vptIHKcaqOkqhni9AuFBCqkEyZJaKNvc pCEIQ8Sv4ptrthcucPfGSViHjUwQ4No0ZcQKg030V+cBt1orGg9+4OJdxLnX12Nq5n58 VzbDiJF7X6rpsrAHnFo1sINMNIXxm7UrZXaFfGdHmdcS7wWpNdO3fi7AddiTJka1Qtt2 aSeT9iR9VTePEhrradDN7jfZ492goDEjB0V7rKe1ezaaL2+NTr2de5Zzyk1wgRj7K1ro Tl9g== X-Gm-Message-State: AOJu0Yw+1YujVZBbSaYbJKCiZfGDHdAflaVe6lwIF4LGI20gjLfML8Jl m27P96IQpPQMtOX3m5m48DGG5efV3EdcjE5t97NZgot76S5vHhZvOhiQD5IrJA== X-Gm-Gg: ATEYQzw6KqYR8eDYo11Rlt86DXnXCB9vIHjkjn0CT/gEB4pFUANATfTX5oxhjnLVfZc eYYH8R6YyMjFx7YOWkEHSN6iZMAps59pohIdDliot/ghjWt+l2NXvifL7/IXZ79tZyo2QBPa+uw uG0fRiLyRkhCr/0IEyEzzTKLoNUe28jxlBY2lI1II9wHgyG6pgUfKrL+jekuX6T+gzz93+nPAZ9 5YZ492fQ2j7Ng7YenbXZQ1N3dJFslsSRt0mjqhY2UDxXinji0OWVq9G9HovaKpplqa2lKD2g6Ud EqthIiZVg54t1FufSYBxSIX95MXgr0gWInqDQ2Y8WH+xWeiZefLFr/MAGmWzdrJf8y2XDP8E0eg ZBlIucqL4kYOfcqgxo0Nx0ZVb6XwlNBVpI1SOP6n4MhTdn6JBh5/52TRJU+qcvVj9jle+th8339 xiCMyife3cTfgmAhBpaIYAtTNbGtMUl62hUY/d6azChwa61hyqNg14bObaUBimn/w2tWY6bVQ4H i5GHtiQBg660savRELm X-Received: by 2002:a05:6000:26c6:b0:439:bc2b:cb50 with SMTP id ffacd0b85a97d-439bc2bd0cdmr3832516f8f.4.1772467304464; Mon, 02 Mar 2026 08:01:44 -0800 (PST) Received: from fedora (mob-194-230-144-8.cgn.sunrise.net. [194.230.144.8]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4399c60e40fsm28390097f8f.7.2026.03.02.08.01.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Mar 2026 08:01:43 -0800 (PST) From: Stefano Tondo X-Google-Original-From: Stefano Tondo To: openembedded-core@lists.openembedded.org Cc: Ross.Burton@arm.com, jpewhacker@gmail.com, stefano.tondo.ext@siemens.com, Peter.Marko@siemens.com, adrian.freihofer@siemens.com Subject: [PATCH v5 07/10] oeqa/selftest: Add test for download_location defensive handling Date: Mon, 2 Mar 2026 17:01:11 +0100 Message-ID: <20260302160114.46884-8-stefano.tondo.ext@siemens.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260302160114.46884-1-stefano.tondo.ext@siemens.com> References: <20260302160114.46884-1-stefano.tondo.ext@siemens.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 ; Mon, 02 Mar 2026 16:01:56 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/232214 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..d7dee5e2ee 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.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)" + )