ZTS: Fix problem with zdb_objset_id test

Use large numbers for datasets with numeric names to avoid name
and id collisions.  Sporadic test failures were observed when the
test would create $TESTPOOL/100 with an objset ID of 100.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Zuchowski <pzuchowski@datto.com>
Closes #13087
This commit is contained in:
Paul Zuchowski 2022-02-11 16:32:08 -05:00 committed by GitHub
parent 4ea4a46c27
commit fe804dc412
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 14 deletions

View File

@ -54,6 +54,8 @@ write_count=8
blksize=131072 blksize=131072
verify_runnable "global" verify_runnable "global"
verify_disk_count "$DISKS" 2 verify_disk_count "$DISKS" 2
hex_ds=$TESTPOOL/0x400000
num_ds=$TESTPOOL/100000
default_mirror_setup_noexit $DISKS default_mirror_setup_noexit $DISKS
file_write -o create -w -f $init_data -b $blksize -c $write_count file_write -o create -w -f $init_data -b $blksize -c $write_count
@ -111,23 +113,23 @@ if is_linux; then
"zdb -dddddd $TESTPOOL/$objset_hex failed $reason" "zdb -dddddd $TESTPOOL/$objset_hex failed $reason"
fi fi
log_must zfs create $TESTPOOL/0x400 log_must zfs create $hex_ds
log_must zfs create $TESTPOOL/100 log_must zfs create $num_ds
output=$(zdb -d $TESTPOOL/0x400) output=$(zdb -d $hex_ds)
reason="($TESTPOOL/0x400 not in zdb output)" reason="($TESTPOOL/0x400 not in zdb output)"
echo $output |grep "$TESTPOOL/0x400" > /dev/null echo $output |grep "$hex_ds" > /dev/null
(( $? != 0 )) && log_fail \ (( $? != 0 )) && log_fail \
"zdb -d $TESTPOOL/0x400 failed $reason" "zdb -d $hex_ds failed $reason"
output=$(zdb -d $TESTPOOL/100) output=$(zdb -d $num_ds)
reason="($TESTPOOL/100 not in zdb output)" reason="($num_ds not in zdb output)"
echo $output |grep "$TESTPOOL/100" > /dev/null echo $output |grep "$num_ds" > /dev/null
(( $? != 0 )) && log_fail \ (( $? != 0 )) && log_fail \
"zdb -d $TESTPOOL/100 failed $reason" "zdb -d $num_ds failed $reason"
# force numeric interpretation, should fail # force numeric interpretation, expect fail
log_mustnot zdb -N $TESTPOOL/0x400 log_mustnot zdb -N $hex_ds
log_mustnot zdb -N $TESTPOOL/100 log_mustnot zdb -N $num_ds
log_mustnot zdb -Nd $TESTPOOL/0x400 log_mustnot zdb -Nd $hex_ds
log_mustnot zdb -Nd $TESTPOOL/100 log_mustnot zdb -Nd $num_ds
log_pass "zdb -d <pool>/<objset ID> generates the correct names." log_pass "zdb -d <pool>/<objset ID> generates the correct names."