Skip to content

Commit

Permalink
Patch to avoid test case failures with tunable
Browse files Browse the repository at this point in the history
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
  • Loading branch information
rincebrain committed Nov 16, 2023
1 parent 8291382 commit ea8ff7b
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/zfs-tests/include/libtest.shlib
Original file line number Diff line number Diff line change
Expand Up @@ -3334,6 +3334,21 @@ function set_tunable_impl
esac
}

function save_tunable
{
[[ ! -d $TEST_BASE_DIR ]] && return 1
[[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
}

function restore_tunable
{
[[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
set_tunable64 "$1" "$val"
rm $TEST_BASE_DIR/tunable-$1
}

#
# Get a global system tunable
#
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/include/tunables.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
VOL_MODE vol.mode zvol_volmode
VOL_RECURSIVE vol.recursive UNSUPPORTED
VOL_USE_BLK_MQ UNSUPPORTED zvol_use_blk_mq
BCLONE_ENABLED zfs_bclone_enabled zfs_bclone_enabled
XATTR_COMPAT xattr_compat zfs_xattr_compat
ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
ZEVENT_RETAIN_MAX zevent.retain_max zfs_zevent_retain_max
Expand Down
4 changes: 4 additions & 0 deletions tests/zfs-tests/tests/functional/block_cloning/cleanup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ verify_runnable "global"

default_cleanup_noexit

if tunable_exists BCLONE_ENABLED ; then
log_must restore_tunable BCLONE_ENABLED
fi

log_pass
5 changes: 5 additions & 0 deletions tests/zfs-tests/tests/functional/block_cloning/setup.ksh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ fi

verify_runnable "global"

if tunable_exists BCLONE_ENABLED ; then
log_must save_tunable BCLONE_ENABLED
log_must set_tunable32 BCLONE_ENABLED 1
fi

log_pass

0 comments on commit ea8ff7b

Please sign in to comment.