hotspot/test/runtime/6929067/Test6929067.sh
changeset 23991 8ed1d72acb64
parent 22898 3f9e14c6f705
equal deleted inserted replaced
23872:536c66fc43d3 23991:8ed1d72acb64
    16 fi
    16 fi
    17 echo "TESTSRC=${TESTSRC}"
    17 echo "TESTSRC=${TESTSRC}"
    18 ## Adding common setup Variables for running shell tests.
    18 ## Adding common setup Variables for running shell tests.
    19 . ${TESTSRC}/../../test_env.sh
    19 . ${TESTSRC}/../../test_env.sh
    20 
    20 
    21 # set platform-dependent variables
    21 if [ "${VM_OS}" != "linux" ]
    22 OS=`uname -s`
       
    23 case "$OS" in
       
    24   Linux)
       
    25     gcc_cmd=`which gcc`
       
    26     if [ "x$gcc_cmd" == "x" ]; then
       
    27         echo "WARNING: gcc not found. Cannot execute test." 2>&1
       
    28         exit 0;
       
    29     fi
       
    30     NULL=/dev/null
       
    31     PS=":"
       
    32     FS="/"
       
    33     ;;
       
    34   * )
       
    35     echo "Test passed; only valid for Linux"
       
    36     exit 0;
       
    37     ;;
       
    38 esac
       
    39 
       
    40 ${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1 
       
    41 
       
    42 # Bitness:
       
    43 # Cannot simply look at TESTVMOPTS as -d64 is not
       
    44 # passed if there is only a 64-bit JVM available.
       
    45 
       
    46 grep "64-Bit" vm_version.out > ${NULL}
       
    47 if [ "$?" = "0" ]
       
    48 then
    22 then
    49   COMP_FLAG="-m64"
    23   echo "Test only valid for Linux"
    50 else
    24   exit 0
    51   COMP_FLAG="-m32"
       
    52 fi
    25 fi
    53 
    26 
    54 
    27 gcc_cmd=`which gcc`
    55 # Architecture:
    28 if [ "x$gcc_cmd" = "x" ]; then
    56 # Translate uname output to JVM directory name, but permit testing
    29   echo "WARNING: gcc not found. Cannot execute test." 2>&1
    57 # 32-bit x86 on an x64 platform.
    30   exit 0;
    58 ARCH=`uname -m`
       
    59 case "$ARCH" in
       
    60   x86_64)
       
    61     if [ "$COMP_FLAG" = "-m32" ]; then
       
    62       ARCH=i386
       
    63     else 
       
    64       ARCH=amd64
       
    65     fi
       
    66     ;;
       
    67   ppc64)
       
    68     if [ "$COMP_FLAG" = "-m32" ]; then
       
    69       ARCH=ppc
       
    70     else 
       
    71       ARCH=ppc64
       
    72     fi
       
    73     ;;
       
    74   sparc64)
       
    75     if [ "$COMP_FLAG" = "-m32" ]; then
       
    76       ARCH=sparc
       
    77     else 
       
    78       ARCH=sparc64
       
    79     fi
       
    80     ;;
       
    81   arm*)
       
    82     # 32-bit ARM machine: compiler may not recognise -m32
       
    83     COMP_FLAG=""
       
    84     ARCH=arm
       
    85     ;;
       
    86   aarch64)
       
    87     # 64-bit arm machine, could be testing 32 or 64-bit:
       
    88     if [ "$COMP_FLAG" = "-m32" ]; then
       
    89       ARCH=arm
       
    90     else 
       
    91       ARCH=aarch64
       
    92     fi
       
    93     ;;
       
    94   i586)
       
    95     ARCH=i386
       
    96     ;;
       
    97   i686)
       
    98     ARCH=i386
       
    99     ;;
       
   100   # Assuming other ARCH values need no translation
       
   101 esac
       
   102 
       
   103 
       
   104 # VM type: need to know server or client
       
   105 VMTYPE=client
       
   106 grep Server vm_version.out > ${NULL}
       
   107 if [ "$?" = "0" ]
       
   108 then
       
   109   VMTYPE=server
       
   110 fi
    31 fi
   111 
    32 
       
    33 CFLAGS=-m${VM_BITS}
   112 
    34 
   113 LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE}:/usr/lib:$LD_LIBRARY_PATH
    35 LD_LIBRARY_PATH=.:${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH
   114 export LD_LIBRARY_PATH
    36 export LD_LIBRARY_PATH
   115 
    37 
   116 cp ${TESTSRC}${FS}*.java ${THIS_DIR}
    38 cp ${TESTSRC}/*.java ${THIS_DIR}
   117 ${COMPILEJAVA}${FS}bin${FS}javac *.java
    39 ${COMPILEJAVA}/bin/javac *.java
   118 
    40 
   119 echo "Architecture: ${ARCH}"
    41 echo "Architecture: ${VM_CPU}"
   120 echo "Compilation flag: ${COMP_FLAG}"
    42 echo "Compilation flag: ${CFLAGS}"
   121 echo "VM type: ${VMTYPE}"
    43 echo "VM type: ${VM_TYPE}"
       
    44 echo "LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}"
       
    45 
   122 # Note pthread may not be found thus invoke creation will fail to be created.
    46 # Note pthread may not be found thus invoke creation will fail to be created.
   123 # Check to ensure you have a /usr/lib/libpthread.so if you don't please look
    47 # Check to ensure you have a /usr/lib/libpthread.so if you don't please look
   124 # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
    48 # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
   125 
    49 
   126 $gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
    50 $gcc_cmd -DLINUX ${CFLAGS} -o invoke \
   127     -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
    51     -I${TESTJAVA}/include -I${TESTJAVA}/include/linux \
   128     -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
    52     -L${TESTJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \
   129      ${TESTSRC}${FS}invoke.c -ljvm -lpthread
    53      ${TESTSRC}/invoke.c -ljvm -lpthread
   130 
    54 
   131 ./invoke
    55 ./invoke
   132 exit $?
    56 exit $?