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