diff options
Diffstat (limited to 'old/server.org')
-rwxr-xr-x | old/server.org | 161 |
1 files changed, 161 insertions, 0 deletions
diff --git a/old/server.org b/old/server.org new file mode 100755 index 0000000..0a76f33 --- /dev/null +++ b/old/server.org @@ -0,0 +1,161 @@ +: +#!/bin/sh +# +# @(#)server 1.8 2003/12/29 Connectathon testsuite +# 1.1 Lachman ONC Test Suite source +# +# run tests given a server name. mounts, tests, and unmounts +# arguments: +# -a|-b|-g|-s|-l test selectors, passed to runtests +# -f|-t|-n test arguments, passed to runtests +# -c use cachefs; need to specify cachefs mount +# options with -o +# -N passes repeat "passes" times +# mnt_options arg to -o mount options +# server_path path to mount from server +# mntpoint path to mount on locally +# server_name server to mount from +# +Program=`basename $0` + +InitFile="./tests.init" +USAGE="usage: $Program [-a|-b|-g|-s|-l|-c] [-f|-t|-n|-h] [-o mnt_options] [-p server_path] [-m mntpoint] [-N passes] server_name" + +# defaults +. $InitFile +export PATH CFLAGS LIBS MOUNT UMOUNT MNTOPTIONS + +passes="1" + +set - `getopt abcfglhm:N:no:p:st $*` + +if [ $? != 0 ] +then + echo $USAGE + exit 1 +fi +for c in $* +do + case $c in + -a|-b|-g|-s|-l) TEST=$c; shift ;; + -f|-n|-t) TESTARG=$c; shift ;; + -c) cachefs="yes"; shift ;; + -h) HARDLINKS=n; export HARDLINKS; shift ;; + -m) USRMNTPOINT=$2; shift; shift ;; + -o) MNTOPTIONS=$2; export MNTOPTIONS; + shift; shift ;; + -p) SERVPATH=$2; shift; shift ;; + -N) passes=$2; shift; shift ;; + --) shift; break ;; + esac +done + +if test $# -gt 0 +then + SERVER=$1 + shift + if test $# -gt 0 + then + echo $USAGE + exit 1 + fi +fi + +# if no server specified, exit +if test x$SERVER = x +then + echo $USAGE + exit 1 +fi + +# If the user specified a particular moint point, use that. +# Otherwise, use /mnt/<server_name>. The reason for the default name +# is twofold: +# 1. If the mount point is in / (e.g., /mnt.<server_name>) and the +# server dies, things like getcwd() might hang. +# 2. Having a server-specific name makes administration and concurrent +# test runs a little easier. +if test x$USRMNTPOINT != x +then + MNTPOINT=$USRMNTPOINT +else + MNTPOINT="/mnt/$SERVER" +fi + +# If the mount point doesn't exist, create it and note that we should +# remove it when done. This is a bit of a hack, but combined with +# tying the mountpoint to the server name, it makes it easier to run +# multiple tests at the same time. +if test ! -d $MNTPOINT +then + mkdir -p $MNTPOINT || mkdir $MNTPOINT + dormdir="yes" +fi + +# make sure nothing is mounted on the mountpoint +eval $UMOUNTCMD > /dev/null 2>&1 + +if test -z "$cachefs" +then + eval $MOUNTCMD +else + if test -z "$CFSMOUNTCMD" + then + echo "error: no cachefs mount command (CFSMOUNTCMD) specified" + exit 1 + else + eval $CFSMOUNTCMD + fi +fi + +case $? in + 0) + ;; + *) + echo "Can't mount $SERVER:$SERVPATH on $MNTPOINT" + exit 1 + ;; +esac + +# mount doesn't always return error code if it fails, so lets +# ask here just in case +HOSTNAME=`hostname` +HOSTNAME=`expr $HOSTNAME : '\([^.]*\)'` +NFSTESTDIR=$MNTPOINT/$HOSTNAME.test +export NFSTESTDIR +echo $DASHN "Start tests on path $NFSTESTDIR [y/n]?" "$BLC" +read ans +case $ans in + Y*|y*) + ;; + *) + echo "Terminating ($MNTPOINT left mounted)." + exit 1 + ;; +esac + +echo "" + +if test $passes = "1" +then + passarg="" +else + passarg="-N $passes" +fi + +echo "sh ./runtests $passarg $TEST $TESTARG $NFSTESTDIR" +sh ./runtests $passarg $TEST $TESTARG $NFSTESTDIR + +if [ $? -ne 0 ] +then + echo Tests failed, leaving $MNTPOINT mounted + exit 1 +fi + +eval $UMOUNTCMD +if test x$dormdir = xyes +then + rmdir $MNTPOINT +fi + +exit 0 |