xfstests.zsh: Lots of updates for parallel xfstests

Also download the xunit reports generated during testing and store them
for later

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2022-01-20 16:58:36 -05:00
parent 3a2a30af33
commit 50fcd690ba
3 changed files with 116 additions and 60 deletions

View File

@ -2,54 +2,85 @@ import sys
import re import re
import termcolor import termcolor
PROTO_COLORS = { "tcp":"white", "rdma":"yellow" }
PROTO = sys.argv[1]
VERS_COLORS = { "v3":"red", "v4.0":"green", "v4.1":"blue", "v4.2":"yellow" }
VERS = f"v{sys.argv[2]}"
COLOR = VERS_COLORS[VERS]
prefix = termcolor.colored("[", "white", attrs=["bold"]) prefix = termcolor.colored("[", "white", attrs=["bold"])
prefix += termcolor.colored(sys.argv[1].rjust(4), "red", attrs=["bold"]) prefix += termcolor.colored(PROTO.rjust(4), PROTO_COLORS[PROTO], attrs=["dark"])
prefix += "," prefix += termcolor.colored(",", "white", attrs=["bold"])
prefix += termcolor.colored(f"v{sys.argv[2]}".ljust(4), "magenta") prefix += termcolor.colored(VERS.ljust(4), COLOR, attrs=["bold"])
prefix += termcolor.colored("] ", "white", attrs=["bold"]) prefix += termcolor.colored("] ", "white", attrs=["bold"])
#proto = sys.argv[1].rjust(4) CONFIG = [ ]
#vers = sys.argv[2].ljust(3) def add_config(line):
def print_prefix(): [ key, val ] = [ s.strip() for s in re.split("--", line) ]
print(prefix, end="") if key == "MKFS_OPTIONS":
# termcolor.cprint("[", "white", attrs=["bold"], end="") return
#termcolor.cprint(proto, "red", attrs=["bold"], end="") elif key == "MOUNT_OPTIONS" and val[:2] != "-o":
#termcolor.cprint(",", "white", end="") return
#termcolor.cprint(f"v{vers}", "magenta", end="")
#termcolor.cprint("] ", "white", attrs=["bold"], end="")
text = "" parts = [ prefix ]
def print_text(color, attr=None): parts.append(termcolor.colored(key.ljust(14), COLOR, attrs=["bold"]))
global text parts.append(termcolor.colored("-- ", "white", attrs=["dark"]))
termcolor.cprint(text, color=color, attrs=[attr] if attr else None, end="") parts.append(termcolor.colored(val, "white", attrs=["bold"]))
text = "" CONFIG.append("".join(parts))
def print_config(): def print_config():
global text if len(CONFIG) > 0:
key, val = re.split("--", text) print("\n".join(CONFIG), end="\n\n")
if key != "MKFS_OPTIONS " and val[:3] != " -o": CONFIG.clear()
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): def print_test(match):
text += c parts = [ prefix ]
if re.match("^PLATFORM.*PREEMPT", text): parts.append(termcolor.colored(match.group(1), COLOR, attrs=["bold"]))
text += "\n"
if m := re.match("(\[not run\])(.*?\n)", match.group(2)):
return
parts.append(termcolor.colored(m.group(1), "yellow"))
parts.append(termcolor.colored(m.group(2), "white", attrs=["bold"]))
elif m := re.match("(\d+s)( ... +)(\d+s\n)", match.group(2)):
parts.append(termcolor.colored(m.group(1), "green"))
parts.append(termcolor.colored(m.group(2), "white", attrs=["dark"]))
parts.append(termcolor.colored(m.group(3), "green"))
elif re.match("\d+s\n", match.group(2)):
parts.append(termcolor.colored(match.group(2), "green"))
else: # Test failed
line = re.sub("\]-", "\] -", match.group(2))
parts.append(termcolor.colored(line, "magenta", attrs=["bold"]))
print("".join(parts), end="")
def print_diff(line):
print(prefix, end="")
if re.match(" +@@.*?@@\n", line):
termcolor.cprint(line, color="yellow", attrs=["dark"], end="")
elif re.match(" +-", line):
termcolor.cprint(line, color="magenta", attrs=["dark"], end="")
elif re.match(" +\+", line):
termcolor.cprint(line, color="cyan", attrs=["dark"], end="")
elif re.match(" +\(Run", line):
termcolor.cprint(line, color="magenta", attrs=["bold"], end="")
else:
termcolor.cprint(line, color="white", attrs=["dark"], end="")
for line in sys.stdin:
if line == "\n":
print_config() print_config()
text = "COMPILED --" elif re.match("^[A-Z_]+[ ]+-- .*?\n", line):
elif re.match("^[A-Z_]+[ ]+-- .*?\n", text): if match := re.match("(^PLATFORM(.*?)PREEMPT)(.*?\n)", line):
print_config() add_config(match.group(1))
elif re.match("[a-z]+/[\d]+[ ]", text): line = f"COMPILED -- {match.group(3)}"
print_prefix() add_config(line)
print_text("blue") elif match := re.match("(^[a-z]+/[\d]+[ | ]+)(.*?\n)", line):
elif re.match("[ ]?[\d]+s", text): print_test(match)
print_text("green") elif match := re.match("^ (.*?)\n", line):
elif re.match(" ... ", text): print_diff(line)
print_text("white") else:
elif re.match("\[not run\]", text): #pass
print_text("yellow", "bold") print(prefix, end="")
elif c == "\n": print(line, end="")
print_text("white", "bold")

