Home | History | Annotate | Download | only in ns-tools
      1 #!/bin/sh
      2 
      3 ################################################################################
      4 ##                                                                            ##
      5 ## Copyright (c) International Business Machines  Corp., 2005                 ##
      6 ##                                                                            ##
      7 ## This program is free software;  you can redistribute it and#or modify      ##
      8 ## it under the terms of the GNU General Public License as published by       ##
      9 ## the Free Software Foundation; either version 2 of the License, or          ##
     10 ## (at your option) any later version.                                        ##
     11 ##                                                                            ##
     12 ## This program is distributed in the hope that it will be useful, but        ##
     13 ## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
     14 ## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
     15 ## for more details.                                                          ##
     16 ##                                                                            ##
     17 ## You should have received a copy of the GNU General Public License          ##
     18 ## along with this program;  if not, write to the Free Software               ##
     19 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
     20 ##                                                                            ##
     21 ##                                                                            ##
     22 ################################################################################
     23 #
     24 # File:
     25 #   check_envval
     26 #
     27 # Description:
     28 #   Check the environment variable for the network stress test
     29 #
     30 # Returns:
     31 #   0: All necessary environment variables are set.
     32 #   1: Some variables are not set
     33 #
     34 # Author:
     35 #   Mitsuru Chinen <mitch (at] jp.ibm.com>
     36 #
     37 # History:
     38 #   Oct 19 2005 - Created (Mitsuru Chinen)
     39 #
     40 #-----------------------------------------------------------------------
     41 #Uncomment line below for debug output.
     42 #trace_logic=${trace_logic:-"set -x"}
     43 $trace_logic
     44 
     45 . cmdlib.sh
     46 
     47 exists cut locale rsh
     48 
     49 # Unset the locale cocerned variables
     50 for env in `locale | cut -f 1 -d '='` ; do
     51     unset $env
     52 done
     53 unset LANGUAGE
     54 
     55 # RHOST
     56 RHOST=${RHOST:=127.0.0.1}
     57 if [ x${RHOST} = x ]; then
     58     tst_resm TBROK "Environment variable RHOST is not set."
     59     exit 1
     60 fi
     61 
     62 # LHOST_HWADDRS
     63 LHOST_HWADDRS=${LHOST_HWADDRS:=}
     64 if [ x"${LHOST_HWADDRS}" = x ]; then
     65     tst_resm TBROK "Environment variable LHOST_HWADDRS is not set."
     66     exit 1
     67 fi
     68 
     69 # RHOST_HWADDRS
     70 RHOST_HWADDRS=${RHOST_HWADDRS:=}
     71 if [ x"${RHOST_HWADDRS}" = x ]; then
     72     tst_resm TBROK "Environment variable RHOST_HWADDRS is not set."
     73     exit 1
     74 fi
     75 
     76 # LTP_RSH
     77 LTP_RSH=${LTP_RSH:=}
     78 if [ x"${LTP_RSH}" = x ]; then
     79     LTP_RSH="rsh -n"
     80 elif [ "$LTP_RSH" = "rsh" ]; then
     81     LTP_RSH="rsh -n"
     82 fi
     83 
     84 # TMPDIR
     85 TMPDIR=${TMPDIR:=}
     86 if [ x"${TMPDIR}" = x ]; then
     87     TMPDIR=/tmp
     88 fi
     89