Create a cthon.zsh script
And a script to color the output. Additionally, I add a patch that goes on top of the cthon04 git tree so we can test with nconnect Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
6cc073bd87
commit
2adddd9e9c
|
@ -0,0 +1,35 @@
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
import termcolor
|
||||||
|
|
||||||
|
colors = { "b" : "blue", "g" : "green", "s" : "cyan", "l" : "yellow" }
|
||||||
|
last = "white"
|
||||||
|
newline = False
|
||||||
|
|
||||||
|
text = ""
|
||||||
|
def print_text(color, attr=None):
|
||||||
|
global text
|
||||||
|
termcolor.cprint(text, color=color, attrs=[attr] if attr else None, end="")
|
||||||
|
text = ""
|
||||||
|
|
||||||
|
while c := sys.stdin.read(1):
|
||||||
|
text += c
|
||||||
|
if re.match("^mkdir: .* File exists\n$", text):
|
||||||
|
print_text("white", "dark")
|
||||||
|
elif re.match("^The .*? Failed!!\n$", text):
|
||||||
|
text = "\n" + text if newline else text
|
||||||
|
newline = False
|
||||||
|
print_text("red", "bold")
|
||||||
|
elif match := re.match("^./server -([bgsl]) .*?\n$", text):
|
||||||
|
print_text(colors[match.group(1)], None)
|
||||||
|
elif match := re.match("^Waiting for '([bgsl])' to finish...", text):
|
||||||
|
last = colors[match.group(1)]
|
||||||
|
newline = True
|
||||||
|
print_text(last, "bold")
|
||||||
|
elif match := re.match("^ Done: .*?\n$", text):
|
||||||
|
print_text(last, "bold")
|
||||||
|
newline = False
|
||||||
|
elif c == "\n":
|
||||||
|
if len(text) > 1:
|
||||||
|
print_text("white", "bold")
|
||||||
|
text = ""
|
|
@ -0,0 +1,16 @@
|
||||||
|
#compdef cthon.zsh
|
||||||
|
|
||||||
|
function _cthon.zsh() {
|
||||||
|
_arguments \
|
||||||
|
{-c,--client}'[the client to test]: : _alternative
|
||||||
|
"hosts\:hosts\: _ssh_hosts"
|
||||||
|
"domains\:domains\:($(virsh list --all --name))"' \
|
||||||
|
--nconnect'[number of connections]: :($(seq 1 32))' \
|
||||||
|
--krb5'[run tests with sec=krb5]' \
|
||||||
|
{-p,--mountpoint}'[the directory to mount the server]: : _files -/' \
|
||||||
|
{-r,--rdma}'[test using rdma]: :(rxe siw)' \
|
||||||
|
{-s,--server}'[the server to test against]: : _alternative
|
||||||
|
"hosts\:hosts\: _ssh_hosts"
|
||||||
|
"domains\:domains\:($(virsh list --all --name))"' \
|
||||||
|
{-x,--export}'[the exported directory on the server]: : _files -/'
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/zsh -e
|
||||||
|
CLIENT=(client)
|
||||||
|
SERVER=(server)
|
||||||
|
EXPORT=(/srv/test)
|
||||||
|
MOUNTPOINT=(/mnt/test)
|
||||||
|
|
||||||
|
zparseopts -F -K \
|
||||||
|
c:=CLIENT -client:=CLIENT \
|
||||||
|
p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \
|
||||||
|
-nconnect:=NCONNECT \
|
||||||
|
-krb5=KRB5 \
|
||||||
|
r:=RDMA -rdma:=RDMA \
|
||||||
|
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
|
||||||
|
#
|
||||||
|
$BIN/vm.zsh boot ${CLIENT[-1]} ${SERVER[-1]}
|
||||||
|
if [ ${#RDMA} -gt 0 ]; then
|
||||||
|
RUN_CTHON="$RUN_CTHON --rdma"
|
||||||
|
$BIN/rdma.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]}
|
||||||
|
fi
|
||||||
|
if [ ${#NCONNECT} -gt 0 ]; then
|
||||||
|
RUN_CTHON="$RUN_CTHON --nconnect ${NCONNECT[-1]}"
|
||||||
|
fi
|
||||||
|
if [ ${#KRB5} -gt 0 ]; then
|
||||||
|
RUN_CTHON="$RUN_CTHON --dokrb5"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
ssh ${CLIENT[-1]} "sudo mkdir -p ${MOUNTPOINT[-1]}"
|
||||||
|
ssh ${CLIENT[-1]} "sudo mount -o sec=sys ${SERVER[-1]}:${EXPORT[-1]} ${MOUNTPOINT[-1]}"
|
||||||
|
TRAPEXIT() { ssh ${CLIENT[-1]} "sudo umount ${MOUNTPOINT[-1]}" }
|
||||||
|
ssh ${CLIENT[-1]} "$RUN_CTHON --mkdirs ${MOUNTPOINT[-1]}/$USER/ 2>&1" | python -u $COLOR
|
||||||
|
ssh ${CLIENT[-1]} "sudo chmod -R 777 ${MOUNTPOINT[-1]}/$USER/"
|
||||||
|
TRAPEXIT() { ; }
|
||||||
|
ssh ${CLIENT[-1]} "sudo umount ${MOUNTPOINT[-1]}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run tests
|
||||||
|
#
|
||||||
|
ssh client "$RUN_CTHON --server ${SERVER[-1]} --serverdir ${EXPORT[-1]}/$USER 2>&1" | python -u $COLOR
|
|
@ -0,0 +1,53 @@
|
||||||
|
From 22b0659aa344e2267b6f84321391d141593ab192 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anna Schumaker <Anna.Schumaker@Netapp.com>
|
||||||
|
Date: Fri, 3 Dec 2021 16:43:36 -0500
|
||||||
|
Subject: [PATCH] runcthon: Add an nconnect option
|
||||||
|
|
||||||
|
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
|
||||||
|
---
|
||||||
|
runcthon | 8 +++++++-
|
||||||
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/runcthon b/runcthon
|
||||||
|
index 730058637c3d..51296cef40ed 100755
|
||||||
|
--- a/runcthon
|
||||||
|
+++ b/runcthon
|
||||||
|
@@ -92,6 +92,7 @@ sec=$5
|
||||||
|
mnt=/mnt
|
||||||
|
fi
|
||||||
|
[ "$fsc" -eq 1 ] && mntargs="$mntargs,fsc"
|
||||||
|
+ [ -n "$nconnect" ] && mntargs="$mntargs,nconnect=$nconnect"
|
||||||
|
[ -n "$port" ] && mntargs="$mntargs,port=$port"
|
||||||
|
|
||||||
|
mkdir -p $mnt/nfsv$vers$proto || exit 1
|
||||||
|
@@ -167,7 +168,7 @@ mkdirs()
|
||||||
|
}
|
||||||
|
trap 'echo SIGINT; pkill runcthon; pkill server; exit 1 ' SIGINT
|
||||||
|
trap 'echo; echo -n "Done:"; date; exit 2' SIGTERM
|
||||||
|
-Usage="$0 --mkdirs [dir] |--unmountall|--server|--serverdir|--noudp|--dokrb5|--onlykrb5|--nov4|--onlyv3|--onlyv4|--nov41|--nov42|--minver <ver>|--fsc|--rdma|--onlyrdma|--nolcks|--port <port>"
|
||||||
|
+Usage="$0 --mkdirs [dir] |--unmountall|--server|--serverdir|--noudp|--dokrb5|--onlykrb5|--nov4|--onlyv3|--onlyv4|--nov41|--nov42|--minver <ver>|--fsc|--nconnect <n>|--rdma|--onlyrdma|--nolcks|--port <port>"
|
||||||
|
|
||||||
|
nolcks=0
|
||||||
|
noudp=1
|
||||||
|
@@ -180,6 +181,7 @@ onlyv3=0
|
||||||
|
onlyv4=0
|
||||||
|
minver=0
|
||||||
|
fsc=0
|
||||||
|
+nconnect=""
|
||||||
|
# Note port="2050" for Panasas server
|
||||||
|
port=""
|
||||||
|
rdma=0
|
||||||
|
@@ -235,6 +237,10 @@ do
|
||||||
|
"--fsc" )
|
||||||
|
fsc=1
|
||||||
|
;;
|
||||||
|
+ "--nconnect" )
|
||||||
|
+ nconnect=$2
|
||||||
|
+ shift
|
||||||
|
+ ;;
|
||||||
|
"--rdma" )
|
||||||
|
rdma=1
|
||||||
|
;;
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
Loading…
Reference in New Issue