From patchwork Thu Sep 21 22:37:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 30910 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 7A8DBE7D0B4 for ; Thu, 21 Sep 2023 22:37:17 +0000 (UTC) Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) by mx.groups.io with SMTP id smtpd.web10.9201.1695335831214209068 for ; Thu, 21 Sep 2023 15:37:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=EeqiWZ35; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.52, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4052755d5bbso16689375e9.2 for ; Thu, 21 Sep 2023 15:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1695335829; x=1695940629; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=1GsuBFN80/Xj9qc3c76oiFaNodfLerEwJRIxE1Zv6v8=; b=EeqiWZ35MfMonR4xT0JZS3JPjjIofJruRRXULSOs1ZD3ZiiBXd8Q1nPwkrvb5Cc3dw 5F2sct50D/exE22YQdQVtVXIoskGuO+3l6pxZXtZ+ZxR2jptmRrDUJUwifeJK+54xYgh yVv/DM9JcVOm5etnom+FqsKIOoSCnpe9wLJIg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695335829; x=1695940629; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1GsuBFN80/Xj9qc3c76oiFaNodfLerEwJRIxE1Zv6v8=; b=utugxLBtqoUNIbVF9jEEt6kRozwLYt2+2PzcoPx/K103+X3AMfV3+m+fG7zcoZUMrj UxczgUG7SRA/TnkT9SbHDb1xfGGtz3tjsVxIidurU+A8N0d1fhF7y/jZjNxg7ASGPOS3 5lypQfi3R7XG0X3dTTrNwGCdj6AKtTuS6JGwnHdu6TMG9gvp9dUZd2w4OqIdBrn32PHS Td6G5dVTHWwVLPBv2BF7slwA9dmp8XpfvTEDjXQ0c2Md6KmXtqbe5/7+bzqGjLKNBkaC nTfcfRP+CKzxRt+sGxZ4SISs+uaVgqoxq9jD1WOe1WfoNHm0lC/I6zEA2Yqdz0di6TtT 24aQ== X-Gm-Message-State: AOJu0YyvZTqMphBq5S9zpcdvH79J7vctCRiVBBw4YZ8PY3MM9Zaw6Nqg SOAMbMuiIqbL/OwpXJFt0K77SC/8M4386+X/KDc= X-Google-Smtp-Source: AGHT+IHFRiBmHbHHStkGtVLPFPbzbr//5xUHvafiF9VshY2Q/jixFJXQXdnHwgaxQVNEO7sDl7Rjzw== X-Received: by 2002:a05:600c:224e:b0:3fe:5501:d284 with SMTP id a14-20020a05600c224e00b003fe5501d284mr5876028wmm.11.1695335829281; Thu, 21 Sep 2023 15:37:09 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:f6e4:1bee:736d:f9fd]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c05cb00b003fc06169ab3sm947410wmd.20.2023.09.21.15.37.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:37:08 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/5] oeqa/selftest: Fix broken symlink removal handling Date: Thu, 21 Sep 2023 23:37:04 +0100 Message-Id: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 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 ; Thu, 21 Sep 2023 22:37:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188029 The test above this removal correctly looks at symlinks however to remove a symlink we should call unlink(), not remove(). This avoids some build failures/tracebacks. Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 7dab5614a92..16486e7eb99 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -437,7 +437,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): output_link = os.path.join(os.path.dirname(args.output_log), "%s-results.log" % self.name) if os.path.lexists(output_link): - os.remove(output_link) + os.unlink(output_link) os.symlink(args.output_log, output_link) return rc From patchwork Thu Sep 21 22:37:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 30912 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 88A59E7D0B7 for ; Thu, 21 Sep 2023 22:37:17 +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.web11.9340.1695335831556810968 for ; Thu, 21 Sep 2023 15:37:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=SBVktoh8; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.54, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-40531812168so14100785e9.1 for ; Thu, 21 Sep 2023 15:37:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1695335830; x=1695940630; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=D7sg/PZTmHlJ7vXEkIzDZFb15Us4cTXxzssYs4FHLRg=; b=SBVktoh8+B1PJ59lz/61NAo8GJv+27BESCuPD8Tv4v2dEb3kPHt+Kj4YOe6jpiqflz T1LfJtUdFoxOhO12rL5o8DXL54blWRkGlbZZpv2XGKzfTIJn1PCuL+BfWM0nNKIlhq79 E+uEb/jLw5qinO9wbh/JmsErBAOk7k4ekzgKU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695335830; x=1695940630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D7sg/PZTmHlJ7vXEkIzDZFb15Us4cTXxzssYs4FHLRg=; b=YIDXff0OeW7kqhh4dOhXe7os3qiFJsDnyeuHN06SXyiWaIwdaiZekUQKGeKU/s+jge PxHBkslqltzrpwL1SCNK/dY/vzS5GF0tt0Qgz/bXW44dUTBF+Hh8MOepYRSO2wVv/Xfh bQuWJj3l+UGOFZWt1Sa3lHLMDcqH87c/hGYoVkKFBMG2iSoywR2puZfSCrMzouINdAb3 Aa3iLut61dSnp3aqMwLgzT4Y+7R6lrpVRtJm1fTOxsd8BUbBP9Uwjci3a+4OJmPkC66H egp1nOrdJJiuTDDO1e0SN1mQKTd42+XydhQ2ltGqJRE3K0oRML/xp8dc/qrM21OvJnBy cO0Q== X-Gm-Message-State: AOJu0Yw/+FH1o3Q5JhTvBGs7SyQj370fE4wuYLOxK2zXYTn4HqWOWTtN jq0LkyHfVHr/oOIK98TBbNZmYwoARBrUlekHoWk= X-Google-Smtp-Source: AGHT+IH3bbtAqRu5qA+F6hv8cjwdFffYcv9ezuY0m+eOtRhVuqcL0j2nG962boz7o4h79iQQZ4y6xQ== X-Received: by 2002:a7b:ca5a:0:b0:401:b53e:6c57 with SMTP id m26-20020a7bca5a000000b00401b53e6c57mr6644038wml.9.1695335829854; Thu, 21 Sep 2023 15:37:09 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:f6e4:1bee:736d:f9fd]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c05cb00b003fc06169ab3sm947410wmd.20.2023.09.21.15.37.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:37:09 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/5] oeqa/selftest/reproducible: Avoid oe-selftest startup delays Date: Thu, 21 Sep 2023 23:37:05 +0100 Message-Id: <20230921223708.1333390-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> References: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 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 ; Thu, 21 Sep 2023 22:37:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188030 Currently the bb_get_var calls trigger multiple "bitbake -e" executions which slow the start of oe-selftest for any test. Rework the code to avoid these delays. Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/reproducible.py | 27 +++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/reproducible.py b/meta/lib/oeqa/selftest/cases/reproducible.py index 4c6ed4e4a50..84c6c3a05ff 100644 --- a/meta/lib/oeqa/selftest/cases/reproducible.py +++ b/meta/lib/oeqa/selftest/cases/reproducible.py @@ -128,23 +128,17 @@ class DiffoscopeTests(OESelftestTestCase): class ReproducibleTests(OESelftestTestCase): # Test the reproducibility of whatever is built between sstate_targets and targets - package_classes = get_bb_var("OEQA_REPRODUCIBLE_TEST_PACKAGE") - if package_classes: - package_classes = package_classes.split() - else: - package_classes = ['deb', 'ipk', 'rpm'] + package_classes = ['deb', 'ipk', 'rpm'] # Maximum report size, in bytes max_report_size = 250 * 1024 * 1024 # targets are the things we want to test the reproducibility of - targets = get_bb_var("OEQA_REPRODUCIBLE_TEST_TARGET") - if targets: - targets = targets.split() - else: - targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world'] + targets = ['core-image-minimal', 'core-image-sato', 'core-image-full-cmdline', 'core-image-weston', 'world'] + # sstate targets are things to pull from sstate to potentially cut build/debugging time - sstate_targets = (get_bb_var("OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS") or "").split() + sstate_targets = [] + save_results = False if 'OEQA_DEBUGGING_SAVED_OUTPUT' in os.environ: save_results = os.environ['OEQA_DEBUGGING_SAVED_OUTPUT'] @@ -159,11 +153,20 @@ class ReproducibleTests(OESelftestTestCase): def setUpLocal(self): super().setUpLocal() - needed_vars = ['TOPDIR', 'TARGET_PREFIX', 'BB_NUMBER_THREADS', 'BB_HASHSERVE'] + needed_vars = ['TOPDIR', 'TARGET_PREFIX', 'BB_NUMBER_THREADS', 'BB_HASHSERVE', 'OEQA_REPRODUCIBLE_TEST_PACKAGE', 'OEQA_REPRODUCIBLE_TEST_TARGET', 'OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS'] bb_vars = get_bb_vars(needed_vars) for v in needed_vars: setattr(self, v.lower(), bb_vars[v]) + if bb_vars['OEQA_REPRODUCIBLE_TEST_PACKAGE']: + self.package_classes = bb_vars['OEQA_REPRODUCIBLE_TEST_PACKAGE'].split() + + if bb_vars['OEQA_REPRODUCIBLE_TEST_TARGET']: + self.targets = bb_vars['OEQA_REPRODUCIBLE_TEST_TARGET'].split() + + if bb_vars['OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS']: + self.sstate_targets = bb_vars['OEQA_REPRODUCIBLE_TEST_SSTATE_TARGETS'].split() + self.extraresults = {} self.extraresults.setdefault('reproducible.rawlogs', {})['log'] = '' self.extraresults.setdefault('reproducible', {}).setdefault('files', {}) From patchwork Thu Sep 21 22:37:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 30913 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 78896E7D0B3 for ; Thu, 21 Sep 2023 22:37:17 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.9341.1695335832422335610 for ; Thu, 21 Sep 2023 15:37:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=awlXpsrl; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40528376459so15453165e9.3 for ; Thu, 21 Sep 2023 15:37:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1695335830; x=1695940630; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=GwYJZcT4uvCKqjNspD3guplMdhd3aW41K5/RiGXcHJM=; b=awlXpsrlH5IVqZvhpDFjoY2KE9tAtsmAxiVdcoiVssboTtleVguIc8/VhjKcq1BUty r0L5zb3UiI3xVS0T1/IwJAsLVO4+toY9MM93ibNVmjJYbL1jmzzCqlTKySJ6Uyu1LvmW jIT5SAULxQcN8VD38EzCmSOp3Y6s9UCT2EL9I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695335830; x=1695940630; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GwYJZcT4uvCKqjNspD3guplMdhd3aW41K5/RiGXcHJM=; b=O3+OM1N3iB2/7Yf+XQ+wtfGhPEM2wIJEQlHvISTgzUUOs4mO8iFWafBC1U9rcDf/om ts374B2Znfn7cveJ1ujox64Ls88ZdpZ43navBRRwX8jb33JrkS+sGGugI1wLg2XQfCmQ tAGC5bpr4zAteCGmbbPpFJO7M+pDk9ILR6xgUpG5tGHtzRcsj1hpaYtabcdWG8SfxhxK Mz6Rf2I0fo/+iuZaUoM4jOJeUSnfJ5i1QaZTMI0vNQoAK3C/Dtw7Nb8H3+1vs0AJ/p9m aCu0ZWnqMhJB0U6xAWNa4O1+txLdflKC72OoyzwJSM6N5tzmQkW71y0K9P+idlZUyIrX YfNg== X-Gm-Message-State: AOJu0YyNNc0F+b0K86fXXIB0DDs4pLmevVJJ7/EFOQAURZJDsGDnOr36 33enL+9weHafDIRw6/vpXOTsbOlN5QEANMzR8lE= X-Google-Smtp-Source: AGHT+IFjELoSjLbCgW/kvM4EHgA1X/aQ8LCjV5M3nGLDJYZzn+oDxWl9R0lW8nqsFRiSYTlrWEx53Q== X-Received: by 2002:a05:600c:850e:b0:405:3a14:aa1a with SMTP id gw14-20020a05600c850e00b004053a14aa1amr1476467wmb.18.1695335830525; Thu, 21 Sep 2023 15:37:10 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:f6e4:1bee:736d:f9fd]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c05cb00b003fc06169ab3sm947410wmd.20.2023.09.21.15.37.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:37:10 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 3/5] oeqa: Streamline oe-selftest startup time Date: Thu, 21 Sep 2023 23:37:06 +0100 Message-Id: <20230921223708.1333390-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> References: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 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 ; Thu, 21 Sep 2023 22:37:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188031 "bitbake -e" executions from get_bb_var calls are slow and slow down oe-selftest startup. Rationalise the code to avoid them and minimise the number of "parsing" locations we use by caching key variables and passing them around more. This was particularly problematic with oe-selftest -j usage since it would have multiple bitbake -e executions per process making parallel usage particularly slow. Signed-off-by: Richard Purdie --- meta/lib/oeqa/core/utils/concurrencytest.py | 5 +-- meta/lib/oeqa/selftest/context.py | 35 ++++++++++++--------- meta/lib/oeqa/utils/commands.py | 6 ++-- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/meta/lib/oeqa/core/utils/concurrencytest.py b/meta/lib/oeqa/core/utils/concurrencytest.py index 4f77589b005..5e20b0e1266 100644 --- a/meta/lib/oeqa/core/utils/concurrencytest.py +++ b/meta/lib/oeqa/core/utils/concurrencytest.py @@ -193,11 +193,12 @@ class dummybuf(object): # class ConcurrentTestSuite(unittest.TestSuite): - def __init__(self, suite, processes, setupfunc, removefunc): + def __init__(self, suite, processes, setupfunc, removefunc, bb_vars): super(ConcurrentTestSuite, self).__init__([suite]) self.processes = processes self.setupfunc = setupfunc self.removefunc = removefunc + self.bb_vars = bb_vars def run(self, result): testservers, totaltests = fork_for_tests(self.processes, self) @@ -243,7 +244,7 @@ class ConcurrentTestSuite(unittest.TestSuite): def fork_for_tests(concurrency_num, suite): testservers = [] if 'BUILDDIR' in os.environ: - selftestdir = get_test_layer() + selftestdir = get_test_layer(suite.bb_vars['BBLAYERS']) test_blocks = partition_tests(suite, concurrency_num) # Clear the tests from the original suite so it doesn't keep them alive diff --git a/meta/lib/oeqa/selftest/context.py b/meta/lib/oeqa/selftest/context.py index 16486e7eb99..5a09aeedffe 100644 --- a/meta/lib/oeqa/selftest/context.py +++ b/meta/lib/oeqa/selftest/context.py @@ -35,12 +35,13 @@ def get_oeselftest_metadata(args): return result class NonConcurrentTestSuite(unittest.TestSuite): - def __init__(self, suite, processes, setupfunc, removefunc): + def __init__(self, suite, processes, setupfunc, removefunc, bb_vars): super().__init__([suite]) self.processes = processes self.suite = suite self.setupfunc = setupfunc self.removefunc = removefunc + self.bb_vars = bb_vars def run(self, result): (builddir, newbuilddir) = self.setupfunc("-st", None, self.suite) @@ -79,16 +80,15 @@ class OESelftestTestContext(OETestContext): else: self.removebuilddir = removebuilddir + def set_variables(self, vars): + self.bb_vars = vars + def setup_builddir(self, suffix, selftestdir, suite): - # Get SSTATE_DIR from the parent build dir - with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: - tinfoil.prepare(quiet=2, config_only=True) - d = tinfoil.config_data - sstatedir = str(d.getVar('SSTATE_DIR')) + sstatedir = self.bb_vars['SSTATE_DIR'] builddir = os.environ['BUILDDIR'] if not selftestdir: - selftestdir = get_test_layer() + selftestdir = get_test_layer(self.bb_vars['BBLAYERS']) if self.newbuilddir: newbuilddir = os.path.join(self.newbuilddir, 'build' + suffix) else: @@ -155,9 +155,9 @@ class OESelftestTestContext(OETestContext): if processes: from oeqa.core.utils.concurrencytest import ConcurrentTestSuite - return ConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir) + return ConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir, self.bb_vars) else: - return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir) + return NonConcurrentTestSuite(suites, processes, self.setup_builddir, self.removebuilddir, self.bb_vars) def runTests(self, processes=None, machine=None, skips=[]): if machine: @@ -270,7 +270,7 @@ class OESelftestTestContextExecutor(OETestContextExecutor): builddir = os.environ.get("BUILDDIR") self.tc_kwargs['init']['config_paths'] = {} - self.tc_kwargs['init']['config_paths']['testlayer_path'] = get_test_layer() + self.tc_kwargs['init']['config_paths']['testlayer_path'] = get_test_layer(bbvars["BBLAYERS"]) self.tc_kwargs['init']['config_paths']['builddir'] = builddir self.tc_kwargs['init']['config_paths']['localconf'] = os.path.join(builddir, "conf/local.conf") self.tc_kwargs['init']['config_paths']['bblayers'] = os.path.join(builddir, "conf/bblayers.conf") @@ -310,10 +310,10 @@ class OESelftestTestContextExecutor(OETestContextExecutor): meta_selftestdir = os.path.join( self.tc.td["BBLAYERS_FETCH_DIR"], 'meta-selftest') if os.path.isdir(meta_selftestdir): - runCmd("bitbake-layers add-layer %s" %meta_selftestdir) + runCmd("bitbake-layers add-layer %s" % meta_selftestdir) # reload data is needed because a meta-selftest layer was add self.tc.td = get_bb_vars() - self.tc.config_paths['testlayer_path'] = get_test_layer() + self.tc.config_paths['testlayer_path'] = get_test_layer(self.tc.td["BBLAYERS"]) else: self.tc.logger.error("could not locate meta-selftest in:\n%s" % meta_selftestdir) raise OEQAPreRun @@ -351,8 +351,15 @@ class OESelftestTestContextExecutor(OETestContextExecutor): _add_layer_libs() - self.tc.logger.info("Running bitbake -e to test the configuration is valid/parsable") - runCmd("bitbake -e") + self.tc.logger.info("Checking base configuration is valid/parsable") + + with bb.tinfoil.Tinfoil(tracking=True) as tinfoil: + tinfoil.prepare(quiet=2, config_only=True) + d = tinfoil.config_data + vars = {} + vars['SSTATE_DIR'] = str(d.getVar('SSTATE_DIR')) + vars['BBLAYERS'] = str(d.getVar('BBLAYERS')) + self.tc.set_variables(vars) def get_json_result_dir(self, args): json_result_dir = os.path.join(self.tc.td["LOG_DIR"], 'oeqa') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index c1f533802e2..575e3800175 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -285,8 +285,10 @@ def get_bb_vars(variables=None, target=None, postconfig=None): def get_bb_var(var, target=None, postconfig=None): return get_bb_vars([var], target, postconfig)[var] -def get_test_layer(): - layers = get_bb_var("BBLAYERS").split() +def get_test_layer(bblayers=None): + if bblayers is None: + bblayers = get_bb_var("BBLAYERS") + layers = bblayers.split() testlayer = None for l in layers: if '~' in l: From patchwork Thu Sep 21 22:37:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 30909 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 88A2AE7D0B6 for ; Thu, 21 Sep 2023 22:37:17 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.groups.io with SMTP id smtpd.web11.9342.1695335833232882533 for ; Thu, 21 Sep 2023 15:37:13 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=WM7UeYgY; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.47, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-401d6f6b2e0so18412895e9.1 for ; Thu, 21 Sep 2023 15:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1695335831; x=1695940631; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=dxzmjkC+mxFn1LXcYm749SuvK01tUewcTeYYjV1m6qo=; b=WM7UeYgYgWu4CXtKCpR9zyefS//84aCQZZ8zdSEkxuYINSj0hC/yz4tCLEX1DZ6lnq 6n8HLO0N/GuTr8u3TATwyc5TNVFCZ1T0Z92seAk71aA8A+jrgiMRiRUjXps/5eQ9UiIt gUJ2BSSVZZqO+EP39C8ptCULwiEnjtfqIZaW0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695335831; x=1695940631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dxzmjkC+mxFn1LXcYm749SuvK01tUewcTeYYjV1m6qo=; b=uvhJRurI73G0r+xYwOwCRbu/a0AVtwQD8OA1289E3UyLKHBp7el6aNBMa0aRiVvGYz 4hRWLKVFLrQlZPN/Mz0Gk+i7Mzcf+0whUx3qlnb3lMKpaMRt4oy5/sxoyBCbhRxXOmX3 ZAYVJircQoPtVB+qiZOcPUABxgkDCRl+5mSaQAKosw+Zz+knKoEIgxyXbkjtAqvZ4BS2 RiNZyLD0EQYClnqizp9aXffSQCcizErZg7wNYK0p/rAEu8tg+ZOKsJoNPX+3+4y8bSAD 6dWGfQobC7Tm5B7O+0XNMF0O2NU6DOhMNuAFJ/FFBOTbSc8nra8UxxG7AZn3OQcmgV9E fpDA== X-Gm-Message-State: AOJu0Yxz+l8dsgqnx7Gd/DDelvSMBxOqF5RqbROqsbJYPmOTOUHfVy7l Sqw3r4pEsesLommQk1Lxn7YaUirkJaNyWjtvN64= X-Google-Smtp-Source: AGHT+IFIsCOIVsQHKLcvj6URp3p+aBkPteIHbqK9qhOYmsrmzQO5AbbaWCq4BNBzRFmwmFE3xYp8qQ== X-Received: by 2002:a5d:60c8:0:b0:31f:ecb2:d774 with SMTP id x8-20020a5d60c8000000b0031fecb2d774mr488903wrt.19.1695335831365; Thu, 21 Sep 2023 15:37:11 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:f6e4:1bee:736d:f9fd]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c05cb00b003fc06169ab3sm947410wmd.20.2023.09.21.15.37.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:37:10 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 4/5] lib: Import packagedata oe module by default Date: Thu, 21 Sep 2023 23:37:07 +0100 Message-Id: <20230921223708.1333390-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> References: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 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 ; Thu, 21 Sep 2023 22:37:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188032 Variable dependencies for functions in the oe.packagedata module were missing as it was not present in BBIMPORTS. Add it as the fact it was missing is likely just historical oversight from base.bbclass history and the dependencies are useful. Signed-off-by: Richard Purdie --- meta/lib/oe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/lib/oe/__init__.py b/meta/lib/oe/__init__.py index 47be7b51d79..da7cbab3086 100644 --- a/meta/lib/oe/__init__.py +++ b/meta/lib/oe/__init__.py @@ -7,6 +7,6 @@ from pkgutil import extend_path __path__ = extend_path(__path__, __name__) -BBIMPORTS = ["data", "path", "utils", "types", "package", \ +BBIMPORTS = ["data", "path", "utils", "types", "package", "packagedata", \ "packagegroup", "sstatesig", "lsb", "cachedpath", "license", \ "qa", "reproducible", "rust", "buildcfg"] From patchwork Thu Sep 21 22:37:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 30911 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 93D5CE7D0B9 for ; Thu, 21 Sep 2023 22:37:17 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.web10.9203.1695335833719955423 for ; Thu, 21 Sep 2023 15:37:14 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=UNNSDxFn; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.46, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4053cb57f02so2639365e9.1 for ; Thu, 21 Sep 2023 15:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1695335832; x=1695940632; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=GTUtY8JqwQ5GVpjd2xBuGPAllu0C2it4V3IR55QIAhw=; b=UNNSDxFndBTcB0QzonTS0a0jZxegDMXuOHSuL1UDKbTaY1VRnPjrLOMBH86kNzSoXy MGr7/mXnN5EXIvXZT/qQPXS+W1bJq3pe4YKwnHFPtzCLBkFvvamyFn+vDzlBRws01Lgz ar8FOIYg4WTb/7XzLmkjf/wBV4QJ3cQD6jhGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695335832; x=1695940632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GTUtY8JqwQ5GVpjd2xBuGPAllu0C2it4V3IR55QIAhw=; b=L9AygD3bb1aesGbMM8GOEOMzYjguKuZS+q8anD+BqLBS1jYiq2JRf4nW1aIUeOsGax T5wTr1yyd8aod9KsNYPp3mtU5PpflyGrj8Kn5aemjD3afv+mgJAAY/piRzz+Lb5umJHa TQjsmvOHTVcuh1Q258YIb5xXPI5EE+4lfT6rwbOD8PzizQGiksnmoihqHdGqFX5p1tPU eDEKaWXTuaQkqRHIlZPayf+qimRHo+Csz0utd30Yo9QHL0p5jqzhK66Vz+dAGH7j5VVg IAMaWcqHiFAu/B1JvJtgATd+IP4Tzt8F9lCjfyDt8HaYaH1+CAKmcqn201DjLtgCXhwx PtCg== X-Gm-Message-State: AOJu0YxwThZmKlS6V65/H7Ydh+2KC46eMtzOKbbli+zLK3wPD7TAoJMo FiKBhKtUOXYCdgOIpJg2pOv/HICQTG5PhjcAwzs= X-Google-Smtp-Source: AGHT+IGszWi4BmEUvA1UdjZKQRRmBelIIrB3u7ioWKB3ThXuXwSGKfJVky7aHni6mMBNiqoSQh0R8A== X-Received: by 2002:a1c:6a12:0:b0:401:d1a3:d7f7 with SMTP id f18-20020a1c6a12000000b00401d1a3d7f7mr6209815wmc.30.1695335831932; Thu, 21 Sep 2023 15:37:11 -0700 (PDT) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:f6e4:1bee:736d:f9fd]) by smtp.gmail.com with ESMTPSA id p11-20020a05600c05cb00b003fc06169ab3sm947410wmd.20.2023.09.21.15.37.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 15:37:11 -0700 (PDT) From: Richard Purdie To: openembedded-core@lists.openembedded.org Subject: [PATCH 5/5] oeqa/selftest/oescripts: Avoid variable access at module load Date: Thu, 21 Sep 2023 23:37:08 +0100 Message-Id: <20230921223708.1333390-5-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> References: <20230921223708.1333390-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 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 ; Thu, 21 Sep 2023 22:37:17 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/188033 Using get_bb_var in the class setup leads to slow startup of oe-selftest. Move the calls into setupClass instead to remove the overhead at the expense of some code duplication. Signed-off-by: Richard Purdie --- meta/lib/oeqa/selftest/cases/oescripts.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/oescripts.py b/meta/lib/oeqa/selftest/cases/oescripts.py index 7d3a00e2ab9..f69efccfee6 100644 --- a/meta/lib/oeqa/selftest/cases/oescripts.py +++ b/meta/lib/oeqa/selftest/cases/oescripts.py @@ -36,18 +36,16 @@ class BuildhistoryDiffTests(BuildhistoryBase): if expected_endlines: self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) -class OEScriptTests(OESelftestTestCase): - scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') - @unittest.skipUnless(importlib.util.find_spec("cairo"), "Python cairo module is not present") -class OEPybootchartguyTests(OEScriptTests): +class OEPybootchartguyTests(OESelftestTestCase): @classmethod def setUpClass(cls): - super(OEScriptTests, cls).setUpClass() + super().setUpClass() bitbake("core-image-minimal -c rootfs -f") cls.tmpdir = get_bb_var('TMPDIR') cls.buildstats = cls.tmpdir + "/buildstats/" + sorted(os.listdir(cls.tmpdir + "/buildstats"))[-1] + cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') def test_pybootchartguy_help(self): runCmd('%s/pybootchartgui/pybootchartgui.py --help' % self.scripts_dir) @@ -65,7 +63,12 @@ class OEPybootchartguyTests(OEScriptTests): self.assertTrue(os.path.exists(self.tmpdir + "/charts.pdf")) -class OEGitproxyTests(OEScriptTests): +class OEGitproxyTests(OESelftestTestCase): + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') def test_oegitproxy_help(self): try: @@ -126,7 +129,13 @@ class OeRunNativeTest(OESelftestTestCase): result = runCmd("oe-run-native qemu-helper-native qemu-oe-bridge-helper --help") self.assertIn("Helper function to find and exec qemu-bridge-helper", result.output) -class OEListPackageconfigTests(OEScriptTests): +class OEListPackageconfigTests(OESelftestTestCase): + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.scripts_dir = os.path.join(get_bb_var('COREBASE'), 'scripts') + #oe-core.scripts.List_all_the_PACKAGECONFIG's_flags def check_endlines(self, results, expected_endlines): for line in results.output.splitlines():