ReadOldClass.sh revision 1147
5056N/A#!/bin/sh
5056N/A
5056N/A#
5056N/A# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
5056N/A# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5056N/A#
5056N/A# This code is free software; you can redistribute it and/or modify it
5056N/A# under the terms of the GNU General Public License version 2 only, as
5056N/A# published by the Free Software Foundation.
5056N/A#
5056N/A# This code is distributed in the hope that it will be useful, but WITHOUT
5056N/A# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5056N/A# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5056N/A# version 2 for more details (a copy is included in the LICENSE file that
5056N/A# accompanied this code).
5056N/A#
5176N/A# You should have received a copy of the GNU General Public License version
5056N/A# 2 along with this work; if not, write to the Free Software Foundation,
5056N/A# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5056N/A#
5056N/A# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5056N/A# or visit www.oracle.com if you need additional information or have any
5056N/A# questions.
5056N/A#
5056N/A
5056N/A#
5056N/A# @test
5056N/A# @bug 4164450
5056N/A# @summary Ensure that javah/javadoc doesn't try to read (new) source files
5056N/A# @author Peter von der Ah\u00e9
5056N/A# @run shell ReadOldClass.sh
5056N/A#
5056N/A
5056N/ATS=${TESTSRC-.}
5056N/ATC=${TESTCLASSES-.}
5056N/A
5056N/Aif [ "${TESTJAVA}" = "" ]
5056N/Athen
5056N/A echo "TESTJAVA not set. Test cannot execute. Failed."
5056N/A exit 1
5056N/Afi
5056N/A
5056N/A# set platform-dependent variables
5056N/AOS=`uname -s`
5056N/Acase "$OS" in
5056N/A SunOS | Linux | Darwin | CYGWIN* )
5056N/A PS=":"
5056N/A FS="/"
5056N/A ;;
5056N/A Windows* )
5056N/A PS=";"
5056N/A FS="\\"
5056N/A ;;
5056N/A * )
5056N/A echo "Unrecognized system!"
5056N/A exit 1;
5056N/A ;;
5056N/Aesac
5056N/A
5056N/Acat > "${TC}/ReadOldClass.java" <<EOF
5056N/Apublic class ReadOldClass {
5056N/A public static void main(String[] args) {
5056N/A }
5056N/A}
5056N/AEOF
5056N/A
5056N/Arm -f ${TC}/ReadOldClass.h
5056N/A
5056N/Aset -e
5056N/A
5056N/A# compile the file
5056N/A"${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -d "${TC}" "${TC}/ReadOldClass.java"
5056N/A# ensure the source file is newer than the class file
5056N/Atouch "${TC}/ReadOldClass.java"
5056N/A"${TESTJAVA}${FS}bin${FS}javah" ${TESTTOOLVMOPTS} -jni -classpath "${TC}" -d "${TC}" ReadOldClass
5056N/A
5056N/Atest -f "${TC}/ReadOldClass.h"
5056N/A