From f757dec0ab00dcb4528695bfe9c5817822312dc3 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Fri, 22 Apr 2022 14:55:26 -0400 Subject: [PATCH] common.zsh: Pull out common test config into a shared file Signed-off-by: Anna Schumaker --- common.zsh | 30 ++++++++++++++++++++++++++++++ cthon.zsh | 7 +------ nfstest_rplus.zsh | 27 ++++++++++++++++++++------- read_plus.zsh | 7 +------ xfstests.zsh | 11 ++--------- 5 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 common.zsh diff --git a/common.zsh b/common.zsh new file mode 100644 index 0000000..85d2cac --- /dev/null +++ b/common.zsh @@ -0,0 +1,30 @@ +#!/bin/zsh +############################## +# # +# NFS client configuration # +# # +############################## +CLIENT=(client) +MOUNTPOINT=(/mnt/test) +SCRATCHMNT=(/mnt/scratch) + + +############################## +# # +# NFS server configuration # +# # +############################## +SERVER=(server) +EXPORT=(/srv/xfs/test) +SCRATCH=(/srv/xfs/scratch) + + +########################### +# # +# General configuration # +# # +########################### +BIN=$HOME/bin +USER=$(whoami) +VERSION=(3 4.0 4.1 4.2) +PROTO=(tcp) diff --git a/cthon.zsh b/cthon.zsh index 789e1f5..fbb5bc4 100755 --- a/cthon.zsh +++ b/cthon.zsh @@ -1,8 +1,5 @@ #!/bin/zsh -e -CLIENT=(client) -SERVER=(server) -EXPORT=(/srv/test) -MOUNTPOINT=(/mnt/test) +source common.zsh zparseopts -F -K \ c:=CLIENT -client:=CLIENT \ @@ -14,10 +11,8 @@ zparseopts -F -K \ s:=SERVER -server:=SERVER \ x:=EXPORT -export:=EXPORT -BIN=$HOME/bin COLOR=$BIN/colors/cthon.py RUN_CTHON="cd cthon04 && sudo ./runcthon" -USER=$(whoami) # # Prepare to test diff --git a/nfstest_rplus.zsh b/nfstest_rplus.zsh index 22d3ce1..1dd797b 100755 --- a/nfstest_rplus.zsh +++ b/nfstest_rplus.zsh @@ -1,19 +1,22 @@ #!/bin/zsh -e -CLIENT=(client) -SERVER=(server) -EXPORT=(/srv/test) -MOUNTPOINT=(/mnt/test/) +source common.zsh zparseopts -F -K \ c:=CLIENT -client:=CLIENT \ + -dmesg=DMESG -srvdmesg=SRVDMESG \ p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \ s:=SERVER -server:=SERVER \ x:=EXPORT -export:=EXPORT -BIN=$HOME/bin -USER=$(whoami) RUN_NFSTEST="run-nfstest-rplus.zsh" +if [ ${#DMESG} -gt 0 ]; then + ssh ${CLIENT[-1]} "sudo dmesg --clear" +fi +if [ ${#SRVDMESG} -gt 0 ]; then + ssh ${SERVER[-1]} "sudo dmesg --clear" +fi + # # Prepare to test # @@ -26,8 +29,18 @@ echo # # Run tests # -# +set +e ssh -t ${CLIENT[-1]} "$RUN_NFSTEST --server ${SERVER[-1]} \ --export ${EXPORT[-1]} \ --mountpoint ${MOUNTPOINT[-1]} \ --user $USER" +ret=$? + +if [ ${#DMESG} -gt 0 ]; then + ssh ${CLIENT[-1]} "sudo dmesg --color=always" +fi +if [ ${#SRVDMESG} -gt 0 ]; then + ssh ${SERVER[-1]} "sudo dmesg --color=always" +fi + +exit $ret diff --git a/read_plus.zsh b/read_plus.zsh index 38ea01f..4ffd7aa 100755 --- a/read_plus.zsh +++ b/read_plus.zsh @@ -1,8 +1,5 @@ #!/bin/zsh -e -CLIENT=(client) -SERVER=(server) -EXPORT=(/srv/test) -MOUNTPOINT=(/mnt/test) +source common.zsh SIZE=(2048) ITERATIONS=(1) @@ -16,11 +13,9 @@ zparseopts -F -K \ x:=EXPORT -export:=EXPORT \ z:=SIZE -size:=SIZE -BIN=$HOME/bin COLOR="python -u $BIN/colors/read_plus.py ${SIZE[-1]} ${FILE[-1]}" IFLAG= RUN_READ_PLUS="sudo run-read_plus.zsh" -USER=$(whoami) SRV_DIR=${EXPORT[-1]}/$USER/read_plus TEST_DIR=${MOUNTPOINT[-1]}/read_plus TEST_DEV=${SERVER[-1]}:$SRV_DIR diff --git a/xfstests.zsh b/xfstests.zsh index cdd02f0..93067f0 100755 --- a/xfstests.zsh +++ b/xfstests.zsh @@ -1,10 +1,5 @@ #!/bin/zsh -e -CLIENT=(client) -SERVER=(server) -EXPORT=(/srv/test) -SCRATCH=(/srv/scratch) -MOUNTPOINT=(/mnt/test) -SCRATCHMNT=(/mnt/scratch) +source common.zsh VERSION=(3 4.0 4.1 4.2) PROTO=(tcp) @@ -19,11 +14,9 @@ zparseopts -D -K \ x:=EXPORT -export:=EXPORT \ v+:=VERSION -version+:=VERSION -BIN=$HOME/bin COLOR=$BIN/colors/xfstests.py RUN_XFSTESTS="sudo run-xfstests.zsh" OPTIONS="sec=sys" -USER=$(whoami) RESULT_BASE=$HOME/.local/share/xfstests/ DATE=$(date +%Y-%m-%d-%H:%M:%S%z) TODAY=$(date +%Y/%m/%d) @@ -93,4 +86,4 @@ if [ ! -z "$TAG" ]; then mkdir -p $TAGRES ln $RESULTS/$NOW.tar.xz $TAGRES/$DATE.tar.xz fi -optirun report-xfstests.py $RESULTS/$NOW.tar.xz & disown +report-xfstests.py $RESULTS/$NOW.tar.xz & disown