qemu/testimage: Ensure GNU tar is in test images

We've seen cases where a ptest (strace) has a 43GB sparse file in the test
directory. busybox tar doesn't work well with this. The resulting 1.4GB archive
takes hours to extract too.

Ensure tar is added to our full images and use the sparse option to collect
files for debugging. This stops crazy build hangs.

Since tar is GPLv3, we have to exclude it from that test code. We don't boot
any of those images so the debug collection code is safe there, at least for now.

(From OE-Core rev: fefeb919696b6ac76f0997acfb0f612203ef7f1b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2024-11-20 17:59:43 +00:00
parent 403c16c89d
commit 0b674b09c1
4 changed files with 10 additions and 1 deletions

View File

@ -28,3 +28,5 @@ CORE_IMAGE_BASE_INSTALL:remove:pn-core-image-weston = "matchbox-terminal"
# Some python-tests use bash outside of ptest
RDEPENDS:${PN}-tests:remove:class-target:pn-python3 = "${MLPREFIX}bash"
INSANE_SKIP:${PN}-tests:pn-python3 = "file-rdeps"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove = "tar"

View File

@ -28,3 +28,6 @@ KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc"
KERNEL_FEATURES:append:pn-linux-yocto-rt = " features/nfsd/nfsd-enable.scc"
IMAGE_CLASSES += "qemuboot"
# Use gnu tar so we can handle sparse files in testimage debug archives
MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "tar"

View File

@ -102,6 +102,7 @@ class IncompatibleLicensePerImageTests(OESelftestTestCase):
return """
IMAGE_INSTALL:append = " bash"
INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*"
MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove = "tar"
"""
def test_bash_default(self):
@ -136,6 +137,8 @@ class NoGPL3InImagesTests(OESelftestTestCase):
def test_core_image_minimal(self):
self.write_config("""
INCOMPATIBLE_LICENSE:pn-core-image-minimal = "GPL-3.0* LGPL-3.0*"
require conf/distro/include/no-gplv3.inc
""")
bitbake('core-image-minimal')

View File

@ -64,7 +64,8 @@ def list_and_fetch_failed_tests_artifacts(d, tc, artifacts_list, outputdir):
bb.warn("Could not load artifacts list, skip artifacts retrieval")
return
try:
cmd = "tar zcf - " + " ".join(artifacts_list)
# We need gnu tar for sparse files, not busybox
cmd = "tar --sparse -zcf - " + " ".join(artifacts_list)
(status, output) = tc.target.run(cmd, raw = True)
if status != 0 or not output:
raise Exception("Error while fetching compressed artifacts")