aboutsummaryrefslogtreecommitdiffstats
path: root/tests/zfs-tests/include
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <[email protected]>2023-12-26 12:01:53 -0800
committerGitHub <[email protected]>2023-12-26 12:01:53 -0800
commit4cf4bc7334acf145daf6f7f894fbb333710c1cc9 (patch)
treed6f0cf6f1971b4aecfafc79196f0611a28fb2f1f /tests/zfs-tests/include
parent233d34e47ef88ee9e9a1e1ad02384f2063cd039b (diff)
Block cloning tests.
The test mostly focus on testing various corner cases. The tests take a long time to run, so for the common.run runfile we randomly select a hundred tests. To run all the bclone tests, bclone.run runfile should be used. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Pawel Jakub Dawidek <[email protected]> Closes #15631
Diffstat (limited to 'tests/zfs-tests/include')
-rw-r--r--tests/zfs-tests/include/commands.cfg3
-rw-r--r--tests/zfs-tests/include/math.shlib13
2 files changed, 14 insertions, 2 deletions
diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg
index 648f2203d..c6f74cd81 100644
--- a/tests/zfs-tests/include/commands.cfg
+++ b/tests/zfs-tests/include/commands.cfg
@@ -98,7 +98,8 @@ export SYSTEM_FILES_COMMON='awk
uname
uniq
vmstat
- wc'
+ wc
+ xargs'
export SYSTEM_FILES_FREEBSD='chflags
compress
diff --git a/tests/zfs-tests/include/math.shlib b/tests/zfs-tests/include/math.shlib
index da1e77e5f..2b5e60180 100644
--- a/tests/zfs-tests/include/math.shlib
+++ b/tests/zfs-tests/include/math.shlib
@@ -123,10 +123,21 @@ function verify_ne # <a> <b> <type>
#
# $1 lower bound
# $2 upper bound
+# [$3 how many]
function random_int_between
{
typeset -i min=$1
typeset -i max=$2
+ typeset -i count
+ typeset -i i
- echo $(( (RANDOM % (max - min + 1)) + min ))
+ if [[ -z "$3" ]]; then
+ count=1
+ else
+ count=$3
+ fi
+
+ for (( i = 0; i < $count; i++ )); do
+ echo $(( (RANDOM % (max - min + 1)) + min ))
+ done
}