selftest/sstatetest: print output from bitbake with actual newlines, not \n
PATCH 1/6 selftest/sstatetest: print output from bitbake with actual newlines, not \n
Assert*() functions from python unittest would join the multiline output with \n, making it almost unreadable.
--- meta/lib/oeqa/selftest/cases/sstatetests.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
meta/lib/oeqa/selftest/cases/sstatetests.py +4 -4
@@ -798,9 +798,9 @@ TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" self.delete_recipeinc(change_recipe) for item in expected_sametmp_output: - self.assertIn(item, result_sametmp.output) + self.assertIn(item, result_sametmp.output, msg = "Item {} not found in output:\n{}".format(item, result_sametmp.output)) for item in expected_difftmp_output: - self.assertIn(item, result_difftmp.output) + self.assertIn(item, result_difftmp.output, msg = "Item {} not found in output:\n{}".format(item, result_difftmp.output)) def run_test_printdiff_changeconfig(self, target, change_content, expected_sametmp_output, expected_difftmp_output): self.write_config("""
@@ -820,9 +820,9 @@ TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" result_difftmp = bitbake("-S printdiff {}".format(target)) for item in expected_sametmp_output: - self.assertIn(item, result_sametmp.output) + self.assertIn(item, result_sametmp.output, msg = "Item {} not found in output:\n{}".format(item, result_sametmp.output)) for item in expected_difftmp_output: - self.assertIn(item, result_difftmp.output) + self.assertIn(item, result_difftmp.output, msg = "Item {} not found in output:\n{}".format(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
Signature · 1 line
2.39.2
PATCH 2/6 selftest/sstatetests: do not delete custom $TMPDIRs under build-st when testing printdiff
If the tests fail, these contain useful artefacts, and so should be kept. If the test succeeds the whole build-st/ is deleted.
Also, give them unique names, as otherwise the tests would step on each other.
--- meta/lib/oeqa/selftest/cases/sstatetests.py | 22 ++++++++++----------- 1 file changed, 10 insertions(+), 12 deletions(-)
meta/lib/oeqa/selftest/cases/sstatetests.py +10 -12
@@ -777,10 +777,10 @@ addtask tmptask2 before do_tmptask1 class SStatePrintdiff(SStateBase): def run_test_printdiff_changerecipe(self, target, change_recipe, change_bbtask, change_content, expected_sametmp_output, expected_difftmp_output): + import time self.write_config(""" -TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" -""") - self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") +TMPDIR = "${{TOPDIR}}/tmp-sstateprintdiff-sametmp-{}" +""".format(time.time())) # Use runall do_build to ensure any indirect sstate is created, e.g. tzcode-native on both x86 and # aarch64 hosts since only allarch target recipes depend upon it and it may not be built otherwise. # A bitbake -c cleansstate tzcode-native would cause some of these tests to error for example.
@@ -791,9 +791,8 @@ TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" result_sametmp = bitbake("-S printdiff {}".format(target)) self.write_config(""" -TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" -""") - self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff-2") +TMPDIR = "${{TOPDIR}}/tmp-sstateprintdiff-difftmp-{}" +""".format(time.time())) result_difftmp = bitbake("-S printdiff {}".format(target)) self.delete_recipeinc(change_recipe)
@@ -803,20 +802,19 @@ TMPDIR = "${TOPDIR}/tmp-sstateprintdiff-2" self.assertIn(item, result_difftmp.output, msg = "Item {} not found in output:\n{}".format(item, result_difftmp.output)) def run_test_printdiff_changeconfig(self, target, change_content, expected_sametmp_output, expected_difftmp_output): + import time self.write_config(""" -TMPDIR = "${TOPDIR}/tmp-sstateprintdiff" -""") - self.track_for_cleanup(self.topdir + "/tmp-sstateprintdiff") +TMPDIR = "${{TOPDIR}}/tmp-sstateprintdiff-sametmp-{}" +""".format(time.time())) bitbake("--runall build --runall deploy_source_date_epoch {}".format(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" -""") +TMPDIR = "${{TOPDIR}}/tmp-sstateprintdiff-difftmp-{}" +""".format(time.time())) 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:
Signature · 1 line
2.39.2
PATCH 3/6 sstatesig/find_siginfo: special-case gcc-source when looking in sstate caches
In reply to Alexander KanavinThis is already done for local stamps just above, and will allow enabling the full selftest that compares gcc-source signatures via printdiff (that is, both local stamp and sstate variants).
--- meta/lib/oe/sstatesig.py | 3 +++ 1 file changed, 3 insertions(+)
meta/lib/oe/sstatesig.py +3 -0
@@ -398,6 +398,9 @@ def find_siginfo(pn, taskname, taskhashlist, d): localdata.setVar('TARGET_VENDOR', '*') localdata.setVar('TARGET_OS', '*') localdata.setVar('PN', pn) + # gcc-source is a special case, same as with local stamps above + if pn.startswith("gcc-source"): + localdata.setVar('PN', "gcc") localdata.setVar('PV', '*') localdata.setVar('PR', '*') localdata.setVar('BB_TASKHASH', hashval)
Signature · 1 line
2.39.2
PATCH 4/6 gnu-config: add a do_compile task
In reply to Alexander Kanavinnoexec flag has an unfortunate side effect of not writing out the .siginfo file into sstate (because that is done in sstate bbclass
from a task-completed event handler).
In the absence of the siginfo file, diffsigs code is unable to trace back the change in task signatures if the change is really basic and affects tasks coming ahead of gnu-config-native:do_compile.
--- meta/recipes-devtools/gnu-config/gnu-config_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
meta/recipes-devtools/gnu-config/gnu-config_git.bb +2 -1
@@ -19,7 +19,8 @@ UPSTREAM_CHECK_COMMITS = "1" CLEANBROKEN = "1" -do_compile[noexec] = "1" +do_compile () { +} do_install () { install -d ${D}${datadir}/gnu-config \
Signature · 1 line
2.39.2
Re: [OE-core] [PATCH 4/6] gnu-config: add a do_compile task
Quoted 19 lines · Alexander Kanavin
noexec flag has an unfortunate side effect of not writing out the .siginfo file into sstate (because that is done in sstate bbclass
from a task-completed event handler).In the absence of the siginfo file, diffsigs code is unable to trace back the change in task signatures if the change is really basic and affects tasks coming ahead of gnu-config-native:do_compile.
Signed-off-by Alexander Kanavin <[email protected]>--- meta/recipes-devtools/gnu-config/gnu-config_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)meta/recipes-devtools/gnu-config/gnu-config_git.bb +0
-0
meta/recipes-devtools/gnu-config/gnu-config_git.bb UPSTREAM_CHECK_COMMITS = "1" · line 26
Quoted 9 lines
meta/recipes-devtools/gnu-config/gnu-config_git.bb +2
-1@@ -19,7 +19,8 @@ UPSTREAM_CHECK_COMMITS = "1" CLEANBROKEN = "1" -do_compile[noexec] = "1" +do_compile () { +} do_install () { install -d ${D}${datadir}/gnu-config \
You have a good point here but by this logic, we need to remove *all* noexec tasks. We don't really want to do that and I'm not sure we want to set this precedent.
I wonder if we could just remove the compile task entirely and what that would break...
Cheers,
Richard
RE: [OE-core] [PATCH 4/6] gnu-config: add a do_compile task
Quoted 41 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Richard Purdie
Sent: den 8 december 2023 12:35
To: Alexander Kanavin <[email protected]>; [email protected]
Cc: Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH 4/6] gnu-config: add ado_compiletaskQuoted 19 lines · Alexander Kanavin
noexec flag has an unfortunate side effect of not writing out the .siginfo file into sstate (because that is done in sstate bbclass
from a task-completed event handler).In the absence of the siginfo file, diffsigs code is unable to trace back the change in task signatures if the change is really basic and affects tasks coming ahead of gnu-config-native:do_compile.
Signed-off-by Alexander Kanavin <[email protected]>--- meta/recipes-devtools/gnu-config/gnu-config_git.bb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)meta/recipes-devtools/gnu-config/gnu-config_git.bb +0
-0meta/recipes-devtools/gnu-config/gnu-config_git.bb UPSTREAM_CHECK_COMMITS = "1" · line 26
Quoted 9 lines
meta/recipes-devtools/gnu-config/gnu-config_git.bb +2
-1@@ -19,7 +19,8 @@ UPSTREAM_CHECK_COMMITS = "1" CLEANBROKEN = "1" -do_compile[noexec] = "1" +do_compile () { +} do_install () { install -d ${D}${datadir}/gnu-config \You have a good point here but by this logic, we need to remove *all* noexec tasks. We don't really want to do that and I'm not sure we want to set this precedent.
Quoted 6 lines
I wonder if we could just remove the compile task entirely and what that would break...
Cheers,
Richard
Would it be possible to change the code so that the .siginfo files are still produced for noexec tasks? Otherwise it seems using noexec tasks is a real blocker for being able to trace the signatures for any subsequent task.
//Peter
Re: [OE-core] [PATCH 4/6] gnu-config: add a do_compile task
Quoted 55 lines · Peter Kjellerstedt
Quoted 55 lines
-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Richard Purdie
Sent: den 8 december 2023 12:35
To: Alexander Kanavin <[email protected]>; [email protected]
Cc: Alexander Kanavin <[email protected]>
Subject: Re: [OE-core] [PATCH 4/6] gnu-config: add ado_compiletaskQuoted 28 lines · Alexander Kanavin
noexec flag has an unfortunate side effect of not writing out the .siginfo
file into sstate (because that is done in sstate bbclass from a task-completed event handler).In the absence of the siginfo file, diffsigs code is unable to trace back
the change in task signatures if the change is really basic and affects tasks coming ahead of gnu-config-native:do_compile.Signed-off-by Alexander Kanavin <[email protected]>---
meta/recipes-devtools/gnu-config/gnu-config_git.bb | 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)meta/recipes-devtools/gnu-config/gnu-config_git.bb +0
-0@@ -19,7 +19,8 @@ UPSTREAM_CHECK_COMMITS = "1"CLEANBROKEN = "1"
meta/recipes-devtools/gnu-config/gnu-config_git.bb +2
-1-do_compile[noexec] = "1" +do_compile () { +}Quoted 3 lines
do_install () {
install -d ${D}${datadir}/gnu-config \You have a good point here but by this logic, we need to remove *all*
noexec tasks. We don't really want to do that and I'm not sure we want
to set this precedent.I wonder if we could just remove the compile task entirely and what that would break...
Cheers,
Quoted 8 lines
Quoted 1 line
Richard
Would it be possible to change the code so that the .siginfo files are
still produced for noexec tasks? Otherwise it seems using noexec tasks
is a real blocker for being able to trace the signatures for any subsequent task.
Producing the siginfo files requires a full data store and bitbake doesn't retain that information for every recipe, just a summary of the data it needs. It is therefore currently produced in the task execution context currently. With a noexec task, the win is that we never need that context.
So this does need some thought.
Cheers,
Richard
PATCH 5/6 runqueue: rework 'bitbake -S printdiff' logic
In reply to Alexander KanavinPreviously printdiff code would iterate over tasks that were reported as invalid or absent, trying to follow dependency chains that would reach the most basic invalid items in the tree.
While this works in tightly controlled local builds, it can lead to bizarre reports against industrial-sized sstate caches, as the code would not consider whether the overall target can be fulfilled from valid sstate objects, and instead report missing sstate signature files that perhaps were never even created due to hash equivalency providing shortcuts in builds.
This commit reworks the logic in two ways:
- start the iteration over final targets rather than missing objects and stop at the first invalid object
- if a given object can be fulfilled from sstate, do not recurse into its dependencies; bitbake wouldn't care if they're absent, and neither should printdiff
This changes the console output significantly: where previously printdiff would report the most basic invalid tasks it could find, with this change the most top-level tasks are reported instead. This is not a problem as diffsigs has its own task recursion facility, and will track down the actual change anyway. This is reflected in fixing up the selftests.
[YOCTO #15289]
---
bitbake/lib/bb/runqueue.py | 27 +++++-----
.../perlcross_%.bbappend} | 0
meta/lib/oeqa/selftest/cases/sstatetests.py | 51 +++++++++++--------
3 files changed, 43 insertions(+), 35 deletions(-)
rename meta-selftest/recipes-test/{quilt-native/quilt-native_%.bbappend => perlcross/perlcross_%.bbappend} (100%)bitbake/lib/bb/runqueue.py +12 -15
@@ -1717,35 +1717,32 @@ class RunQueue: valid_new.add(dep) invalidtasks = set() - for tid in self.rqdata.runtaskentries: - if tid not in valid_new and tid not in noexec: - invalidtasks.add(tid) - found = set() - processed = set() - for tid in invalidtasks: + toptasks = set(["{}:{}".format(t[3], t[2]) for t in self.rqdata.targets]) + for tid in toptasks: toprocess = set([tid]) while toprocess: next = set() for t in toprocess: + if t not in valid_new and t not in noexec: + invalidtasks.add(t) + continue + if t in self.rqdata.runq_setscene_tids: + continue + for dep in self.rqdata.runtaskentries[t].depends: - if dep in invalidtasks: - found.add(tid) - if dep not in processed: - processed.add(dep) - next.add(dep) + next.add(dep) + toprocess = next - if tid in found: - toprocess = set() tasklist = [] - for tid in invalidtasks.difference(found): + for tid in invalidtasks: tasklist.append(tid) if tasklist: bb.plain("The differences between the current build and any cached tasks start at the following tasks:\n" + "\n".join(tasklist)) - return invalidtasks.difference(found) + return invalidtasks def write_diffscenetasks(self, invalidtasks):
meta-selftest/recipes-test/perlcross/perlcross_%.bbappend renamed from meta-selftest/recipes-test/quilt-native/quilt-native_%.bbappend +0 -0
meta/lib/oeqa/selftest/cases/sstatetests.py +31 -20
77 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [OE-core] [PATCH 5/6] runqueue: rework 'bitbake -S printdiff' logic
Quoted 9 lines · Alexander Kanavin
Previously printdiff code would iterate over tasks that were reported as invalid or absent, trying to follow dependency chains that would reach the most basic invalid items in the tree.
While this works in tightly controlled local builds, it can lead to bizarre reports against industrial-sized sstate caches, as the code would not consider whether the overall target can be fulfilled from valid sstate objects, and instead report missing sstate signature files that perhaps were never even created due to hash equivalency providing shortcuts in builds.
Quoted 8 lines
This commit reworks the logic in two ways:
- start the iteration over final targets rather than missing objects and stop at the first invalid object
- if a given object can be fulfilled from sstate, do not recurse into its dependencies; bitbake wouldn't care if they're absent, and neither should printdiff
Unfortunately this isn't actually true, the real answer is "it depends".
For many things that is the case, however for example an XXX- native:do_populate_sysroot, we would need the dependencies in case they contain shared libraries, unless it is listed as one of the special cases in SSTATE_EXCLUDEDEPS_SYSROOT.
Bitbake works this out using setscene_depvalid() in sstate.bbclass via BB_SETSCENE_DEPVALID.
I suspect this is the right direction but it may need the logic tweaking slightly.
Cheers,
Richard
PATCH 6/6 oeqa/selftest/sstatetests: re-disable CDN tests
In reply to Alexander KanavinWith the rework of printdiff, it is not longer useful for checking absence of sstate objects in a remote http cache, as it would only report the top level missing signatures, and leave the recursive investigation to diffsigs (which relies on ability to list cache files - not available over http).
The CDN check will be performed via a separate 'printmissing' function, which would be written specifically for the purpose, and so until then disable the test as it would only persistently fail.
--- meta/lib/oeqa/selftest/cases/sstatetests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/lib/oeqa/selftest/cases/sstatetests.py +2 -2
@@ -930,12 +930,12 @@ SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downl result = bitbake("-D -S printdiff {}".format(targets)) self.check_bb_output(result.output, exceptions) - def test_cdn_mirror_qemux86_64(self): + 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): + 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)
Signature · 1 line
2.39.2
Re: [OE-core] [PATCH 6/6] oeqa/selftest/sstatetests: re-disable CDN tests
Quoted 24 lines · Alexander Kanavin
With the rework of printdiff, it is not longer useful for checking absence of sstate objects in a remote http cache, as it would only report the top level missing signatures, and leave the recursive investigation to diffsigs (which relies on ability to list cache files - not available over http).
The CDN check will be performed via a separate 'printmissing' function, which would be written specifically for the purpose, and so until then disable the test as it would only persistently fail.
Signed-off-by Alexander Kanavin <[email protected]>--- meta/lib/oeqa/selftest/cases/sstatetests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)meta/lib/oeqa/selftest/cases/sstatetests.py +0
-1@@ -930,12 +930,12 @@ SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downl result = bitbake("-D -S printdiff {}".format(targets)) self.check_bb_output(result.output, exceptions) - def test_cdn_mirror_qemux86_64(self):
meta/lib/oeqa/selftest/cases/sstatetests.py SSTATE_MIRRORS ?= "file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downl · line 941
Quoted 10 lines
meta/lib/oeqa/selftest/cases/sstatetests.py +2
-1+ 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): + 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)
Crazy question - for the CDN tests, why don't we try just setting a dummy SSTATE_DIR, then "bitbake <images> -n" and check the "State Summary:" line in the output?
Cheers,
Richard
Re: [OE-core] [PATCH 6/6] oeqa/selftest/sstatetests: re-disable CDN tests
Quoted 3 lines · Richard Purdie
Crazy question - for the CDN tests, why don't we try just setting a dummy
SSTATE_DIR, then "bitbake <images> -n" and check the "State Summary:" line in the output?
It would be good to know what is missing though, not just how many?
Alex
Re: [OE-core] [PATCH 6/6] oeqa/selftest/sstatetests: re-disable CDN tests
Quoted 8 lines · Alexander Kanavin
Quoted 3 lines · Richard Purdie
Crazy question - for the CDN tests, why don't we try just setting a dummy
SSTATE_DIR, then "bitbake <images> -n" and check the "State Summary:" line in the output?It would be good to know what is missing though, not just how many?
Ideally, yes.
You could do that with a -DD option added and filter the output for the misses?
Cheers,
Richard