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