< prev index next >

test/java/lang/management/OperatingSystemMXBean/TestSystemLoadAvg.sh

Print this page
rev 1541 : 8003890: corelibs test scripts should pass TESTVMOPTS
Reviewed-by: chegar, alanb
Contributed-by: Mark Sheppard <mark.sheppard@oracle.com>


  35 # This test tests the system load average on linux and solaris.
  36 # On windows tests if it returns -1.0 The verification is done
  37 # by the GetSystemLoadAverage class.  By default it takes no
  38 # input argument which verifies the system load average with
  39 # /usr/bin/uptime command. Or specify "-1.0" as the input argument
  40 # indicatiing that the platform doesn't support the system load average.
  41 
  42 #Set appropriate jdk
  43 #
  44 
  45 if [ ! -z "${TESTJAVA}" ] ; then
  46      jdk="$TESTJAVA"
  47 else
  48      echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
  49      exit 1
  50 fi
  51 
  52 runOne()
  53 {
  54    echo "$TESTJAVA/bin/java -classpath $TESTCLASSES $@"
  55    $TESTJAVA/bin/java -classpath $TESTCLASSES $@
  56 }
  57 
  58 # Retry 5 times to be more resilent to system load fluctation.
  59 MAX=5
  60 i=1
  61 while true; do
  62   echo "Run $i: TestSystemLoadAvg"
  63   case `uname -s` in
  64       SunOS | Linux | Darwin | AIX )
  65          runOne GetSystemLoadAverage 
  66          ;;
  67       * )
  68          # On Windows -1.0 should be returned
  69          runOne GetSystemLoadAverage "-1.0"
  70          ;;
  71   esac
  72   if [ $? -eq 0 ]; then
  73       # exit if the test passes
  74       echo "Run $i: TestSystemLoadAvg test passed"
  75       exit 0


  35 # This test tests the system load average on linux and solaris.
  36 # On windows tests if it returns -1.0 The verification is done
  37 # by the GetSystemLoadAverage class.  By default it takes no
  38 # input argument which verifies the system load average with
  39 # /usr/bin/uptime command. Or specify "-1.0" as the input argument
  40 # indicatiing that the platform doesn't support the system load average.
  41 
  42 #Set appropriate jdk
  43 #
  44 
  45 if [ ! -z "${TESTJAVA}" ] ; then
  46      jdk="$TESTJAVA"
  47 else
  48      echo "--Error: TESTJAVA must be defined as the pathname of a jdk to test."
  49      exit 1
  50 fi
  51 
  52 runOne()
  53 {
  54    echo "$TESTJAVA/bin/java -classpath $TESTCLASSES $@"
  55    $TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES $@
  56 }
  57 
  58 # Retry 5 times to be more resilent to system load fluctation.
  59 MAX=5
  60 i=1
  61 while true; do
  62   echo "Run $i: TestSystemLoadAvg"
  63   case `uname -s` in
  64       SunOS | Linux | Darwin | AIX )
  65          runOne GetSystemLoadAverage 
  66          ;;
  67       * )
  68          # On Windows -1.0 should be returned
  69          runOne GetSystemLoadAverage "-1.0"
  70          ;;
  71   esac
  72   if [ $? -eq 0 ]; then
  73       # exit if the test passes
  74       echo "Run $i: TestSystemLoadAvg test passed"
  75       exit 0
< prev index next >