duke@1: #!/bin/sh duke@1: duke@1: # ohair@554: # Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. duke@1: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: # duke@1: # This code is free software; you can redistribute it and/or modify it duke@1: # under the terms of the GNU General Public License version 2 only, as duke@1: # published by the Free Software Foundation. duke@1: # duke@1: # This code is distributed in the hope that it will be useful, but WITHOUT duke@1: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: # version 2 for more details (a copy is included in the LICENSE file that duke@1: # accompanied this code). duke@1: # duke@1: # You should have received a copy of the GNU General Public License version duke@1: # 2 along with this work; if not, write to the Free Software Foundation, duke@1: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: # ohair@554: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: # or visit www.oracle.com if you need additional information or have any ohair@554: # questions. duke@1: # duke@1: duke@1: # @test duke@1: # @bug 5008759 4998341 5018369 5032476 5060121 5096932 5096931 duke@1: # @run shell ../verifyVariables.sh duke@1: # @run shell print.sh duke@1: # @summary test availabilty of print option duke@1: # @author Joseph D. Darcy duke@1: duke@1: OS=`uname -s`; duke@1: case "${OS}" in jjg@387: CYGWIN* ) jjg@387: DIFFOPTS="--strip-trailing-cr" duke@1: ;; duke@1: duke@1: * ) duke@1: ;; duke@1: esac duke@1: jjg@142: # Compile file directly, without TESTJAVACOPTS jjg@142: # Don't use @build or @compile as these implicitly use jtreg -javacoption values jjg@142: # and it is important that this file be compiled as expected, for later comparison jjg@142: # against a golden file. jjg@142: "${TESTJAVA}/bin/javac" ${TESTTOOLVMOPTS} -d ${TESTCLASSES} ${TESTSRC}/Aggregate.java jjg@142: duke@1: # Construct path to apt executable duke@1: APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} \ duke@1: -print " duke@1: duke@1: printf "%s\n" "APT = ${APT}" duke@1: duke@1: PRINT_FILES="${TESTSRC}/MisMatch.java \ duke@1: ${TESTSRC}/GenClass.java \ duke@1: ${TESTSRC}/Misc.java \ duke@1: ${TESTSRC}/Lacuna.java" duke@1: duke@1: for i in ${PRINT_FILES} duke@1: do duke@1: # Delete any existing class file duke@1: FILENAME=`basename $i .java` duke@1: rm -f ${FILENAME}.class duke@1: duke@1: printf "%s\n" "Printing ${i}" duke@1: ${APT} ${i} duke@1: duke@1: RESULT=$? duke@1: case "$RESULT" in duke@1: 0 ) duke@1: ;; duke@1: duke@1: * ) duke@1: echo "Problem printing file ${i}." duke@1: exit 1 duke@1: esac duke@1: duke@1: # Verify compilation did not occur duke@1: if [ -f ${FILENAME}.class ]; then duke@1: printf "Improper compilation occured for %s.\n" ${i} duke@1: exit 1 duke@1: fi duke@1: duke@1: done duke@1: duke@1: # check for mutliple methods and no static initializer duke@1: duke@1: ${APT} -XclassesAsDecls -cp ${TESTCLASSES} -print Aggregate > aggregate.txt jjg@387: diff ${DIFFOPTS} aggregate.txt ${TESTSRC}/goldenAggregate.txt duke@1: duke@1: RESULT=$? duke@1: case "$RESULT" in duke@1: 0 ) duke@1: ;; duke@1: duke@1: * ) duke@1: echo "Expected output not received" duke@1: exit 1 duke@1: esac duke@1: duke@1: exit 0