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