From 87d2a308c338f4db6c4d17fcedd73e6306cd3e58 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Wed, 25 May 2022 15:07:04 -0400 Subject: [PATCH] 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 --- completions/_xfstests.zsh | 14 ++++++++++++++ xfstests.zsh | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/completions/_xfstests.zsh b/completions/_xfstests.zsh index 014e0d5..ef27992 100644 --- a/completions/_xfstests.zsh +++ b/completions/_xfstests.zsh @@ -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 +} diff --git a/xfstests.zsh b/xfstests.zsh index 2dd0153..7c147d7 100755 --- a/xfstests.zsh +++ b/xfstests.zsh @@ -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 }