1 #!/usr/bin/ksh
   2 
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright (c) 2012 by Delphix. All rights reserved.
  16 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  17 #
  18 
  19 # To allow ipsectest to access the full run of STF infrastructure...
  20 export STF_SUITE="/opt/net-tests"
  21 export STF_TOOLS="/opt/test-runner/stf"
  22 runner="/opt/test-runner/bin/run"
  23 
  24 function fail
  25 {
  26         echo $1
  27         exit ${2:-1}
  28 }
  29 
  30 function verify_id
  31 {
  32         # For now, just force this to be run as root.  Eventually, the
  33         # appropriate IP configuration privileges should be enough.
  34         [[ $(id -u) != "0" ]] && fail "This script must be run as root."
  35 }
  36 
  37 ##### END OF FUNCTIONS #####
  38 
  39 verify_id
  40 
  41 runfile='ipsec-peers.run'
  42 
  43 while getopts qs c; do
  44         case $c in
  45         's')
  46                 runfile='ipsec-self.run'
  47                 ;;
  48         'q')
  49                 quiet='-q'
  50                 ;;
  51         esac
  52 done
  53 shift $((OPTIND - 1))
  54 
  55 . $STF_SUITE/include/commands.kshlib
  56 . $STF_SUITE/include/vars.kshlib
  57 
  58 echo "RUNNING: $runner $quiet -c $STF_SUITE/runfiles/$runfile"
  59 $runner $quiet -c $STF_SUITE/runfiles/$runfile
  60 
  61 exit $?