diff mbox series

tar: use diffutils for ptest instead of busybox

Message ID 20251022194628.2462629-1-skandigraun@gmail.com
State Accepted, archived
Commit 81f7b60fb1c5096bbc233f632040d1ea9ec5bb21
Headers show
Series tar: use diffutils for ptest instead of busybox | expand

Commit Message

Gyorgy Sarvari Oct. 22, 2025, 7:46 p.m. UTC
A testcase (sparse03) sometimes times out on the AB, in qemu (without kvm):
the test generates an 8GB sparse file, tars it, untars it, and then
it compares the two versions with cmp.

This process, going through 16GB of data (using one thread, with cmp) takes some
time anyway, but when there is extra load on the host machine, and qemu
can't use its core exclusively, then it can take more than 5 minutes easily
(which is the default ptest timeout).

However the full version of cmp from diffutils seems to be more efficient than
the busybox version:

When using busybox on my idle machine (w/ qemuriscv64) the test case execution
takes 150s, and it almost always times out when there is extra load.

Using diffutils, my idle machine executes the same testcase in 55s, and it
never times out even if there is high load on the host system (execution
always stayed under 3 minutes).

Due to this switch to diffutils when running ptest.

Fixes [YOCTO 15884]

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta/recipes-extended/tar/tar_1.35.bb | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ross Burton Oct. 27, 2025, 5:38 p.m. UTC | #1
On 22 Oct 2025, at 20:46, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote:
> +RDEPENDS:${PN}-ptest += “diffutils"

From the experience of looking at assignments like this in a few years time and trying to explain why they exist; can you add a one-line summary of your commit message as a comment here?

(also, curious how busybox fmt is so slow compared to diffutils, considering “read files until they differ” isn’t exactly rocket science…)

Thanks,
Ross
Gyorgy Sarvari Oct. 27, 2025, 7:32 p.m. UTC | #2
On 10/27/25 18:38, Ross Burton wrote:
> On 22 Oct 2025, at 20:46, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote:
>> +RDEPENDS:${PN}-ptest += “diffutils"
> From the experience of looking at assignments like this in a few years time and trying to explain why they exist; can you add a one-line summary of your commit message as a comment here?

Will do.

> (also, curious how busybox fmt is so slow compared to diffutils, considering “read files until they differ” isn’t exactly rocket science…)

Busybox[1] reads the files in sizeof(int) chunks, and compares them as ints.

diffutils[2] reads "bufsize" amount each time, and does memcmp on them.
Haven't looked into the exact size of bufsize, but at the first sight it
looks like it's the blocksize of the device being read, which is most
likely bigger than 4.

Haven't done a benchmark on these lines, but Busybox's version looks
more KISS-y rather than speedy.

[1]: https://elixir.bootlin.com/busybox/1.37.0/source/editors/cmp.c#L122
[2]:
https://cgit.git.savannah.gnu.org/cgit/diffutils.git/tree/src/cmp.c#n487


>
> Thanks,
> Ross
diff mbox series

Patch

diff --git a/meta/recipes-extended/tar/tar_1.35.bb b/meta/recipes-extended/tar/tar_1.35.bb
index ea0993a909..206e084557 100644
--- a/meta/recipes-extended/tar/tar_1.35.bb
+++ b/meta/recipes-extended/tar/tar_1.35.bb
@@ -94,3 +94,5 @@  BBCLASSEXTEND = "native nativesdk"
 # Avoid false positives from CVEs in node-tar package
 # For example CVE-2021-{32803,32804,37701,37712,37713}
 CVE_PRODUCT = "gnu:tar"
+
+RDEPENDS:${PN}-ptest += "diffutils"