mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-30 10:44:09 +03:00
ZTS: Provide an alternative to shuf for FreeBSD
There was a shuf package but the upstream for the port has recently disappeared, so it is no longer available. Create a function to hide the usage of shuf. Implement using seq|random on FreeBSD. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ryan Moeller <ryan@ixsystems.com> Closes #9824
This commit is contained in:
committed by
Brian Behlendorf
parent
4abd7d80b2
commit
90ae48733c
@@ -11,7 +11,7 @@ DIR="${TESTDIR}/RANDOM_SMALL"
|
||||
log_must mkdir "${DIR}"
|
||||
|
||||
count=0
|
||||
for i in $(shuf -i 1-"${RC_PASS1}") ; do
|
||||
for i in $(range_shuffle 1 "${RC_PASS1}") ; do
|
||||
if ! touch "${DIR}/${i}" ; then
|
||||
log_fail "error creating ${i} after ${count} files"
|
||||
fi
|
||||
|
||||
@@ -63,9 +63,9 @@ typeset -i pageblocks volblocks max_swaplow
|
||||
((max_swaplow = (volblocks - (pageblocks * 2))))
|
||||
|
||||
for i in {0..10}; do
|
||||
swaplow=$(shuf -n 1 -i ${pageblocks}-${max_swaplow})
|
||||
swaplow=$(range_shuffle ${pageblocks} ${max_swaplow} | head -n 1)
|
||||
((maxlen = max_swaplow - swaplow))
|
||||
swaplen=$(shuf -n 1 -i ${pageblocks}-${maxlen})
|
||||
swaplen=$(range_shuffle ${pageblocks} ${maxlen} | head -n 1)
|
||||
log_must swap -a $swapname $swaplow $swaplen
|
||||
log_must swap -d $swapname $swaplow
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user