test/tools/javac/versionOpt.sh

Thu, 06 Mar 2008 10:07:25 -0800

author
jjg
date
Thu, 06 Mar 2008 10:07:25 -0800
changeset 9
f09d6a3521b1
parent 1
9a66ca7c79fa
permissions
-rw-r--r--

4741726: allow Object += String
Summary: remove code in line with restriction removed from JLS
Reviewed-by: mcimadamore
Contributed-by: michaelbailey0@gmail.com

     1 #!/bin/sh
     3 #
     4 # Copyright 2005 Sun Microsystems, Inc.  All Rights Reserved.
     5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6 #
     7 # This code is free software; you can redistribute it and/or modify it
     8 # under the terms of the GNU General Public License version 2 only, as
     9 # published by the Free Software Foundation.
    10 #
    11 # This code is distributed in the hope that it will be useful, but WITHOUT
    12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14 # version 2 for more details (a copy is included in the LICENSE file that
    15 # accompanied this code).
    16 #
    17 # You should have received a copy of the GNU General Public License version
    18 # 2 along with this work; if not, write to the Free Software Foundation,
    19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20 #
    21 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    22 # CA 95054 USA or visit www.sun.com if you need additional information or
    23 # have any questions.
    24 #
    27 # @test
    28 # @bug 4461214 6227587
    29 # @summary support-version and -fullversion
    30 # @run shell versionOpt.sh
    32 if [ "${TESTJAVA}" = "" ]
    33 then
    34   echo "TESTJAVA not set.  Test cannot execute.  Failed."
    35   exit 1
    36 fi
    37 echo "TESTJAVA=${TESTJAVA}"
    39 # set platform-dependent variables
    40 OS=`uname -s`
    41 case "$OS" in
    42   SunOS | Linux )
    43     NULL=/dev/null
    44     PS=":"
    45     FS="/"
    46     ;;
    47   Windows* )
    48     NULL=NUL
    49     PS=";"
    50     FS="\\"
    51     ;;
    52   * )
    53     echo "Unrecognized system!"
    54     exit 1;
    55     ;;
    56 esac
    58 # create reference files based on java values
    59 "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -version 2>&1 | \
    60     sed -e 's/java version "\([^"]*\)"/javac \1/' -e '2,$d' > version.ref.out
    62 "${TESTJAVA}${FS}bin${FS}java" ${TESTVMOPTS} -fullversion 2>&1 | \
    63     sed -e 's/java full version/javac full version/' -e '2,$d' > fullversion.ref.out
    65 # run javac
    66 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -version 2> version.out
    67 cat version.out
    68 diff -c version.ref.out version.out
    69 version_result=$?
    71 "${TESTJAVA}${FS}bin${FS}javac" ${TESTTOOLVMOPTS} -fullversion 2> fullversion.out
    72 cat fullversion.out
    73 diff -c fullversion.ref.out fullversion.out
    74 fullversion_result=$?
    76 if [ $version_result -eq 0 -a $fullversion_result -eq 0 ]
    77 then
    78   echo "Passed"
    79   exit 0
    80 else
    81   echo "Failed"
    82   exit 1
    83 fi

mercurial