Skip to contentSkip to conversation

qemu/testimage: Ensure GNU tar is in test images

PATCH In review Richard Purdie 2 participants 3 messages Nov 20, 2024 – Nov 21, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
 meta/conf/distro/include/no-gplv3.inc            | 2 ++
 meta/conf/machine/include/qemu.inc               | 3 +++
 meta/lib/oeqa/selftest/cases/incompatible_lic.py | 1 +
 meta/lib/oeqa/utils/postactions.py               | 3 ++-
 4 files changed, 8 insertions(+), 1 deletion(-)
meta/conf/distro/include/no-gplv3.inc +2 -0
index b3eb936d94f..705e05319af 100644
@@ -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"
meta/conf/machine/include/qemu.inc +3 -0
index bb7aec76750..d7392d47623 100644
@@ -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"
meta/lib/oeqa/selftest/cases/incompatible_lic.py +1 -0
index be5484bca49..e6b871ebc82 100644
@@ -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):
meta/lib/oeqa/utils/postactions.py +2 -1
index 8f787838b9d..c69481db6cb 100644
@@ -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")
#1 lore raw
Quoted 34 lines · Richard Purdie via lists.openembedded.org

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.

---
 meta/conf/distro/include/no-gplv3.inc            | 2 ++
 meta/conf/machine/include/qemu.inc               | 3 +++
 meta/lib/oeqa/selftest/cases/incompatible_lic.py | 1 +
 meta/lib/oeqa/utils/postactions.py               | 3 ++-
 4 files changed, 8 insertions(+), 1 deletion(-)
meta/conf/distro/include/no-gplv3.inc +2 -0
index b3eb936d94f..705e05319af 100644
@@ -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"
meta/conf/machine/include/qemu.inc +0 -0
index bb7aec76750..d7392d47623 100644

meta/conf/machine/include/qemu.inc KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" · line 33

Quoted 6 lines
meta/conf/machine/include/qemu.inc +3 -0
@@ -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"

I would suggest adding it where it makes a difference intead of adding it to all qemu images.
many real world images may not want/have gtar in image and they do use qemu for testing images
doing this means they will be testing something else on qemu as compared to real target.

Quoted 35 lines
meta/lib/oeqa/selftest/cases/incompatible_lic.py +1 -0
index be5484bca49..e6b871ebc82 100644
@@ -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):
meta/lib/oeqa/utils/postactions.py +2 -2
index 8f787838b9d..c69481db6cb 100644
@@ -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")
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#207484): https://lists.openembedded.org/g/openembedded-core/message/207484
Mute This Topic: https://lists.openembedded.org/mt/109692964/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 39 lines · Khem Raj
Quoted 36 lines · Richard Purdie via lists.openembedded.org

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.

---
 meta/conf/distro/include/no-gplv3.inc            | 2 ++ meta/conf/machine/include/qemu.inc               | 3 +++ meta/lib/oeqa/selftest/cases/incompatible_lic.py | 1 + meta/lib/oeqa/utils/postactions.py               | 3 ++-

 4 files changed, 8 insertions(+), 1 deletion(-)
meta/conf/distro/include/no-gplv3.inc +0 -0
index b3eb936d94f..705e05319af 100644
@@ -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"

meta/conf/distro/include/no-gplv3.inc +2 -0
+
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS:remove = "tar"
meta/conf/machine/include/qemu.inc +0 -0
index bb7aec76750..d7392d47623 100644
@@ -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"

Quoted 7 lines

meta/conf/machine/include/qemu.inc KERNEL_FEATURES:append:pn-linux-yocto = " features/nfsd/nfsd-enable.scc" · line 33

Quoted 4 lines

 IMAGE_CLASSES += "qemuboot"

meta/conf/machine/include/qemu.inc +3 -0
+
+# Use gnu tar so we can handle sparse files in testimage debug archives
+MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "tar"

I would suggest adding it where it makes a difference intead of adding it to all qemu images.

Which images are going to have the testimage code run against them? It can be any of them.

I initially added this in the image class code but made it conditional upon qemu. Putting this into the qemu machine code itself seemed more appropriate after looking at it like that.

So I'm open to better ideas but I need a specific suggesting of where you think is better.

Quoted 2 lines

many real world images may not want/have gtar in image and they do use qemu for testing images

How many use the debug collection mechanism in oeqa though?

Quoted 2 lines

doing this means they will be testing something else on qemu as compared to real target.

This isn't doing it for anything other than qemu. Thankfully tar has minimal dependencies so whilst it does change the testing, the impact is relatively isolated and mainly means we don't expose busybox tar to as much automated testing.

As I said, I'm open to there specific proposals but this was the best I could come up with. We have a serious issue with the sparse files and doing nothing is not an option.

Cheers,

Richard