summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-02-22 14:43:02 -0500
committerSteve Dickson <steved@redhat.com>2009-02-22 14:43:02 -0500
commit43d64aa2dabf5029aac3e503a875a3cda6c5d253 (patch)
tree34b0d7d90205ca9f6a26c319638d80d44ee03bd7 /server
downloadcthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.tar.gz
cthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.tar.xz
cthon04-43d64aa2dabf5029aac3e503a875a3cda6c5d253.zip
Inital Commit
Diffstat (limited to 'server')
-rwxr-xr-xserver164
1 files changed, 164 insertions, 0 deletions
diff --git a/server b/server
new file mode 100755
index 0000000..91ffd80
--- /dev/null
+++ b/server
@@ -0,0 +1,164 @@
+:
+#!/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 FSOPT
+
+passes="1"
+
+set - `getopt abcfF:glhm: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 ;;
+ -F) FSOPT=$2; export FSOPT;
+ 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
+ans="y"
+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 2>&1
+ exit 1
+fi
+
+eval $UMOUNTCMD
+if test x$dormdir = xyes
+then
+ rmdir $MNTPOINT
+fi
+
+exit 0