check_envval 2.9 KB

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