Implement xfstests using zsh
This includes our main xfstests.zsh file, and some support scripts for setting up and running tests on the client Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
802135201a
commit
76846ae7d4
|
@ -0,0 +1,55 @@
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
import termcolor
|
||||||
|
|
||||||
|
prefix = termcolor.colored("[", "white", attrs=["bold"])
|
||||||
|
prefix += termcolor.colored(sys.argv[1].rjust(4), "red", attrs=["bold"])
|
||||||
|
prefix += ","
|
||||||
|
prefix += termcolor.colored(f"v{sys.argv[2]}".ljust(4), "magenta")
|
||||||
|
prefix += termcolor.colored("] ", "white", attrs=["bold"])
|
||||||
|
|
||||||
|
#proto = sys.argv[1].rjust(4)
|
||||||
|
#vers = sys.argv[2].ljust(3)
|
||||||
|
def print_prefix():
|
||||||
|
print(prefix, end="")
|
||||||
|
# termcolor.cprint("[", "white", attrs=["bold"], end="")
|
||||||
|
#termcolor.cprint(proto, "red", attrs=["bold"], end="")
|
||||||
|
#termcolor.cprint(",", "white", end="")
|
||||||
|
#termcolor.cprint(f"v{vers}", "magenta", end="")
|
||||||
|
#termcolor.cprint("] ", "white", attrs=["bold"], end="")
|
||||||
|
|
||||||
|
text = ""
|
||||||
|
def print_text(color, attr=None):
|
||||||
|
global text
|
||||||
|
termcolor.cprint(text, color=color, attrs=[attr] if attr else None, end="")
|
||||||
|
text = ""
|
||||||
|
|
||||||
|
def print_config():
|
||||||
|
global text
|
||||||
|
key, val = re.split("--", text)
|
||||||
|
if key != "MKFS_OPTIONS " and val[:3] != " -o":
|
||||||
|
print_prefix()
|
||||||
|
termcolor.cprint(key, "cyan", attrs=["bold"], end="")
|
||||||
|
termcolor.cprint("--", "white", end="")
|
||||||
|
termcolor.cprint(val, "white", attrs=["bold"], end="")
|
||||||
|
text = ""
|
||||||
|
|
||||||
|
while c := sys.stdin.read(1):
|
||||||
|
text += c
|
||||||
|
if re.match("^PLATFORM.*PREEMPT", text):
|
||||||
|
text += "\n"
|
||||||
|
print_config()
|
||||||
|
text = "COMPILED --"
|
||||||
|
elif re.match("^[A-Z_]+[ ]+-- .*?\n", text):
|
||||||
|
print_config()
|
||||||
|
elif re.match("[a-z]+/[\d]+[ ]", text):
|
||||||
|
print_prefix()
|
||||||
|
print_text("blue")
|
||||||
|
elif re.match("[ ]?[\d]+s", text):
|
||||||
|
print_text("green")
|
||||||
|
elif re.match(" ... ", text):
|
||||||
|
print_text("white")
|
||||||
|
elif re.match("\[not run\]", text):
|
||||||
|
print_text("yellow", "bold")
|
||||||
|
elif c == "\n":
|
||||||
|
print_text("white", "bold")
|
|
@ -0,0 +1,17 @@
|
||||||
|
#compdef xfstests.zsh
|
||||||
|
|
||||||
|
function _xfstests.zsh() {
|
||||||
|
_arguments \
|
||||||
|
{-c,--client}'[the client to test]: : _alternative
|
||||||
|
"hosts\:hosts\: _ssh_hosts"
|
||||||
|
"domains\:domains\:($(virsh list --all --name))"' \
|
||||||
|
{-k,--scratch}'[the exported scratch directory on the server]: : _files -/' \
|
||||||
|
{-p,--mountpoint}'[the directory to mount the server]: : _files -/' \
|
||||||
|
{-r,--rdma}'[test using rdma]: :(rxe siw)' \
|
||||||
|
{-q,--scratchmnt}'[the directory to mount the scratch export]: : _files -/' \
|
||||||
|
{-s,--server}'[the server to test against]: : _alternative
|
||||||
|
"hosts\:hosts\: _ssh_hosts"
|
||||||
|
"domains\:domains\:($(virsh list --all --name))"' \
|
||||||
|
\*{-v,--version}+'[the nfs version to test (default=all)]: :(3 4.0 4.1 4.2)' \
|
||||||
|
{-x,--export}'[the exported directory on the server]: : _files -/'
|
||||||
|
}
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
|
|
||||||
BIN=$HOME/bin
|
BIN=$HOME/bin
|
||||||
SCRIPTS=(grub-list.zsh setup-testdirs.zsh setup-cthon.zsh)
|
SCRIPTS=(grub-list.zsh setup-testdirs.zsh setup-cthon.zsh \
|
||||||
|
setup-xfstests.zsh run-xfstests.zsh)
|
||||||
|
|
||||||
function install_script() {
|
function install_script() {
|
||||||
ssh $1 mkdir -p bin/
|
ssh $1 mkdir -p bin/
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
|
||||||
|
zparseopts -D -K -server:=SERVER -opts:=OPTS -user:=USER \
|
||||||
|
-export:=EXPORT -mountpoint:=MOUNTPOINT \
|
||||||
|
-scratch:=SCRATCH -scratchmnt:=SCRATCHMNT
|
||||||
|
|
||||||
|
cd /home/${USER[-1]}/xfstests-dev
|
||||||
|
export TEST_DEV=${SERVER[-1]}:${EXPORT[-1]}/${USER[-1]}/xfstests
|
||||||
|
export TEST_DIR=${MOUNTPOINT[-1]}
|
||||||
|
export SCRATCH_DEV=${SERVER[-1]}:${SCRATCH[-1]}/${USER[-1]}/xfstests
|
||||||
|
export SCRATCH_MNT=${SCRATCHMNT[-1]}
|
||||||
|
export NFS_MOUNT_OPTIONS="-o ${OPTS[-1]}"
|
||||||
|
|
||||||
|
echo "TIME -- $(date)"
|
||||||
|
echo "TEST_DEV -- $TEST_DEV"
|
||||||
|
echo "TEST_DIR -- $TEST_DIR"
|
||||||
|
echo "SCRATCH_DEV -- $SCRATCH_DEV"
|
||||||
|
echo "SCRATCH_MNT -- $SCRATCH_MNT"
|
||||||
|
echo "MOUNT_OPTIONS -- ${OPTS[-1]}"
|
||||||
|
if [ ! -z "$*" ]; then
|
||||||
|
echo "XFSTESTS_ARGS -- $*"
|
||||||
|
fi
|
||||||
|
./check -nfs $*
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/zsh
|
||||||
|
SERVER=$1
|
||||||
|
EXPORT=$2
|
||||||
|
MOUNTPOINT=$3
|
||||||
|
SCRATCH=$4
|
||||||
|
SCRATCHMNT=$5
|
||||||
|
USER=$6
|
||||||
|
|
||||||
|
if [ "$#" -ne 6 ]; then
|
||||||
|
echo "Usage: $0 {server} {export} {mountpoint} {scratch} {scratchmnt} {user}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
useradd -m fsgqa 2>/dev/null
|
||||||
|
groupadd fsgqa 2>/dev/null
|
||||||
|
useradd --badnames 123456-fsgqa 2>/dev/null
|
||||||
|
useradd fsgqa2 2>/dev/null
|
||||||
|
|
||||||
|
TRAPEXIT() {
|
||||||
|
umount $MOUNTPOINT
|
||||||
|
umount $SCRATCHMNT
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p $MOUNTPOINT
|
||||||
|
mkdir -p $SCRATCHMNT
|
||||||
|
|
||||||
|
mount -o sec=sys $SERVER:$EXPORT $MOUNTPOINT
|
||||||
|
mount -o sec=sys $SERVER:$SCRATCH $SCRATCHMNT
|
||||||
|
|
||||||
|
mkdir -p -m 777 $MOUNTPOINT/$USER/xfstests
|
||||||
|
mkdir -p -m 777 $SCRATCHMNT/$USER/xfstests
|
|
@ -0,0 +1,63 @@
|
||||||
|
#!/bin/zsh -e
|
||||||
|
CLIENT=(client)
|
||||||
|
SERVER=(server)
|
||||||
|
EXPORT=(/srv/test)
|
||||||
|
SCRATCH=(/srv/scratch)
|
||||||
|
MOUNTPOINT=(/mnt/test)
|
||||||
|
SCRATCHMNT=(/mnt/scratch)
|
||||||
|
VERSION=(3 4.0 4.1 4.2)
|
||||||
|
PROTO=(tcp)
|
||||||
|
|
||||||
|
zparseopts -D -K \
|
||||||
|
c:=CLIENT -client:=CLIENT \
|
||||||
|
k:=SCRATCH -scratch:=SCRATCH \
|
||||||
|
p:=MOUNTPOINT -mountpoint:=MOUNTPOINT \
|
||||||
|
q:=SCRATCHMNT -scratchmnt:=SCRATCHMNT \
|
||||||
|
r:=RDMA -rdma:=RDMA \
|
||||||
|
s:=SERVER -server:=SERVER \
|
||||||
|
x:=EXPORT -export:=EXPORT \
|
||||||
|
v+:=VERSION -version+:=VERSION
|
||||||
|
|
||||||
|
BIN=$HOME/bin
|
||||||
|
COLOR=$BIN/colors/xfstests.py
|
||||||
|
RUN_XFSTESTS="sudo run-xfstests.zsh"
|
||||||
|
USER=$(whoami)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Prepare to test
|
||||||
|
#
|
||||||
|
$BIN/vm.zsh boot ${CLIENT[-1]} ${SERVER[-1]}
|
||||||
|
$BIN/install-scripts.zsh ${CLIENT[-1]}
|
||||||
|
if [ ${#RDMA} -gt 0 ]; then
|
||||||
|
PROTO+=(rdma)
|
||||||
|
$BIN/rdma.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
ssh ${CLIENT[-1]} "sudo setup-xfstests.zsh ${SERVER[-1]} ${EXPORT[-1]} ${MOUNTPOINT[-1]} \
|
||||||
|
${SCRATCH[-1]} ${SCRATCHMNT[-1]} $USER"
|
||||||
|
echo
|
||||||
|
|
||||||
|
testargs=()
|
||||||
|
for arg in $*; do
|
||||||
|
testargs+=($(printf '%q' "$arg"))
|
||||||
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run tests
|
||||||
|
#
|
||||||
|
for proto in $PROTO; do
|
||||||
|
for vers in $VERSION; do
|
||||||
|
case $vers in
|
||||||
|
"-v" | "--version") continue ;;
|
||||||
|
*) opts="$proto,vers=$vers" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ssh ${CLIENT[-1]} "$RUN_XFSTESTS --server ${SERVER[-1]} \
|
||||||
|
--export ${EXPORT[-1]} \
|
||||||
|
--mountpoint ${MOUNTPOINT[-1]} \
|
||||||
|
--scratch ${SCRATCH[-1]} \
|
||||||
|
--scratchmnt ${SCRATCHMNT[-1]} \
|
||||||
|
--opts $opts \
|
||||||
|
--user $USER $testargs" | python -u $COLOR $proto $vers
|
||||||
|
done
|
||||||
|
done
|
Loading…
Reference in New Issue