Test6929067.sh 2.6 KB
Newer Older
1 2 3 4 5 6
#!/bin/sh

##
## @test Test6929067.sh
## @bug 6929067
## @summary Stack guard pages should be removed when thread is detached
7
## @compile T.java
8 9
## @run shell Test6929067.sh
##
10
set -x
11 12
if [ "${TESTSRC}" = "" ]
then
13 14
  TESTSRC=${PWD}
  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
15
fi
16 17 18
echo "TESTSRC=${TESTSRC}"
## Adding common setup Variables for running shell tests.
. ${TESTSRC}/../../test_env.sh
19 20 21 22 23 24 25 26 27

# set platform-dependent variables
OS=`uname -s`
case "$OS" in
  Linux)
    NULL=/dev/null
    PS=":"
    FS="/"
    ;;
28
  * )
29 30 31 32 33
    echo "Test passed; only valid for Linux"
    exit 0;
    ;;
esac

34 35 36
${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -Xinternalversion > vm_version.out 2>&1 

# Bitness:
37 38 39
# Cannot simply look at TESTVMOPTS as -d64 is not
# passed if there is only a 64-bit JVM available.

40
grep "64-Bit" vm_version.out > ${NULL}
41 42
if [ "$?" = "0" ]
then
43
  COMP_FLAG="-m64"
44
else
45
  COMP_FLAG="-m32"
46 47
fi

48

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
# Architecture:
# Translate uname output to JVM directory name, but permit testing
# 32-bit x86 on an x64 platform.
ARCH=`uname -m`
case "$ARCH" in
  x86_64)
    if [ "$COMP_FLAG" = "-m32" ]; then
      ARCH=i386
    else 
      ARCH=amd64
    fi
    ;;
  ppc64)
    if [ "$COMP_FLAG" = "-m32" ]; then
      ARCH=ppc
    else 
      ARCH=ppc64
    fi
    ;;
  sparc64)
    if [ "$COMP_FLAG" = "-m32" ]; then
      ARCH=sparc
    else 
      ARCH=sparc64
    fi
    ;;
  arm*)
    # 32-bit ARM machine: compiler may not recognise -m32
    COMP_FLAG=""
    ARCH=arm
    ;;
  aarch64)
    # 64-bit arm machine, could be testing 32 or 64-bit:
    if [ "$COMP_FLAG" = "-m32" ]; then
      ARCH=arm
    else 
      ARCH=aarch64
    fi
    ;;
  i586)
    ARCH=i386
    ;;
  i686)
    ARCH=i386
    ;;
  # Assuming other ARCH values need no translation
esac
96 97


98 99 100 101 102 103 104 105 106
# VM type: need to know server or client
VMTYPE=client
grep Server vm_version.out > ${NULL}
if [ "$?" = "0" ]
then
  VMTYPE=server
fi


107
LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE}:/usr/lib:$LD_LIBRARY_PATH
108 109 110 111 112 113
export LD_LIBRARY_PATH

cp ${TESTSRC}${FS}invoke.c .

# Copy the result of our @compile action:
cp ${TESTCLASSES}${FS}T.class .
114

115 116 117
echo "Architecture: ${ARCH}"
echo "Compilation flag: ${COMP_FLAG}"
echo "VM type: ${VMTYPE}"
118 119 120
# Note pthread may not be found thus invoke creation will fail to be created.
# Check to ensure you have a /usr/lib/libpthread.so if you don't please look
# for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
121 122

gcc -DLINUX ${COMP_FLAG} -o invoke \
123 124
  -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
  -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
125
  -ljvm -lpthread invoke.c
126 127 128

./invoke
exit $?