home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / tests / nfs / unix-tests / server < prev    next >
Encoding:
Text File  |  1990-01-10  |  2.3 KB  |  118 lines

  1. :
  2. #!/bin/sh
  3. #
  4. #       @(#)server    1.5 90/01/10 NFS Rev 2 testsuite
  5. #      1.1 Lachman ONC Test Suite  source
  6. #
  7. # Uncomment the appropriate mount/umount commands depending upon whether
  8. # this is SysV or BSD.
  9. #
  10. # run tests given a server name.  mounts, tests, and unmounts
  11. # arguments:
  12. #    -a|-b|-g|-s    test selectors, passed to runtests
  13. #    -f|-t|-n    test arguments, passed to runtests
  14. #    mnt_options    arg to -o mount options
  15. #    server_path    path to mount from server
  16. #    mntpoint    path to mount on locally
  17. #    server_name    server to mount from
  18. #
  19. Program=`basename $0`
  20.  
  21. InitFile="./tests.init"
  22. USAGE="usage:  $Program [-a|-b|-g|-s] [-f|-t|-n] [-o mnt_options] [-p server_path] [-m mntpoint] server_name"
  23.  
  24. # defaults
  25. . $InitFile
  26.  
  27. set - `getopt abfgm:no:p:st $*`
  28.  
  29. if [ $? != 0 ]
  30. then
  31.     echo $USAGE
  32.     exit 1
  33. fi
  34. for c in $*
  35. do
  36.     case $c in
  37.         -a|-b|-g|-s)    TESTS=$c; shift    ;;
  38.         -f|-n|-t)    TESTARG=$c; shift    ;;
  39.         -m)        MNTPOINT=$2; shift; shift    ;;
  40.         -o)        MNTOPTIONS=$2; shift; shift    ;;
  41.         -p)        SERVPATH=$2; shift; shift    ;;
  42.         --)        shift; break        ;;
  43.     esac
  44. done
  45.  
  46. if test $# -gt 0
  47. then
  48.     SERVER=$1
  49.     shift
  50.     if test $# -gt 0
  51.     then
  52.         echo $USAGE
  53.         exit 1
  54.     fi
  55. fi
  56.  
  57. # if no server specified, exit
  58. if test x$SERVER = x
  59. then
  60.     echo $USAGE
  61.     exit 1
  62. fi
  63.  
  64. # make sure nothing is mounted on the mountpoint
  65. $UMOUNT $MNTPOINT > /dev/null 2>&1
  66.  
  67. #
  68. if [ "$SYSTYPE" = "-DSVR3" ]
  69. then
  70.     # use the following command if this is SYSV3
  71.     $MOUNT -f NFS,$MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT
  72. else
  73.     # use the following command if this is BSD
  74.     $MOUNT -v -o $MNTOPTIONS $SERVER\:$SERVPATH $MNTPOINT
  75. fi
  76.  
  77. case $? in
  78.     0)
  79.     ;;
  80.     *)
  81.     echo "Can't mount $SERVER:$SERVPATH on $MNTPOINT"
  82.     exit 1
  83.     ;;
  84. esac
  85.  
  86. # mount doesn't always return error code if it fails, so lets
  87. # ask here just in case
  88. HOSTNAME=`hostname`
  89. HOSTNAME=`expr $HOSTNAME : '\([^.]*\)'`
  90. NFSTESTDIR=$MNTPOINT/$HOSTNAME.test
  91. export NFSTESTDIR
  92. echo -n "Start tests on path $NFSTESTDIR [y/n]? "
  93. read ans
  94. case $ans in
  95.     Y*|y*)
  96.     ;;
  97.     *)
  98.     echo "Terminating ($MNTPOINT not unmounted)."
  99.     exit 1
  100.     ;;
  101. esac
  102.     
  103. echo ""
  104.  
  105. echo "sh ./runtests $TESTS $TESTARG $NFSTESTDIR"
  106. sh ./runtests $TESTS $TESTARG $NFSTESTDIR
  107.  
  108. # use the following command if this is SYSV3
  109. if [ "$SYSTYPE" = "-DSVR3" ]
  110. then
  111.     exec $UMOUNT $MNTPOINT
  112. else
  113.     # use the following command if this is BSD
  114.     exec $UMOUNT -v $MNTPOINT
  115. fi
  116.  
  117. # nothing executed after here
  118.