From patchwork Sat Oct 7 17:47:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 31820 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 C4DEAE95A65 for ; Sat, 7 Oct 2023 17:47:50 +0000 (UTC) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.40]) by mx.groups.io with SMTP id smtpd.web11.22606.1696700865347098451 for ; Sat, 07 Oct 2023 10:47:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=XFTMBbx1; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.220.40, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=btdPbPrUu6UR39omlEG2Q1L2hrI1e4F69HY2JKh9dZMjFLY+HNtPsqnsVu4ks1DTMyciFhKAJOReol8k9Tu1KEC0SEwSwS6kkbIxC0esXqWvDx/9uzbONlcCsJ2fr0R4vJIXbb1L+1cjFLlsOpXe2P5R5pGsjVTyrwzpnluDiEwvorXspbLFxDjhT5FJD7sHFJKNbEsW6kOz6nOgIjirbT9wiCOJxoPcsQQaTcuP+OOaANcfxTx7/vUG4uFfg6N5RwvJ5U3BTwqVVmd/mavFQLbqihBhqrMcz335z/UhFolxZOqdbiwG/C0dPiRSvYL2q0BAshtPRgaCfU2QOmtFdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DZglvSrvXb3iyTOIrA2jKc5fGIrtPO6HBjTmUywcx0c=; b=PIFYZ3qmYomAdHAed/03r4ts3NSxlAncP6oZN9dJ3btEMfpnMQoZF1wZpv6REruPPkXiswGxQ5r7DOtlwWR9XPckre72kqd5JUeo+vVEQlSHf+wu1IzSy5h5XZYBsBHhuFOJx1mdhPbv/o4+2M3I+cUlz2BYwCB9yURHJhSVeD3p39n+VHRSB9PIgeShDHA09KKtDoph3gnXKaBOT6V0Mf8e6K+JVUJR186KwvF7GHWLwAznmgFqHHDp4mNA4eWdifkTqFU/GqgwmbhkK1r+CnJCDBVOZ1exST65ohEOs+qlyeUF7tT+7ZxbI1N4Dm17VkmDlGc1YsvhAP+XNIPPuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.41) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DZglvSrvXb3iyTOIrA2jKc5fGIrtPO6HBjTmUywcx0c=; b=XFTMBbx1DOYyw3R4OvNZNEb9XE9I5wx/+40jEd7Pdmoda1BcOxHfkgef3Th+ggcveoH/A02et2LrcO44jIQi0YYpY68VLsq9lYPDLDapPugJWqu1h/jTT+fifWrnmhuZYBwT/Gxp0RHUUHH0k9SnOHKTpuZR6KU+CXpWdFmv4UVldjma0Or3eRbtUTwM19DXM52QbOSOOG1NPCeKh1JlbYrVj7Zt9z/dDtxB2jAJP08nzxBxr3MB7/GqqDSADsbomxjZHCKV7YF5ZmIxxMMNzm4+PEiCxs13Hl3XOEJrpJCTiBrgB4iGYqXqSipRKh68RghZRcrYEqAzZy1IO16vNQ== Received: from MW4PR04CA0055.namprd04.prod.outlook.com (2603:10b6:303:6a::30) by DM6PR12MB4516.namprd12.prod.outlook.com (2603:10b6:5:2ac::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.43; Sat, 7 Oct 2023 17:47:40 +0000 Received: from MW2NAM12FT093.eop-nam12.prod.protection.outlook.com (2603:10b6:303:6a:cafe::e8) by MW4PR04CA0055.outlook.office365.com (2603:10b6:303:6a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.34 via Frontend Transport; Sat, 7 Oct 2023 17:47:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.41) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.41 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.41; helo=edgeappmail.agilent.com; pr=C Received: from edgeappmail.agilent.com (192.25.218.41) by MW2NAM12FT093.mail.protection.outlook.com (10.13.181.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.9 via Frontend Transport; Sat, 7 Oct 2023 17:47:39 +0000 Received: from chris-virtual-machine.localdomain (192.25.126.5) by edgeappmail.agilent.com (192.25.218.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Sat, 7 Oct 2023 11:48:28 -0600 From: Chris Laplante To: CC: Chris Laplante Subject: [PATCH 1/2] recipetool: use context manager for tinfoil to avoid hang Date: Sat, 7 Oct 2023 13:47:00 -0400 Message-ID: <20231007174701.1890063-1-chris.laplante@agilent.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2NAM12FT093:EE_|DM6PR12MB4516:EE_ X-MS-Office365-Filtering-Correlation-Id: a33c5d21-0f20-46be-18c3-08dbc75d800f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: awhSjWh3RIejLBZDqJEn26Djx4RHM0b22m6o/I7cirLkzl3c/gKpQ2Kh2eTZ7Hex//Q5wGn9XTNZ6NEmXC+dlHWX86MeB+V4Qy5rVDVS50MLjkr+wpLz0lb0r+od6lPtuC/LDzvnJtjOZ2NeR7QNO87Pj8v4JAht/hsjwtb1bbdSePCIxwhJz00QIJqI/BhlpM9V3dxpq9JYWGFuIdj8PMKx5tmVptZhnsbZw9lRMuiOM6FgBho4ovxxo4zuUj62c/Dl2W/mo/3wOEUg7qMKkDsXXAFYdnjUndwaIYaN2ApJpC3bG3WDLqFwqo/j7kVJ4hD/ebJQzWRD10b9Upm9rFGclRwwLBYFlhWEXyZNe4VDih3ss7r77/DmFyOG917AbtUqRn4M+dF+WdaZBsgDV0gAX++jWpy4AecWPEbZVilzcd87VTh8QLEWrNu8MRrc7iVMXqr4wIm+nCSuVBdrHKloH4dCNq8uh0icGX+XFB8gP6U6wRXOU828uU4UKiTyW5zSLxRuZlbircfcg2sm153lAH8lXIrVllfGNjM9IbxCVCyliQYjh5GfL1TH5uIZIgIKdttfHycEOvODfRSRfbu3k1JnddU2EoDFG7l5iCv6U7uUgf+CUDuzFdNQ0paUQpI3qk2MTCzfiRww8FIutMIiprOKsWvZ9Ut0TpALkFZElTeb/fCtuycK3YNDqDaiXzlqBUurj72RpEIqpC/Cj/6xkEBy8m7wV62halhPDiy/U3kv2TidjqxEi9TYeKjg X-Forefront-Antispam-Report: CIP:192.25.218.41;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edgeappmail.agilent.com;PTR:exch.smtp.agilent.com;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(186009)(82310400011)(1800799009)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(40480700001)(40460700003)(83380400001)(107886003)(1076003)(956004)(2616005)(336012)(426003)(26005)(47076005)(36860700001)(70206006)(316002)(6916009)(8936002)(8676002)(4326008)(5660300002)(41300700001)(44832011)(6666004)(2906002)(82740400003)(478600001)(36756003)(356005)(7636003)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2023 17:47:39.6322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a33c5d21-0f20-46be-18c3-08dbc75d800f X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.41];Helo=[edgeappmail.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-MW2NAM12FT093.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4516 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 07 Oct 2023 17:47:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188797 If you individually run some of the devtool selftests, e.g. with: oe-selftest -r devtool.DevtoolAddTests.test_devtool_add then you bypass the sanity check in test_create_workspace that checks for an existing workspace layer. Eventually, recipetool will be called in a test, and tinfoil.prepare will fail. But because tinfoil.shutdown doesn't get called, the thread spawned by bb.server.process.BBUIEventQueue spins forever and recipetool never exits, hanging the test. Signed-off-by: Chris Laplante --- scripts/recipetool | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/scripts/recipetool b/scripts/recipetool index e2d585d2c5..9eaecfbde6 100755 --- a/scripts/recipetool +++ b/scripts/recipetool @@ -22,13 +22,6 @@ logger = scriptutils.logger_create('recipetool') plugins = [] -def tinfoil_init(parserecipes): - import bb.tinfoil - import logging - tinfoil = bb.tinfoil.Tinfoil(tracking=True) - tinfoil.logger.setLevel(logger.getEffectiveLevel()) - tinfoil.prepare(not parserecipes) - return tinfoil def main(): @@ -67,8 +60,11 @@ def main(): scriptutils.logger_setup_color(logger, global_args.color) - tinfoil = tinfoil_init(False) - try: + import bb.tinfoil + with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: + tinfoil.logger.setLevel(logger.getEffectiveLevel()) + tinfoil.prepare(True) + for path in (tinfoil.config_data.getVar('BBPATH').split(':') + [scripts_path]): pluginpath = os.path.join(path, 'lib', 'recipetool') @@ -100,8 +96,6 @@ def main(): ret = args.func(args) except bb.BBHandledException: ret = 1 - finally: - tinfoil.shutdown() return ret From patchwork Sat Oct 7 17:47:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "chris.laplante@agilent.com" X-Patchwork-Id: 31819 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 C8E97E95A62 for ; Sat, 7 Oct 2023 17:47:50 +0000 (UTC) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.52]) by mx.groups.io with SMTP id smtpd.web11.22607.1696700865570055777 for ; Sat, 07 Oct 2023 10:47:45 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="dkim: body hash did not verify" header.i=@agilent.com header.s=selector1 header.b=kLW0QAeD; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: agilent.com, ip: 40.107.93.52, mailfrom: chris.laplante@agilent.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MGZLSUJYRuLJa8QQmaY5JPpRciOX8RqOIuPtVZk+ChJbuVR9dxi6aQrzjyz6vXg0B0TubFp8dL6SiwmjYzTenQtLs/mIRhz+XlLVeyxu8EZBnOr3Pc62mpqmw9gkR+N1S61MVhwFr41nUIZskDVlWHQAko86Cqew05n1jZ4lM9zMX2Q+X+5849uc/0GTIxXIJAkNpHeRymhZ2Muz+BYbif2mH/ZULO9jL4mDGKhTyXh/I+NhgydoYe1mNo6KQr3QkuPS8+SdhzZYRa0xuegv/AMDbiP2nwnItE3qBxIB52acPHxlrwpi3l0nUcpA618rrB4RS8h7neC2qQ+EERoLgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=S0k/wrCuFprc5mDOLBUqPWfWxwwznp8Qzd/U8TPsfEM=; b=l4L99MMoLiRogVDT19WM2KIpMEd5yDK2FoltrsG9pIfDT++Eb8UEsqOBuMag+s977GuqT1bB9yV/yf06kE0L7uRtlfXTzMOhpUcepcGWFm5AFjqkPX3mm+h3yK9JSMjaY4JnS+CwpMi9rda9T81sgl7QLG3MQFuypO8r0O/Zq6HnEM/+To/DV0pW/PayP78eb/bH0ucH+gybIVzMWILQnEeo9cQ4XbcE3+JukZxlmYBA1eTm2Yb8xM628dSMUiREyfmuVz/am1kgmFHHSDUXfyA/Ax5v+cmDJI7+GYDpoNAFSsuNI+/ojDjgedXOKtX6BlQzNHgVqFgYf6XxfqbhhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.25.218.41) smtp.rcpttodomain=lists.openembedded.org smtp.mailfrom=agilent.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=agilent.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agilent.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S0k/wrCuFprc5mDOLBUqPWfWxwwznp8Qzd/U8TPsfEM=; b=kLW0QAeDliJ4jqUtdU+qGi1OSgWiOyYjMp9go1zTOkmoEuFbdC0b/lhu1KZi06z49tf8zNdIsQPyyLTlQDco9WApgn5HLg+zZamq02oNlKd4niRAVUIYcCRHOeQtUIqGeSgZaqUuD5+6iqJ51Q+gPUcSGQKSX+uCz4QfkNoD5loIpJjhi8fUmfaOp0ahBuySG7lz+GBtLsNdOclY6xXT+7r6zNVYsZ9D4FYe4ILhiJEjYVK2TkOgYYgYYlg6Lm66UhHsDeSFYZIuEu+A2Gtm4gVUaCB38h0jeK5r1PpSg2LRl7XVtXsTqAXloX4sGX3IIkZsCL7K8Um4MuDIyUVGbg== Received: from MW4PR04CA0058.namprd04.prod.outlook.com (2603:10b6:303:6a::33) by BL3PR12MB6593.namprd12.prod.outlook.com (2603:10b6:208:38c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.37; Sat, 7 Oct 2023 17:47:41 +0000 Received: from MW2NAM12FT093.eop-nam12.prod.protection.outlook.com (2603:10b6:303:6a:cafe::a4) by MW4PR04CA0058.outlook.office365.com (2603:10b6:303:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.31 via Frontend Transport; Sat, 7 Oct 2023 17:47:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.25.218.41) smtp.mailfrom=agilent.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=agilent.com; Received-SPF: Pass (protection.outlook.com: domain of agilent.com designates 192.25.218.41 as permitted sender) receiver=protection.outlook.com; client-ip=192.25.218.41; helo=edgeappmail.agilent.com; pr=C Received: from edgeappmail.agilent.com (192.25.218.41) by MW2NAM12FT093.mail.protection.outlook.com (10.13.181.54) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.9 via Frontend Transport; Sat, 7 Oct 2023 17:47:40 +0000 Received: from chris-virtual-machine.localdomain (192.25.126.5) by edgeappmail.agilent.com (192.25.218.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Sat, 7 Oct 2023 11:48:28 -0600 From: Chris Laplante To: CC: Chris Laplante Subject: [PATCH 2/2] oeqa/selftest/devtool: fail if non-selfest workspace layer present Date: Sat, 7 Oct 2023 13:47:01 -0400 Message-ID: <20231007174701.1890063-2-chris.laplante@agilent.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231007174701.1890063-1-chris.laplante@agilent.com> References: <20231007174701.1890063-1-chris.laplante@agilent.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW2NAM12FT093:EE_|BL3PR12MB6593:EE_ X-MS-Office365-Filtering-Correlation-Id: 173983f9-0175-48a9-4cb3-08dbc75d80a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iq/PDwC/LDCUelBPnZdU3yR5gjs/UP0o5OeNmKMPrhZfPqlRKhWEgdDiOoZQLlqtzr4FcpPnqovqu8dWFKWjLzbk7PQJUIfdQlSBqCjrX8F/uewKx2Up5jTVEbct7u5TusZVSzCEctxq/nttpcK9dzhQ7ZTEpgYe/qnoizA7/X6HEBrnXmt+H0Qj0TvFpBUU+FEETo7w8pfjG7f9SZ8lpB+6RyXJd1wcmfGea1dJGs9QDvtj6rH6aSrBvv0TNU4F8kuGgXMvszMmVnlLMgUTeTYbaYx/YSgWszIk512CYvC118meyIWRlkh5MfUu8Po5C5zObPQeMDxr4PuBz0SmvhtwoP8NAu6yuw4ixyvUCajJUDyB9iDTVUF+06dKmqBz0ZkC9P/1UKHvOHOQxM+j5HRQT5z9ayd91CYn+TtbNp1yvAJhu3TE1rKHdd44jrBRtihfwtfLnl5vLwr4/yLfCbiYzIBruF06I3sjPzvWVPsb4846cEaknMfGQjs+Gi57EEWqA/MfHypt4mIwb9EGLBt/LiuSnf4klVvgY9G/6xfYrhpBsdABPqPHOw6y0x7nD/++Duf+G82z26mtZxLY3DeIBDflCxEAbuB+3OAPCRH+DuTM2GdSePtRgozpKTjsu8b/z/0UtiDYwpUhw+hf/5YQE7x4UwgNdbPYJnbr8TSG4KluFktVEiRrwmFV1G30HeATkn7gzorJxhWi/xsctB37Rri5HbPhUzUF69Ff/NXREfI9YAn8fQ6ChgCdhOuZ X-Forefront-Antispam-Report: CIP:192.25.218.41;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:edgeappmail.agilent.com;PTR:exch.smtp.agilent.com;CAT:NONE;SFS:(13230031)(4636009)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(186009)(82310400011)(1800799009)(451199024)(64100799003)(36840700001)(40470700004)(46966006)(2906002)(44832011)(8936002)(5660300002)(8676002)(4326008)(107886003)(316002)(41300700001)(6916009)(70206006)(2616005)(40480700001)(36860700001)(40460700003)(478600001)(1076003)(426003)(6666004)(956004)(26005)(36756003)(336012)(7636003)(356005)(86362001)(47076005)(83380400001)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: agilent.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2023 17:47:40.6166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 173983f9-0175-48a9-4cb3-08dbc75d80a5 X-MS-Exchange-CrossTenant-Id: a9c0bc09-8b46-4206-9351-2ba12fb4a5c0 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a9c0bc09-8b46-4206-9351-2ba12fb4a5c0;Ip=[192.25.218.41];Helo=[edgeappmail.agilent.com] X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TreatMessagesAsInternal-MW2NAM12FT093.eop-nam12.prod.protection.outlook.com X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL3PR12MB6593 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sat, 07 Oct 2023 17:47:50 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188798 The tests will fail anyway (since you will have two 'workspacelayer' layers), so might as well make it fail faster and be clear. Signed-off-by: Chris Laplante --- meta/lib/oeqa/selftest/cases/devtool.py | 36 ++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index b577f6d62a..2c38eeca17 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -3,7 +3,7 @@ # # SPDX-License-Identifier: MIT # - +import dataclasses import os import re import shutil @@ -11,6 +11,7 @@ import tempfile import glob import fnmatch import unittest +from typing import List from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer @@ -90,6 +91,12 @@ def tearDownModule(): bb.utils.edit_bblayers_conf(bblayers_conf, None, None, bblayers_edit_cb) shutil.rmtree(templayerdir) +@dataclasses.dataclass +class BBLayerConfEntry: + layer: str + path: str + priority: int + class DevtoolTestCase(OESelftestTestCase): def setUp(self): @@ -100,6 +107,29 @@ class DevtoolTestCase(OESelftestTestCase): 'This test cannot be run with a workspace directory ' 'under the build directory') + # Ensure there is no actual workspace dir enabled + self.assertFalse(self.is_external_workspace_layer_enabled(), + "This test cannot be run with a workspace layer in bblayers.conf") + + def is_selftest_workspace_layer_enabled(self): + """Returns true if the selftest workspace layer is enabled in bblayers.conf""" + return any([layer for layer in self._read_bblayers() if + layer.layer == "workspacelayer" and layer.path == self.workspacedir]) + + def is_external_workspace_layer_enabled(self): + """Returns true if a workspace layer (that wasn't installed by selftest) is enabled in bblayers.conf""" + return any([layer for layer in self._read_bblayers() if + layer.layer == "workspacelayer" and layer.path != self.workspacedir]) + + def _read_bblayers(self) -> List[BBLayerConfEntry]: + """Call bitbake-layers show-layers and return list of layers""" + ret = [] + for line in runCmd('bitbake-layers show-layers').output.splitlines(): + line = line.strip() + if match := re.match(r'^(\S+) +([^\n]*?) +(\d+)$', line): + ret.append(BBLayerConfEntry(match[1], match[2], match[3])) + return ret + def _check_src_repo(self, repo_dir): """Check srctree git repository""" self.assertTrue(os.path.isdir(os.path.join(repo_dir, '.git')), @@ -327,8 +357,8 @@ class DevtoolTests(DevtoolBase): def test_create_workspace(self): # Check preconditions - result = runCmd('bitbake-layers show-layers') - self.assertTrue('\nworkspace' not in result.output, 'This test cannot be run with a workspace layer in bblayers.conf') + self.assertFalse(self.is_selftest_workspace_layer_enabled(), + "This test cannot be run with the selftest workspace layer in bblayers.conf") # remove conf/devtool.conf to avoid it corrupting tests devtoolconf = os.path.join(self.builddir, 'conf', 'devtool.conf') self.track_for_cleanup(devtoolconf)