From patchwork Thu Oct 26 10:33:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 32944 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 DE0CAC25B6F for ; Thu, 26 Oct 2023 10:33:35 +0000 (UTC) Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by mx.groups.io with SMTP id smtpd.web11.67476.1698316405680808900 for ; Thu, 26 Oct 2023 03:33:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=A3JDYqX1; spf=pass (domain: gmail.com, ip: 209.85.208.54, mailfrom: alex.kanavin@gmail.com) Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-53f9af41444so1189457a12.1 for ; Thu, 26 Oct 2023 03:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698316404; x=1698921204; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0AyEVz9JomAQTUJENVlgXBWVTR3qxEapwpIiPoNOCXA=; b=A3JDYqX1KzQ8Hn4y4lJfQXRx6c+WnlSdRcYuM+obsx6Rzlht6lr1YhXrxocTM46edB 6EaL6U2c6L0mIJiManuBj+MdgrHo75x/5IqvXuJQLS5HMi/GeJLrrS/akDDKm1dBKK2u MX4YM9N7vPB44+0BiaBsKbQtMCtiCE8kHnzF79OZGF2sFAotb/BN3E5Mso+EPtEwx959 OXjADipy/nqZkDIt+lx0OSqj32+YmPimBeULdiG6/jdbMKK4A2u6XkISt1vTi3LLdsYe /yHdF0PQJGBN0mbdC4Amiei2A7OhK9V2G/IoOe2hLbQB8t5WxJBRFmh38Wi/MiSUM+Z2 XAqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698316404; x=1698921204; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0AyEVz9JomAQTUJENVlgXBWVTR3qxEapwpIiPoNOCXA=; b=lo+L5tTW0tPe/5BNUBK6nPYEw4zwl4JeYeRCcm6ZJLbecLjQX5je8M3TqCNmj8vdHj j5f+WgRsnjJYNZgSNRCdOxdtGEkFrM7SVf68thFOcWtwiysjQ+Q1UHn3wqT4Y+8//ZkR P2BelE8jaJIHULGjJm9rF0eDl3OSQZ84O4ybv+P6BRRK55cGvDCX4yyxDmxjKEHITDs1 z5Ie9BsyHDw7NgeJbqFuQQ1LdFHElq0wk2BI8/sUkqv+PJslmSdL9+NTNz39Rogk7pdj K0F87BfB4OBPeJlzOzDHILAt06j62gOiFX581JKl8pJ7fEKOyRs+HCGDGM8szztWzjUD G0tw== X-Gm-Message-State: AOJu0YzTEZdSOO6O8deZ66HbMkGq+y26MlFBOZdiVnuxCyd90co4ekDu /sNVUssFLc7qVH031k+kB/v6aiuVUuI= X-Google-Smtp-Source: AGHT+IEi4k69Rq1mRTKU+iAvD4Ohxk7rdfMFJrO4VEj4Yyj9nM9z27y9SZFjXQZmEPYvBOYI3tIyDw== X-Received: by 2002:a17:907:7b99:b0:9c4:6893:ccc5 with SMTP id ne25-20020a1709077b9900b009c46893ccc5mr13893197ejc.57.1698316403701; Thu, 26 Oct 2023 03:33:23 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id u24-20020a170906409800b009bf94de8971sm11444747ejj.70.2023.10.26.03.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:33:23 -0700 (PDT) From: Alexander Kanavin X-Google-Original-From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 1/3] selftest/sstatetests: add tests for 'bitbake -S printdiff' Date: Thu, 26 Oct 2023 12:33:18 +0200 Message-Id: <20231026103320.2751277-1-alex@linutronix.de> 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, 26 Oct 2023 10:33:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189706 'bitbake -S printdiff' is a useful diagnostic facility for finding out why sstate is not being reused, but until now it had no tests that would ensure it works. This commit adds three basic scenarios: 1. make a change in a really basic, common recipe that is at the very root of dependency trees (quilt-native), and ensure that change is correctly discovered when building an image. 2. make a change in gcc-source recipe, which is somewhat special (operates in work-shared), and ensure that gcc-runtime builds track that down as well. 3. make a change in base_do_configure() definition from base.bbclass, which is not recipe-specific, but affects many basic recipes, and ensure that is correctly reported as well. The test itself actually runs twice: - first against a fully populated build directory, where the printdiff code is guaranteed to find the correct previous stamp that can be compared with in a predictable manner. - then in an empty build directory where the printdiff code goes to look in the sstate cache, and so the existence of the previous signature can be tested, but not the difference with it (what the exact difference would be is unpredictable as the sstate cache is indeed shared between many builds). Signed-off-by: Alexander Kanavin --- .../base-do-configure-modified.bbclass | 3 + .../gcc-source/gcc-source_%.bbappend | 2 + .../quilt-native/quilt-native_%.bbappend | 2 + meta/lib/oeqa/selftest/cases/sstatetests.py | 113 ++++++++++++++++++ 4 files changed, 120 insertions(+) create mode 100644 meta-selftest/classes/base-do-configure-modified.bbclass create mode 100644 meta-selftest/recipes-test/gcc-source/gcc-source_%.bbappend create mode 100644 meta-selftest/recipes-test/quilt-native/quilt-native_%.bbappend diff --git a/meta-selftest/classes/base-do-configure-modified.bbclass b/meta-selftest/classes/base-do-configure-modified.bbclass new file mode 100644 index 00000000000..3f96827a428 --- /dev/null +++ b/meta-selftest/classes/base-do-configure-modified.bbclass @@ -0,0 +1,3 @@ +base_do_configure:append () { + echo "this changes base_do_configure() definiton" +} diff --git a/meta-selftest/recipes-test/gcc-source/gcc-source_%.bbappend b/meta-selftest/recipes-test/gcc-source/gcc-source_%.bbappend new file mode 100644 index 00000000000..205720982cb --- /dev/null +++ b/meta-selftest/recipes-test/gcc-source/gcc-source_%.bbappend @@ -0,0 +1,2 @@ +# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests. +include test_recipe.inc diff --git a/meta-selftest/recipes-test/quilt-native/quilt-native_%.bbappend b/meta-selftest/recipes-test/quilt-native/quilt-native_%.bbappend new file mode 100644 index 00000000000..205720982cb --- /dev/null +++ b/meta-selftest/recipes-test/quilt-native/quilt-native_%.bbappend @@ -0,0 +1,2 @@ +# This bbappend is used to alter the recipe using the test_recipe.inc file created by tests. +include test_recipe.inc diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index bdad9088d37..b96eacc9ad8 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -773,3 +773,116 @@ addtask tmptask2 before do_tmptask1 latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-2:] bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-1], recursecb) self.assertEqual(recursecb_count,1) + +class SStatePrintdiff(SStateBase): + # FIXME: OEBasicHash setting is necessary for now as otherwise the following error can occur: + # ERROR: Can't find a task we're supposed to have written out? (hash: e79d70b9c2cc72030c1ce822525510699a1eeb1ddf5986271d3217422244366a)? + # The underlying issue should be investigated and addressed. + def run_test_printdiff_changerecipe(self, target, change_recipe, change_bbtask, change_content, expected_sametmp_output, expected_difftmp_output): + self.write_config(""" +TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" +BB_SIGNATURE_HANDLER = "OEBasicHash" +""") + self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") + bitbake(target) + bitbake("-S none {}".format(target)) + bitbake(change_bbtask) + self.write_recipeinc(change_recipe, change_content) + result_sametmp = bitbake("-S printdiff {}".format(target)) + + self.write_config(""" +TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" +BB_SIGNATURE_HANDLER = "OEBasicHash" +""") + self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff-2") + result_difftmp = bitbake("-S printdiff {}".format(target)) + + self.delete_recipeinc(change_recipe) + for item in expected_sametmp_output: + self.assertIn(item, result_sametmp.output) + for item in expected_difftmp_output: + self.assertIn(item, result_difftmp.output) + + def run_test_printdiff_changeconfig(self, target, change_content, expected_sametmp_output, expected_difftmp_output): + self.write_config(""" +TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" +BB_SIGNATURE_HANDLER = "OEBasicHash" +""") + self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") + bitbake(target) + bitbake("-S none {}".format(target)) + self.append_config(change_content) + result_sametmp = bitbake("-S printdiff {}".format(target)) + + self.write_config(""" +TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" +BB_SIGNATURE_HANDLER = "OEBasicHash" +""") + self.append_config(change_content) + self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff-2") + result_difftmp = bitbake("-S printdiff {}".format(target)) + + for item in expected_sametmp_output: + self.assertIn(item, result_sametmp.output) + for item in expected_difftmp_output: + self.assertIn(item, result_difftmp.output) + + + # Check if printdiff walks the full dependency chain from the image target to where the change is in a specific recipe + def test_image_minimal_vs_quilt(self): + expected_output = ("Task quilt-native:do_install couldn't be used from the cache because:", +"We need hash", +"most recent matching task was") + expected_sametmp_output = expected_output + ("Variable do_install value changed",'+ echo "this changes the task signature"') + expected_difftmp_output = expected_output + + self.run_test_printdiff_changerecipe("core-image-minimal", "quilt-native", "-c do_install quilt-native", +""" +do_install:append() { + echo "this changes the task signature" +} +""", +expected_sametmp_output, expected_difftmp_output) + + # Check if changes to gcc-source (which uses tmp/work-shared) are correctly discovered + def test_gcc_runtime_vs_gcc_source(self): + gcc_source_pn = 'gcc-source-%s' % get_bb_vars(['PV'], 'gcc')['PV'] + + expected_output = ("Task {}:do_preconfigure couldn't be used from the cache because:".format(gcc_source_pn), +"We need hash", +"most recent matching task was") + expected_sametmp_output = expected_output + ("Variable do_preconfigure value changed",'+ print("this changes the task signature")') + #FIXME: printdiff is supposed to find at least one preconfigure task signature in the sstate cache, but isn't able to + #expected_difftmp_output = expected_output + expected_difftmp_output = () + + self.run_test_printdiff_changerecipe("gcc-runtime", "gcc-source", "-c do_preconfigure {}".format(gcc_source_pn), +""" +python do_preconfigure:append() { + print("this changes the task signature") +} +""", +expected_sametmp_output, expected_difftmp_output) + + # Check if changing a really base task definiton is reported against multiple core recipes using it + def test_image_minimal_vs_base_do_configure(self): + expected_output = ("Task zstd-native:do_configure couldn't be used from the cache because:", +"Task texinfo-dummy-native:do_configure couldn't be used from the cache because:", +"Task ldconfig-native:do_configure couldn't be used from the cache because:", +"Task gettext-minimal-native:do_configure couldn't be used from the cache because:", +"Task tzcode-native:do_configure couldn't be used from the cache because:", +"Task makedevs-native:do_configure couldn't be used from the cache because:", +"Task pigz-native:do_configure couldn't be used from the cache because:", +"Task update-rc.d-native:do_configure couldn't be used from the cache because:", +"Task unzip-native:do_configure couldn't be used from the cache because:", +"Task gnu-config-native:do_configure couldn't be used from the cache because:", +"We need hash", +"most recent matching task was") + expected_sametmp_output = expected_output + ("Variable base_do_configure value changed",'+ echo "this changes base_do_configure() definiton"') + expected_difftmp_output = expected_output + + self.run_test_printdiff_changeconfig("core-image-minimal", +""" +INHERIT += "base-do-configure-modified" +""", +expected_sametmp_output, expected_difftmp_output) From patchwork Thu Oct 26 10:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 32942 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 DCC2BC25B6B for ; Thu, 26 Oct 2023 10:33:35 +0000 (UTC) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by mx.groups.io with SMTP id smtpd.web11.67477.1698316406059794294 for ; Thu, 26 Oct 2023 03:33:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HowRVFie; spf=pass (domain: gmail.com, ip: 209.85.218.52, mailfrom: alex.kanavin@gmail.com) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-9b1ebc80d0aso112284366b.0 for ; Thu, 26 Oct 2023 03:33:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698316404; x=1698921204; 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=JZKuCm5kWrWiInk4myyLcvqCZGzfwAFVfLBX1mV43cQ=; b=HowRVFiegMF8TmYyx4XHoqtkLL3Il9YGA1A6VAOFNuO1NtdYYjU807q/Il3lZsn9y1 uby3YaEX7+iAhkzrsz4xcH7cCJHgTwSMuiQ0y61VJaEOIs1j5JQa5kd382gtPtEdNuo0 lOWlA5cyhASYSZ2tbBMXLn5eseVO/IOzdbZsNSVwqqfkVGr3qN8b5KZ7OroutqpZpnFW BtoDfg85BFjhIRk7dAOaipxU3OwzxRrbiWVwkN+hHrbVUHpJzdTXebObChWMiECwBLkl F1aVR65balXymt/5hiJz00wersJSovWBFDh7YPygpBsALQguKoltlonPRqK4hd57LVil jkfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698316404; x=1698921204; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JZKuCm5kWrWiInk4myyLcvqCZGzfwAFVfLBX1mV43cQ=; b=VESa4Z0K4unGqZ/+owSyVrkZaHU+HB8gO4eQ2iEA1wCTNUv6mDy3vJb0HXN2ZkSreI V64Jvp1Bj7eSTUVyq8vLyeJuGoJswFwhcasUX3GFYErSfBb8tCixfwrmRB3HDN+PH395 E4KnYriX8dyfR5cVMEHan5pOAtt9jcEKa/vzvRlAcbxeZEqQCp/ZohxxZmLtlhZyD1Kr Ye6DUWXbeTLMV+UZzjXWWg48V96enT2ITAHybg00b//1aIdb04RxwPvosw1GRtEQQ1XO cNACLNnTfE7AamfIvaYS05QSvenO8T9V3H5VMH80ur/ZrhBm1o6SAaK03LFQPQYmEgCo SSng== X-Gm-Message-State: AOJu0YzZFl5sfYAaku7LhCXD1ifp6O8A+GwIZsgJsOp1v4vXtTka8wZx GAThrhp9ycbEGG30kB7KFm1TqZ+NwYk= X-Google-Smtp-Source: AGHT+IE+iTWsOemdKdqUNd+kSeWbd5yGqV3erx8NcMsRRBpB9ZSQuwQ0JN/wVkugRCgwhqr9BE7UTg== X-Received: by 2002:a17:907:2ce2:b0:9bd:d7bd:1a52 with SMTP id hz2-20020a1709072ce200b009bdd7bd1a52mr12996251ejc.20.1698316404231; Thu, 26 Oct 2023 03:33:24 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id u24-20020a170906409800b009bf94de8971sm11444747ejj.70.2023.10.26.03.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:33:24 -0700 (PDT) From: Alexander Kanavin X-Google-Original-From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 2/3] lib/oe/sstatesig.py: dump locked.sigs.inc only when explicitly asked via -S lockedsigs Date: Thu, 26 Oct 2023 12:33:19 +0200 Message-Id: <20231026103320.2751277-2-alex@linutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026103320.2751277-1-alex@linutronix.de> References: <20231026103320.2751277-1-alex@linutronix.de> 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, 26 Oct 2023 10:33:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189707 This was writing out locked-sigs.inc into cwd with every 'bitbake -S' invocation. When the intent is only to to get task stamps (-S none), or print the difference between them (-S printdiff), the file is unnecessary clutter. A couple of selftests/scripts were however relying on this, so they're adjusted to explicitly request the file. eSDK code calls dump_lockedsigs() separately via oe.copy_buildsystem.generate_locked_sigs() and so isn't affected. Signed-off-by: Alexander Kanavin --- meta/lib/oe/sstatesig.py | 7 ++++--- meta/lib/oeqa/selftest/cases/archiver.py | 2 +- meta/lib/oeqa/selftest/cases/signing.py | 2 +- scripts/lib/checklayer/__init__.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/meta/lib/oe/sstatesig.py b/meta/lib/oe/sstatesig.py index 42e13a8c800..e250f51c124 100644 --- a/meta/lib/oe/sstatesig.py +++ b/meta/lib/oe/sstatesig.py @@ -142,9 +142,10 @@ class SignatureGeneratorOEBasicHashMixIn(object): super().set_taskdata(data[3:]) def dump_sigs(self, dataCache, options): - sigfile = os.getcwd() + "/locked-sigs.inc" - bb.plain("Writing locked sigs to %s" % sigfile) - self.dump_lockedsigs(sigfile) + if 'lockedsigs' in options: + sigfile = os.getcwd() + "/locked-sigs.inc" + bb.plain("Writing locked sigs to %s" % sigfile) + self.dump_lockedsigs(sigfile) return super(bb.siggen.SignatureGeneratorBasicHash, self).dump_sigs(dataCache, options) diff --git a/meta/lib/oeqa/selftest/cases/archiver.py b/meta/lib/oeqa/selftest/cases/archiver.py index 3fa59fff510..3cb888c5067 100644 --- a/meta/lib/oeqa/selftest/cases/archiver.py +++ b/meta/lib/oeqa/selftest/cases/archiver.py @@ -141,7 +141,7 @@ class Archiver(OESelftestTestCase): pn = 'gcc-source-%s' % get_bb_vars(['PV'], 'gcc')['PV'] # Generate the tasks signatures - bitbake('mc:mc1:%s mc:mc2:%s -c %s -S none' % (pn, pn, task)) + bitbake('mc:mc1:%s mc:mc2:%s -c %s -S lockedsigs' % (pn, pn, task)) # Check the tasks signatures # To be machine agnostic the tasks needs to generate the same signature for each machine diff --git a/meta/lib/oeqa/selftest/cases/signing.py b/meta/lib/oeqa/selftest/cases/signing.py index 322e753ed3b..18cce0ba258 100644 --- a/meta/lib/oeqa/selftest/cases/signing.py +++ b/meta/lib/oeqa/selftest/cases/signing.py @@ -191,7 +191,7 @@ class LockedSignatures(OESelftestTestCase): bitbake(test_recipe) # Generate locked sigs include file - bitbake('-S none %s' % test_recipe) + bitbake('-S lockedsigs %s' % test_recipe) feature = 'require %s\n' % locked_sigs_file feature += 'SIGGEN_LOCKEDSIGS_TASKSIG_CHECK = "warn"\n' diff --git a/scripts/lib/checklayer/__init__.py b/scripts/lib/checklayer/__init__.py index 0a0db2f02ac..8271ed7fe3b 100644 --- a/scripts/lib/checklayer/__init__.py +++ b/scripts/lib/checklayer/__init__.py @@ -307,7 +307,7 @@ def get_signatures(builddir, failsafe=False, machine=None, extravars=None): cmd += 'bitbake ' if failsafe: cmd += '-k ' - cmd += '-S none world' + cmd += '-S lockedsigs world' sigs_file = os.path.join(builddir, 'locked-sigs.inc') if os.path.exists(sigs_file): os.unlink(sigs_file) From patchwork Thu Oct 26 10:33:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Kanavin X-Patchwork-Id: 32943 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 E4F86C25B48 for ; Thu, 26 Oct 2023 10:33:35 +0000 (UTC) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) by mx.groups.io with SMTP id smtpd.web11.67479.1698316406649157677 for ; Thu, 26 Oct 2023 03:33:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=LjggDOuh; spf=pass (domain: gmail.com, ip: 209.85.208.44, mailfrom: alex.kanavin@gmail.com) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-53e2308198eso1098821a12.1 for ; Thu, 26 Oct 2023 03:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698316405; x=1698921205; 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=ADrpjGm2PfCHfjPGr4YSnjKQLIDeeqbMxYGLeZHf5BQ=; b=LjggDOuhHkociQed2m0/4y3vekGmnazOhCu2Nm8fTSPDx1Ghb3VCjNmTX02OyHAEvy nG4pvrT7qQVRUNS70LBtBd2usIDsfWq+86b0PF3/IDywwjoq+0G7qsew0BP3vygZS/fs iAQo0j33z8c6osVR7rGTxihjeQXBbfYtrxGv1BPyQ2Gk4bhAS+79ZHQDARZC/raqT/tQ JTXRV2etKOe2GHwQV0/xEWYmhzvOlVYvX1Ym3i7hEGSJmjfGUPt48WvkhD3xsxJcVY1W 2DNVI37QLoj6fEYATRFVR2gzjHmYRxuGboo76W7vFFDjapmOW/9BWTOFvmGPFzV4POYt 94UA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698316405; x=1698921205; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ADrpjGm2PfCHfjPGr4YSnjKQLIDeeqbMxYGLeZHf5BQ=; b=uEpAhTR4zY1fK13TREMMY7G8rxBqyQo28/tgDcLDyR7kCK6jXb7Xo/DpI0JFGqpGzy YXxVfzKWNxk2R9E1ai23VKaV7BDZjsxtvoJmPFMaYLVJSO+jIOlWGQp5ZFqyT3g5Ot8I 8SEOoRNs111KEuBuSO40TYPt/BmVEzaFsxRUGrgYl3WupXVJ3APcISqs6I+jDfj3f92U 3ANrp3gZvunV1KoRfr4PGMe2PXD2qfPd7ntpxN5U/iuZh4Rad0KdhnfhHhEpAOv/5tOR gqdhjjwziUYBvJio8y9BjwgRX8biHW4mYKtGHUv/NBNUrJXGMUD/AVHTY3OqISBD10dp LOeg== X-Gm-Message-State: AOJu0YwKan1ueTLbxyjE8Tw0ihsgnfplDsqYbJhR0MsnNbZURLbo/FSI 3tiui0qJtNZULuM/QkqeLlqrrSUyPzo= X-Google-Smtp-Source: AGHT+IHohqwh8D9+AsQOZvv7y1GqamsBUQ3vI6miB9t4H29VQQyRCdJvcwrlPiuExUo0mQaargT2nA== X-Received: by 2002:a17:906:fe46:b0:9b2:b7f2:bc7b with SMTP id wz6-20020a170906fe4600b009b2b7f2bc7bmr13234655ejb.37.1698316404847; Thu, 26 Oct 2023 03:33:24 -0700 (PDT) Received: from Zen2.lab.linutronix.de. (drugstore.linutronix.de. [80.153.143.164]) by smtp.gmail.com with ESMTPSA id u24-20020a170906409800b009bf94de8971sm11444747ejj.70.2023.10.26.03.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 03:33:24 -0700 (PDT) From: Alexander Kanavin X-Google-Original-From: Alexander Kanavin To: openembedded-core@lists.openembedded.org Cc: Alexander Kanavin Subject: [PATCH 3/3] selftest/sstatetests: add a test for CDN sstate cache Date: Thu, 26 Oct 2023 12:33:20 +0200 Message-Id: <20231026103320.2751277-3-alex@linutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231026103320.2751277-1-alex@linutronix.de> References: <20231026103320.2751277-1-alex@linutronix.de> 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, 26 Oct 2023 10:33:35 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/189708 Specifically, the test checks that everything needed for building standard oe-core images for x86_64 and arm64 is available from the cache (with minor exceptions). Going forward, a complete world check could be enabled and additional configurations, but that requires improvements to performance of hash equivalence server in particular. Signed-off-by: Alexander Kanavin --- meta/lib/oeqa/selftest/cases/sstatetests.py | 46 +++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/sstatetests.py b/meta/lib/oeqa/selftest/cases/sstatetests.py index b96eacc9ad8..6a0531ae4c8 100644 --- a/meta/lib/oeqa/selftest/cases/sstatetests.py +++ b/meta/lib/oeqa/selftest/cases/sstatetests.py @@ -14,6 +14,7 @@ import re from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer, get_bb_vars from oeqa.selftest.case import OESelftestTestCase +from oeqa.core.decorator import OETestTag import oe import bb.siggen @@ -886,3 +887,48 @@ expected_sametmp_output, expected_difftmp_output) INHERIT += "base-do-configure-modified" """, expected_sametmp_output, expected_difftmp_output) + +@OETestTag("yocto-mirrors") +class SStateMirrors(SStateBase): + def check_bb_output(self, output, exceptions): + in_tasks = False + missing_objects = [] + for l in output.splitlines(): + if "The differences between the current build and any cached tasks start at the following tasks" in l: + in_tasks = True + continue + if "Writing task signature files" in l: + in_tasks = False + continue + if in_tasks: + recipe_task = l.split("/")[-1] + recipe, task = recipe_task.split(":") + for e in exceptions: + if e[0] in recipe and task == e[1]: + break + else: + missing_objects.append(recipe_task) + self.assertTrue(len(missing_objects) == 0, "Missing objects in the cache:\n{}".format("\n".join(missing_objects))) + + + def run_test_cdn_mirror(self, machine, targets, exceptions): + exceptions = exceptions + [[t, "do_deploy_source_date_epoch"] for t in targets.split()] + exceptions = exceptions + [[t, "do_image_qa"] for t in targets.split()] + self.config_sstate(True) + self.append_config(""" +MACHINE = "{}" +BB_HASHSERVE_UPSTREAM = "hashserv.yocto.io:8687" +SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH" +""".format(machine)) + result = bitbake("-S printdiff {}".format(targets)) + self.check_bb_output(result.output, exceptions) + + def test_cdn_mirror_qemux86_64(self): + # Example: + # exceptions = [ ["packagegroup-core-sdk","do_package"] ] + exceptions = [] + self.run_test_cdn_mirror("qemux86-64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions) + + def test_cdn_mirror_qemuarm64(self): + exceptions = [] + self.run_test_cdn_mirror("qemuarm64", "core-image-minimal core-image-full-cmdline core-image-sato-sdk", exceptions)