View File

@ -2,22 +2,33 @@
zparseopts -D -K -server:=SERVER -opts:=OPTS -user:=USER \ zparseopts -D -K -server:=SERVER -opts:=OPTS -user:=USER \
-export:=EXPORT -mountpoint:=MOUNTPOINT \ -export:=EXPORT -mountpoint:=MOUNTPOINT \
-scratch:=SCRATCH -scratchmnt:=SCRATCHMNT -scratch:=SCRATCH -scratchmnt:=SCRATCHMNT \
-proto:=PROTO -version:=VERSION
xdir=$(echo "nfsv${VERSION[-1]}${PROTO[-1]}" | sed 's/\.//' | sed 's/v40/v4/')
cd /home/${USER[-1]}/xfstests-dev cd /home/${USER[-1]}/xfstests-dev
export TEST_DEV=${SERVER[-1]}:${EXPORT[-1]}/${USER[-1]}/xfstests export TEST_DEV=${SERVER[-1]}:${EXPORT[-1]}/${USER[-1]}/$xdir
export TEST_DIR=${MOUNTPOINT[-1]} export TEST_DIR=${MOUNTPOINT[-1]}/$xdir
export SCRATCH_DEV=${SERVER[-1]}:${SCRATCH[-1]}/${USER[-1]}/xfstests export SCRATCH_DEV=${SERVER[-1]}:${SCRATCH[-1]}/${USER[-1]}/$xdir
export SCRATCH_MNT=${SCRATCHMNT[-1]} export SCRATCH_MNT=${SCRATCHMNT[-1]}/$xdir
export NFS_MOUNT_OPTIONS="-o ${OPTS[-1]}" export NFS_MOUNT_OPTIONS="-o proto=${PROTO[-1]},v${VERSION[-1]},${OPTS[-1]}"
export RESULT_BASE=/home/${USER[-1]}/xfstests-dev/results/${PROTO[-1]}/${VERSION[-1]}
mkdir -p $TEST_DIR
mkdir -p $SCRATCH_MNT
[ -e local.config ] && rm -f local.config
echo "TIME -- $(date)" echo "TIME -- $(date)"
echo "TEST_DEV -- $TEST_DEV" echo "TEST_DEV -- $TEST_DEV"
echo "TEST_DIR -- $TEST_DIR" echo "TEST_DIR -- $TEST_DIR"
echo "SCRATCH_DEV -- $SCRATCH_DEV" echo "SCRATCH_DEV -- $SCRATCH_DEV"
echo "SCRATCH_MNT -- $SCRATCH_MNT" echo "SCRATCH_MNT -- $SCRATCH_MNT"
echo "MOUNT_OPTIONS -- ${OPTS[-1]}" echo "MOUNT_OPTIONS -- $NFS_MOUNT_OPTIONS"
if [ ! -z "$*" ]; then if [ ! -z "$*" ]; then
echo "XFSTESTS_ARGS -- $*" echo "XFSTESTS_ARGS -- $*"
fi fi
./check -nfs $*
#./check -nfs -r -R xunit $*
./check -nfs -R xunit $*

