/test/sun/reflect/Reflection/GetCallerClassTest.sh

https://bitbucket.org/screenconnect/openjdk8-jdk · Shell · 68 lines · 33 code · 6 blank · 29 comment · 7 complexity · b31408043e97ce52857da3153bce3265 MD5 · raw file

  1. #
  2. # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  3. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4. #
  5. # This code is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU General Public License version 2 only, as
  7. # published by the Free Software Foundation.
  8. #
  9. # This code is distributed in the hope that it will be useful, but WITHOUT
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. # version 2 for more details (a copy is included in the LICENSE file that
  13. # accompanied this code).
  14. #
  15. # You should have received a copy of the GNU General Public License version
  16. # 2 along with this work; if not, write to the Free Software Foundation,
  17. # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18. #
  19. # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20. # or visit www.oracle.com if you need additional information or have any
  21. # questions.
  22. #
  23. # @test
  24. # @bug 8010117
  25. # @summary Test if the VM enforces sun.reflect.Reflection.getCallerClass
  26. # be called by methods annotated with sun.reflect.CallerSensitive
  27. #
  28. # @run shell GetCallerClassTest.sh
  29. if [ "${TESTSRC}" = "" ]
  30. then
  31. echo "TESTSRC not set. Test cannot execute. Failed."
  32. exit 1
  33. fi
  34. echo "TESTSRC=${TESTSRC}"
  35. if [ "${TESTJAVA}" = "" ]
  36. then
  37. echo "TESTJAVA not set. Test cannot execute. Failed."
  38. exit 1
  39. fi
  40. echo "TESTJAVA=${TESTJAVA}"
  41. if [ "${COMPILEJAVA}" = "" ]
  42. then
  43. COMPILEJAVA="${TESTJAVA}"
  44. fi
  45. echo "COMPILEJAVA=${COMPILEJAVA}"
  46. if [ "${TESTCLASSES}" = "" ]
  47. then
  48. echo "TESTCLASSES not set. Test cannot execute. Failed."
  49. exit 1
  50. fi
  51. BCP=${TESTCLASSES}/bcp
  52. rm -rf ${BCP}
  53. mkdir ${BCP}
  54. # Compile GetCallerClass in bootclasspath
  55. ${COMPILEJAVA}/bin/javac ${TESTTOOLVMOPTS} \
  56. -XDignore.symbol.file \
  57. -d ${BCP} ${TESTSRC}/GetCallerClass.java || exit 1
  58. ${COMPILEJAVA}/bin/javac ${TESTTOOLVMOPTS} \
  59. -XDignore.symbol.file -Xbootclasspath/a:${BCP} \
  60. -d ${TESTCLASSES} ${TESTSRC}/GetCallerClassTest.java || exit 2
  61. ${TESTJAVA}/bin/java ${TESTVMOPTS} -Xbootclasspath/a:${BCP} \
  62. -cp ${TESTCLASSES} GetCallerClassTest || exit 3