test/tools/apt/Basics/print.sh

changeset 1
9a66ca7c79fa
child 142
e1332c04f6b6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/apt/Basics/print.sh	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,98 @@
     1.4 +#!/bin/sh
     1.5 +
     1.6 +#
     1.7 +# Copyright 2004-2007 Sun Microsystems, Inc.  All Rights Reserved.
     1.8 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.9 +#
    1.10 +# This code is free software; you can redistribute it and/or modify it
    1.11 +# under the terms of the GNU General Public License version 2 only, as
    1.12 +# published by the Free Software Foundation.
    1.13 +#
    1.14 +# This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 +# version 2 for more details (a copy is included in the LICENSE file that
    1.18 +# accompanied this code).
    1.19 +#
    1.20 +# You should have received a copy of the GNU General Public License version
    1.21 +# 2 along with this work; if not, write to the Free Software Foundation,
    1.22 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 +#
    1.24 +# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 +# CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 +# have any questions.
    1.27 +#
    1.28 +
    1.29 +# @test
    1.30 +# @bug 5008759 4998341 5018369 5032476 5060121 5096932 5096931
    1.31 +# @run shell ../verifyVariables.sh
    1.32 +# @build Aggregate
    1.33 +# @run shell print.sh
    1.34 +# @summary test availabilty of print option
    1.35 +# @author Joseph D. Darcy
    1.36 +
    1.37 +OS=`uname -s`;
    1.38 +case "${OS}" in
    1.39 +        Windows* | CYGWIN* )
    1.40 +                SEP=";"
    1.41 +        ;;
    1.42 +
    1.43 +	* )
    1.44 +	SEP=":"
    1.45 +	;;
    1.46 +esac
    1.47 +
    1.48 +# Construct path to apt executable
    1.49 +APT="${TESTJAVA}/bin/apt ${TESTTOOLVMOPTS} \
    1.50 +-print "
    1.51 +
    1.52 +printf "%s\n" "APT = ${APT}"
    1.53 +
    1.54 +PRINT_FILES="${TESTSRC}/MisMatch.java \
    1.55 +${TESTSRC}/GenClass.java \
    1.56 +${TESTSRC}/Misc.java \
    1.57 +${TESTSRC}/Lacuna.java"
    1.58 +
    1.59 +for i in ${PRINT_FILES}
    1.60 +do
    1.61 +	# Delete any existing class file
    1.62 +        FILENAME=`basename $i .java`
    1.63 +	rm -f ${FILENAME}.class
    1.64 +
    1.65 +        printf "%s\n" "Printing ${i}"
    1.66 +        ${APT} ${i}
    1.67 +
    1.68 +        RESULT=$?
    1.69 +        case "$RESULT" in
    1.70 +                0  )
    1.71 +                ;;
    1.72 +
    1.73 +                * )
    1.74 +                echo "Problem printing file ${i}."
    1.75 +                exit 1
    1.76 +        esac
    1.77 +
    1.78 +        # Verify compilation did not occur
    1.79 +	if [ -f ${FILENAME}.class ]; then
    1.80 +		printf "Improper compilation occured for %s.\n" ${i}
    1.81 +		exit 1
    1.82 +	fi
    1.83 +	
    1.84 +done
    1.85 +
    1.86 +# check for mutliple methods and no static initializer
    1.87 +
    1.88 +${APT} -XclassesAsDecls -cp ${TESTCLASSES} -print Aggregate > aggregate.txt
    1.89 +diff aggregate.txt ${TESTSRC}/goldenAggregate.txt
    1.90 +
    1.91 +RESULT=$?
    1.92 +case "$RESULT" in
    1.93 +        0  )
    1.94 +        ;;
    1.95 +
    1.96 +        * )
    1.97 +        echo "Expected output not received"
    1.98 +        exit 1
    1.99 +esac
   1.100 +
   1.101 +exit 0

mercurial