View File

@ -21,7 +21,12 @@ zparseopts -D -K \
BIN=$HOME/bin BIN=$HOME/bin
COLOR=$BIN/colors/xfstests.py COLOR=$BIN/colors/xfstests.py
RUN_XFSTESTS="sudo run-xfstests.zsh" RUN_XFSTESTS="sudo run-xfstests.zsh"
OPTIONS="sec=sys"
USER=$(whoami) USER=$(whoami)
TODAY=$(date +%Y/%m/%d)
NOW=$(date +%H:%M:%S)
REMOTE_RESULTS=xfstests-dev/results/
RESULTS=$HOME/.local/share/xfstests/${SERVER[-1]}/$TODAY
# #
# Prepare to test # Prepare to test
@ -30,7 +35,7 @@ $BIN/vm.zsh boot ${CLIENT[-1]} ${SERVER[-1]}
$BIN/install-scripts.zsh ${CLIENT[-1]} $BIN/install-scripts.zsh ${CLIENT[-1]}
if [ ${#RDMA} -gt 0 ]; then if [ ${#RDMA} -gt 0 ]; then
PROTO+=(rdma) PROTO+=(rdma)
$BIN/rdma.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]} $BIN/rping.zsh ${RDMA[-1]} ${CLIENT[-1]} ${SERVER[-1]}
fi fi
ssh ${CLIENT[-1]} "sudo setup-xfstests.zsh ${SERVER[-1]} ${EXPORT[-1]} ${MOUNTPOINT[-1]} \ ssh ${CLIENT[-1]} "sudo setup-xfstests.zsh ${SERVER[-1]} ${EXPORT[-1]} ${MOUNTPOINT[-1]} \
@ -42,22 +47,31 @@ for arg in $*; do
testargs+=($(printf '%q' "$arg")) testargs+=($(printf '%q' "$arg"))
done done
run_xfs_tests() {
ssh ${CLIENT[-1]} "$RUN_XFSTESTS --server ${SERVER[-1]} \
--export ${EXPORT[-1]} \
--mountpoint ${MOUNTPOINT[-1]} \
--scratch ${SCRATCH[-1]} \
--scratchmnt ${SCRATCHMNT[-1]} \
--proto $1 \
--version $2 \
--opts $OPTIONS \
--user $USER $testargs" | python $COLOR $1 $2
scp -q ${CLIENT[-1]}:$REMOTE_RESULTS/$1/$2/result.xml $RESULTS/$NOW-$1-$2.xml
}
# #
# Run tests # Run tests
# #
mkdir -p $RESULTS
for proto in $PROTO; do for proto in $PROTO; do
for vers in $VERSION; do for vers in $VERSION; do
case $vers in case $vers in
"-v" | "--version") continue ;; "-v" | "--version") continue ;;
*) opts="$proto,vers=$vers" ;;
esac esac
ssh ${CLIENT[-1]} "$RUN_XFSTESTS --server ${SERVER[-1]} \ run_xfs_tests $proto $vers &
--export ${EXPORT[-1]} \
--mountpoint ${MOUNTPOINT[-1]} \
--scratch ${SCRATCH[-1]} \
--scratchmnt ${SCRATCHMNT[-1]} \
--opts $opts \
--user $USER $testargs" | python -u $COLOR $proto $vers
done done
done done
wait