btrfs-progs: tests: fix false alerts on github CI
cover btrfs-progs: tests: fix false alerts on github CI
After the CI workers updated to ubuntu 26.04, there are several new fail tests cases:
- convert/017
There is not enough metadata space to support a convert.
This test relies on both the mkfs.ext4 behavior and kernel ext4 write behavior. Change the test case to skip the run if there is not enough space left.
- mkfs/037
There is no '/usr/lib/lib*` files anymore there on ubuntu 26.04. Use generated data instead.
Qu Wenruo (2):
btrfs-progs: tests: fix false alerts on convert/017
btrfs-progs: tests: fix github CI failure on mkfs/037
tests/convert-tests/017-fs-near-full/test.sh | 12 +++++-- .../mkfs-tests/037-basic-compression/test.sh | 31 +++++++++---------- 2 files changed, 24 insertions(+), 19 deletions(-)
--
2.56.0
PATCH 1/2 btrfs-progs: tests: fix false alerts on convert/017
On github CI workers, the test convert/017 fails as the following:
ERROR: failed to reserve 33554432 bytes for metadata chunk, largest available: 33488896 bytes
ERROR: unable to create initial ctree: No space left on device
WARNING: error during conversion, the original filesystem is not modified
The test case is verifying the behavior of converting an almost full ext4, unfortunately the chunk layout is dependent on the ext4 fs, so we do not reliable have enough metadata space for such case.
Instead of using convert_test_do_convert() which expects the convert run to success, open-code the helper, and use "run_mayfail" instead, and only continue checking if the convert succeeded.
--- tests/convert-tests/017-fs-near-full/test.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
tests/convert-tests/017-fs-near-full/test.sh +9 -3
@@ -27,6 +27,12 @@ done run_check_umount_test_dev -# convert_test_do_convert() will call btrfs check, which should expose any -# invalid inline extent with too large size -convert_test_do_convert +export BTRFS_PROGS_DEBUG_STRICT_CHUNK_ALIGNMENT=y +# The e2mkfs may use extra space due to their default feature changes. +# So the convert itself may fail due to lack of space. +run_mayfail "$TOP/btrfs-convert" "$TEST_DEV" +if [ $? -ne 0 ]; then + _not_run "Not enough space left for btrfs-convert" +fi +run_check "$TOP/btrfs" check "$TEST_DEV" +run_check "$TOP/btrfs" inspect-internal dump-super -Ffa "$TEST_DEV"
Signature · 1 line
2.56.0
PATCH 2/2 btrfs-progs: tests: fix github CI failure on mkfs/037
In reply to Qu WenruoThe github CI fails with the mkfs/037 due to changed /usr/lib layout:
failed: cp -axf --update --no-preserve=ownership,context /usr/lib*/lib[abcdef]* /tmp/btrfs-progs-mkfs-rootdir.Ivn4QL
We should never rely on the host to populate the rootdir at all. So use generated data instead, which also improves the coverage, as now we have both compressible, incompressible and partial compressible files.
--- .../mkfs-tests/037-basic-compression/test.sh | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-)
tests/mkfs-tests/037-basic-compression/test.sh +15 -16
@@ -12,23 +12,22 @@ setup_root_helper prepare_test_dev tmp=$(_mktemp_dir mkfs-rootdir) -limit=$((128*1024*1024)) -# Create dataset of approximate size 256M so the repeated compression does not take that long -for file in /usr/bin/[gx]*; do - run_check cp -axf --update --no-preserve=ownership,context "$file" "$tmp" - size=$(du -sb "$tmp" | awk '{print $1}') - if [ "$size" -gt "$limit" ]; then - break - fi -done - -for file in /usr/lib*/lib[abcdef]*; do - run_check cp -axf --update --no-preserve=ownership,context "$file" "$tmp" - size=$(du -sb "$tmp" | awk '{print $1}') - if [ "$size" -gt "$limit" ]; then - break - fi +# Create dataset of approximate size 256M so the repeated compression does not +# take that long. +# Mix compressible, incompressible and partially compressible files. +for i in $(seq 1 25); do + # Compressible: zeros + run_check dd if=/dev/zero of="$tmp/zero_$i" bs=1M count=4 status=none + # Incompressible: random data + run_check dd if=/dev/urandom of="$tmp/random_$i" bs=1M count=4 status=none + # Partially compressible: 64K of random data alternating with 64K of + # zeros, so a compressed extent (max 128K) contains both + run_check dd if=/dev/zero of="$tmp/mixed_$i" bs=1M count=2 status=none + for j in $(seq 0 15); do + run_check dd if=/dev/urandom of="$tmp/mixed_$i" bs=64K count=1 \ + seek=$((j * 2)) conv=notrunc status=none + done done run_check du -sh "$tmp"
Signature · 1 line
2.56.0