From 87024b642e589e9ee0ec4ef7a3b7cb2e271a6fb2 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 20 Dec 2024 10:54:35 -0500 Subject: [PATCH 1/3] ZTS: Remove non-standard awk hex numbers usage FreeBSD recently removed non-standard hex numbers support from awk. Neither it supports -n argument, enabling it in gawk. Instead of depending on those rewrite list_file_blocks() fuction to handle the hex math in shell instead of awk. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- tests/zfs-tests/include/blkdev.shlib | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tests/zfs-tests/include/blkdev.shlib b/tests/zfs-tests/include/blkdev.shlib index 51eff3023e73..5b505f925286 100644 --- a/tests/zfs-tests/include/blkdev.shlib +++ b/tests/zfs-tests/include/blkdev.shlib @@ -556,27 +556,15 @@ function list_file_blocks # input_file # 512B blocks for ease of use with dd. # typeset level vdev path offset length - if awk -n '' 2>/dev/null; then - # gawk needs -n to decode hex - AWK='awk -n' - else - AWK='awk' - fi sync_all_pools true - zdb -dddddd $ds $objnum | $AWK -v pad=$((4<<20)) -v bs=512 ' + zdb -dddddd $ds $objnum | awk ' /^$/ { looking = 0 } looking { level = $2 field = 3 while (split($field, dva, ":") == 3) { - # top level vdev id - vdev = int(dva[1]) - # offset + 4M label/boot pad in 512B blocks - offset = (int("0x"dva[2]) + pad) / bs - # length in 512B blocks - len = int("0x"dva[3]) / bs - print level, vdev, offset, len + print level, int(dva[1]), "0x"dva[2], "0x"dva[3] ++field } @@ -585,7 +573,8 @@ function list_file_blocks # input_file ' | \ while read level vdev offset length; do for path in ${VDEV_MAP[$vdev][@]}; do - echo "$level $path $offset $length" + echo "$level $path $(( ($offset + (4<<20)) / 512 ))" \ + "$(( $length / 512 ))" done done 2>/dev/null } From 4f02ad6ad6fe7c0c42f43b6ffc56bccaedcc8071 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 25 Dec 2024 14:00:38 -0500 Subject: [PATCH 2/3] ZTS: Remove procfs use from zpool_import_status procfs might be not mounted on FreeBSD. Plus checking for specific PID might be not exactly reliable. Check for empty list of jobs instead. Premature loop exit can result in failed test and failed cleanup, failing also some following tests. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- .../cli_root/zpool_import/zpool_import_status.ksh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_status.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_status.ksh index c96961bf6419..679362bbef50 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_status.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_status.ksh @@ -103,21 +103,16 @@ log_must zpool export $TESTPOOL1 log_must set_tunable64 METASLAB_DEBUG_LOAD 1 log_note "Starting zpool import in background at" $(date +'%H:%M:%S') zpool import -d $DEVICE_DIR -f $guid & -pid=$! # # capture progress until import is finished # -log_note waiting for pid $pid to exit kstat import_progress -while [[ -d /proc/"$pid" ]]; do +while [[ -n $(jobs) ]]; do line=$(kstat import_progress | grep -v pool_guid) if [[ -n $line ]]; then echo $line fi - if [[ -f /$TESTPOOL1/fs/00 ]]; then - break; - fi sleep 0.0001 done log_note "zpool import completed at" $(date +'%H:%M:%S') From c30c0568880fe4656db21be7f8935023e469ab6d Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 25 Dec 2024 19:42:44 -0500 Subject: [PATCH 3/3] ZTS: Reduce file size in redacted_panic to 1GB This test takes 3 minutes on RELEASE FreeBSD bots, but on CURRENT, probably due to debugging it has in kernel, it does not complete within 10 minutes, ending up killed. As I see all the redacting here happens within the first ~128MB of the file, so I hope it won't not matter if there 1GB of data instead of 2GB. Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. --- .../zfs-tests/tests/functional/redacted_send/redacted_panic.ksh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh b/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh index 032d1fb91a2e..a2438c2cd731 100755 --- a/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh +++ b/tests/zfs-tests/tests/functional/redacted_send/redacted_panic.ksh @@ -39,7 +39,7 @@ function cleanup log_onexit cleanup log_must zfs create -o recsize=8k $sendfs -log_must dd if=/dev/urandom of=/$sendfs/file bs=1024k count=2048 +log_must dd if=/dev/urandom of=/$sendfs/file bs=1024k count=1024 log_must zfs snapshot $sendfs@init log_must zfs clone $sendfs@init $clone log_must stride_dd -i /dev/urandom -o /$clone/file -b 8192 -s 2 -c 7226