xfstests.zsh: Make -g GROUP an option to the script

So we can add tab completion and set a default group when one isn't
passed in.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2022-05-25 15:07:04 -04:00
parent 4025aaa0bd
commit 87d2a308c3
2 changed files with 18 additions and 1 deletions

View File

@ -5,6 +5,7 @@ function _xfstests.zsh() {
{-c,--client}'[the client to test]: : _alternative
"hosts\:hosts\: _ssh_hosts"
"domains\:domains\:($(virsh list --all --name))"' \
{-g,--group}'[the xfstests group to run]: :($(_list_xfstests_groups))' \
{-k,--scratch}'[the exported scratch directory on the server]: : _files -/' \
{-p,--mountpoint}'[the directory to mount the server]: : _files -/' \
--nconnect'[number of connections]: :($(seq 1 32))' \
@ -17,3 +18,16 @@ function _xfstests.zsh() {
\*{-v,--version}+'[the nfs version to test (default=all)]: :(3 4 4.0 4.1 4.2)' \
{-x,--export}'[the exported directory on the server]: : _files -/'
}
function _list_xfstests_groups() {
if [ ! -f /tmp/xfstests.groups.completion ]; then
find $HOME/Programs/xfstests-dev -name group.list \
-exec grep -P '^\d+' '{}' \; | \
awk '{$1=""; print $0}' | \
awk -F\# '{print $1}' | \
grep -o -E '\w+' | \
sort | uniq > /tmp/xfstests.groups.completion
fi
cat /tmp/xfstests.groups.completion
}

View File

@ -2,9 +2,11 @@
source common.zsh
VERSION=(3 4.0 4.1 4.2)
PROTO=(tcp)
GROUP=(-g quick)
zparseopts -D -K \
c:=CLIENT -client:=CLIENT \
g:=GROUP -group:=GROUP \
k:=SCRATCH -scratch:=SCRATCH \
-nconnect:=NCONNECT \
p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \
@ -49,6 +51,7 @@ fi
testargs=()
for arg in $*; do
testargs+=($(printf '%q' "$arg"))
GROUP=()
done
run_xfs_tests() {
@ -60,7 +63,7 @@ run_xfs_tests() {
--proto $1 \
--version $2 \
--opts $OPTIONS \
--user $USER $testargs | python $COLOR $1 $2
--user $USER $GROUP $testargs | python $COLOR $1 $2
scp -q ${CLIENT[-1]}:$REMOTE_RESULTS/$1/$2/result.xml $TMP_RESULTS/$1-$2.xml
}