7162488: VM not printing unknown -XX options

Fri, 20 Apr 2012 14:55:45 +0100

author
kevinw
date
Fri, 20 Apr 2012 14:55:45 +0100
changeset 3721
f3a4ee95783b
parent 3709
0105f367a14c
child 3722
29ee40a082d3

7162488: VM not printing unknown -XX options
Reviewed-by: dholmes, kamg

src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
test/runtime/7162488/Test7162488.sh file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/runtime/arguments.cpp	Tue Mar 06 12:36:59 2012 +0100
     1.2 +++ b/src/share/vm/runtime/arguments.cpp	Fri Apr 20 14:55:45 2012 +0100
     1.3 @@ -829,6 +829,9 @@
     1.4      } else {
     1.5        jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
     1.6      }
     1.7 +  } else {
     1.8 +    jio_fprintf(defaultStream::error_stream(),
     1.9 +                "Unrecognized VM option '%s'\n", argname);
    1.10    }
    1.11  
    1.12    // allow for commandline "commenting out" options like -XX:#+Verbose
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/runtime/7162488/Test7162488.sh	Fri Apr 20 14:55:45 2012 +0100
     2.3 @@ -0,0 +1,77 @@
     2.4 +#
     2.5 +#  Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
     2.6 +#  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 +#
     2.8 +#  This code is free software; you can redistribute it and/or modify it
     2.9 +#  under the terms of the GNU General Public License version 2 only, as
    2.10 +#  published by the Free Software Foundation.
    2.11 +#
    2.12 +#  This code is distributed in the hope that it will be useful, but WITHOUT
    2.13 +#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.14 +#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.15 +#  version 2 for more details (a copy is included in the LICENSE file that
    2.16 +#  accompanied this code).
    2.17 +#
    2.18 +#  You should have received a copy of the GNU General Public License version
    2.19 +#  2 along with this work; if not, write to the Free Software Foundation,
    2.20 +#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.21 +#
    2.22 +#  Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.23 +#  or visit www.oracle.com if you need additional information or have any
    2.24 +#  questions.
    2.25 +#
    2.26 +
    2.27 +
    2.28 +# @test Test7162488.sh
    2.29 +# @bug 7162488
    2.30 +# @summary VM not printing unknown -XX options
    2.31 +# @run shell Test7162488.sh
    2.32 +#
    2.33 +
    2.34 +if [ "${TESTSRC}" = "" ]
    2.35 +  then TESTSRC=.
    2.36 +fi
    2.37 +
    2.38 +if [ "${TESTJAVA}" = "" ]
    2.39 +then
    2.40 +  PARENT=`dirname \`which java\``
    2.41 +  TESTJAVA=`dirname ${PARENT}`
    2.42 +  printf "TESTJAVA not set, selecting " ${TESTJAVA}
    2.43 +  printf "  If this is incorrect, try setting the variable manually.\n"
    2.44 +fi
    2.45 +
    2.46 +# set platform-dependent variables
    2.47 +OS=`uname -s`
    2.48 +case "$OS" in
    2.49 +  Windows_* )
    2.50 +    FS="\\"
    2.51 +    ;;
    2.52 +  * )
    2.53 +    FS="/"
    2.54 +    ;;
    2.55 +esac
    2.56 +
    2.57 +JAVA=${TESTJAVA}${FS}bin${FS}java
    2.58 +
    2.59 +#
    2.60 +# Just run with an option we are confident will not be recognized,
    2.61 +# and check for the message:
    2.62 +#
    2.63 +OPTION=this_is_not_an_option
    2.64 +
    2.65 +${JAVA} ${TESTVMOPTS} -showversion -XX:${OPTION} 2>&1 | grep "Unrecognized VM option" 
    2.66 +if [ "$?" != "0" ]
    2.67 +then
    2.68 +  printf "FAILED: option not flagged as unrecognized.\n"
    2.69 +  exit 1
    2.70 +fi
    2.71 +
    2.72 +${JAVA} ${TESTVMOPTS} -showversion -XX:${OPTION} 2>&1 | grep ${OPTION}
    2.73 +if [ "$?" != "0" ]
    2.74 +then
    2.75 +  printf "FAILED: bad option not named as being bad.\n"
    2.76 +  exit 1
    2.77 +fi
    2.78 +
    2.79 +printf "Passed.\n"
    2.80 +

mercurial