From 2373f06ea79f63ee9fffef0c3d68c217e3cdb486 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Tue, 18 Jul 2023 15:56:05 -0400 Subject: [PATCH] cthon.zsh: Various Updates * Point $BIN to $HOME/.local/bin * Create $COLORS pointing to $BIN/colors * Use the zsh built-in _libvirt function for completion * Add a --no-server-access option for testing against somebody else's server * Add a generic --options option, replacing --nconnect and --rwsize but allowing for any NFS mount option to be passed instead * Run RDMA tests after TCP instead of in parallel Signed-off-by: Anna Schumaker --- common.zsh | 10 ++++++++-- completions/_cthon.zsh | 8 ++++---- cthon.zsh | 41 +++++++++++++++++++---------------------- run/cthon.zsh | 31 ++++++++++++------------------- 4 files changed, 43 insertions(+), 47 deletions(-) diff --git a/common.zsh b/common.zsh index e855f2e..9e7839c 100644 --- a/common.zsh +++ b/common.zsh @@ -17,6 +17,7 @@ SCRATCHMNT=(/mnt/scratch) SERVER=(server) EXPORT=(/srv/xfs/test) SCRATCH=(/srv/xfs/scratch) +NO_SERVER_ACCESS=() ########################### @@ -24,7 +25,8 @@ SCRATCH=(/srv/xfs/scratch) # General configuration # # # ########################### -BIN=$HOME/bin +BIN=$HOME/.local/bin +COLORS=$BIN/colors DMESG=() PROTO=(tcp) SRVDMESG=() @@ -67,7 +69,11 @@ function prepare_to_test() fi if [ ${#RDMA} -gt 0 ]; then PROTO+=(rdma) - $BIN/rping.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]} + if [ ${#NO_SERVER_ACCESS} -gt 0 ]; then + $BIN/rdma.zsh ${RDMA[-1]} ${CLIENT[-1]} + else + $BIN/rping.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]} + fi fi setup_client_func check_versions diff --git a/completions/_cthon.zsh b/completions/_cthon.zsh index 359560d..97bd9b3 100644 --- a/completions/_cthon.zsh +++ b/completions/_cthon.zsh @@ -6,19 +6,19 @@ function _cthon.zsh() { {-b,--basic}'[run basic tests]' \ {-c,--client}'[the client to test]: : _alternative "hosts\:hosts\: _ssh_hosts" - "domains\:domains\:($(virsh list --all --name))"' \ + "domains\:domains\: _libvirt"' \ --dmesg'[print client dmesg log after running tests]' \ {-g,--general}'[run general tests]' \ {-l,--locking}'[run locking tests]' \ - --nconnect'[number of connections]: :($(seq 1 32))' \ + --no-server-access'[do not attempt to ssh into the server]' \ + \*{-o,--options}'[mount options for all mounts]: :' \ --krb5'[run tests with sec=krb5]' \ --srvdmesg'[print server dmesg log after running tests]' \ {-p,--mountpoint}'[the directory to mount the server]: : _files -/' \ {-r,--rdma}'[test using rdma]: :(rxe siw)' \ - --rwsize'[test with a specific rsize & wsize]: :($(seq 4096 4096 1048576))' \ {-s,--server}'[the server to test against]: : _alternative "hosts\:hosts\: _ssh_hosts" - "domains\:domains\:($(virsh list --all --name))"' \ + "domains\:domains\: _libvirt"' \ {-S,--special}'[run special tests]' \ \*{-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 -/' diff --git a/cthon.zsh b/cthon.zsh index 3cfcb33..c7c146a 100755 --- a/cthon.zsh +++ b/cthon.zsh @@ -9,35 +9,24 @@ zparseopts -F -K \ -dmesg=DMESG -srvdmesg=SRVDMESG \ g+=TESTS -general+=TESTS \ l+=TESTS -locking+=TESTS \ + o+:=MNTOPTS -options+:=MNTOPTS \ p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \ - -nconnect:=NCONNECT \ + -no-server-access=NO_SERVER_ACCESS \ -krb5=KRB5 \ r:=RDMA -rdma:=RDMA \ - -rwsize:=RWSIZE \ S+=TESTS -special+=TESTS \ s:=SERVER -server:=SERVER \ x:=EXPORT -export:=EXPORT \ v+:=VERSION -version+:=VERSION -COLOR=$BIN/colors/cthon.py SEC=(sys) -ARGS=() +ARGS=($(echo $MNTOPTS | sed 's/-o /--mntopt /g')) prepare_to_test if [[ ${TESTS[(ie)-a]} -le ${#TESTS} ]]; then TESTS=(-b -g -s -l) fi -if [ ${#RDMA} -gt 0 ]; then - ARGS+=("--rdma") -fi -if [ ${#NCONNECT} -gt 0 ]; then - ARGS+=("--mntopt nconnect=${NCONNECT[-1]}") -fi -if [ ${#RWSIZE} -gt 0 ]; then - ARGS+=("--mntopt rsize=${RWSIZE[-1]}") - ARGS+=("--mntopt wsize=${RWSIZE[-1]}") -fi if [ ${#KRB5} -gt 0 ]; then SEC+=(krb5 krb5i krb5p) fi @@ -46,17 +35,25 @@ for vers in $VERSION; do ARGS+=("--version $vers") done + +function run_cthon_zsh() +{ + client_run cthon.zsh --server ${SERVER[-1]} --export ${EXPORT[-1]} \ + --mountpoint ${MOUNTPOINT[-1]} --user $USER \ + --proto $2 --mntopt sec=$3 $1 $ARGS \ + | python -u $COLORS/cthon.py +} + + ret=0 set +e -date | python -u $COLOR +date | python -u $COLORS/cthon.py for test in $TESTS; do - for sec in $SEC; do - client_run cthon.zsh --server ${SERVER[-1]} \ - --export ${EXPORT[-1]} \ - --mountpoint ${MOUNTPOINT[-1]} \ - --user $USER --mntopt sec=$sec \ - $test $ARGS | python -u $COLOR - ret=$((ret+$?)) + for proto in $PROTO; do + for sec in $SEC; do + run_cthon_zsh $test $proto $sec + ret=$((ret+$?)) + done done done diff --git a/run/cthon.zsh b/run/cthon.zsh index a4cd963..a75162e 100755 --- a/run/cthon.zsh +++ b/run/cthon.zsh @@ -1,14 +1,9 @@ #!/bin/zsh -PROTO=(tcp) zparseopts -D -K -server:=SERVER -export:=EXPORT -mountpoint:=MOUNTPOINT \ - -user:=USER -rdma=RDMA -version+:=VERSION -mntopt+:=MOUNTOPTS \ + -user:=USER -proto:=PROTO -version+:=VERSION -mntopt+:=MOUNTOPTS \ b=TEST g=TEST s=TEST l=TEST -if [ ${#RDMA} -gt 0 ]; then - PROTO+=(rdma) -fi - exclude=(--mntopt) MOUNTOPTS=(${(ou)MOUNTOPTS:|exclude}) @@ -26,22 +21,20 @@ function runtest } cd cthon04 -for proto in $PROTO; do - for vers in $VERSION; do - [[ "$vers" == "--version" ]] && continue +for vers in $VERSION; do + [[ "$vers" == "--version" ]] && continue - dir=$(echo "nfsv${vers}${proto}" | sed 's/\.//' | sed 's/v40/v4/') - mnt=${MOUNTPOINT[-1]}/$dir - xprt=${EXPORT[-1]}/${USER[-1]}/$dir + dir=$(echo "nfsv${vers}${PROTO[-1]}" | sed 's/\.//' | sed 's/v40/v4/') + mnt=${MOUNTPOINT[-1]}/$dir + xprt=${EXPORT[-1]}/${USER[-1]}/$dir - opts="v$vers,proto=$proto" - for o in $MOUNTOPTS; do - opts="$opts,$o" - done - - echo "./server ${TEST[-1]} -o $opts -m $mnt -p $xprt ${SERVER[-1]}" - runtest $opts $mnt $xprt /tmp/nfsv${vers}${proto} & + opts="v$vers,proto=${PROTO[-1]}" + for o in $MOUNTOPTS; do + opts="$opts,$o" done + + echo "./server ${TEST[-1]} -o $opts -m $mnt -p $xprt ${SERVER[-1]}" + runtest $opts $mnt $xprt /tmp/nfsv${vers}${PROTO[-1]} & done echo -n "Waiting for '${TEST[-1]}' to finish ... "