test/runtime/7116786/Test7116786.java

Fri, 22 Jul 2016 16:53:17 +0800

author
aoqi
date
Fri, 22 Jul 2016 16:53:17 +0800
changeset 39
72830a7941b2
parent 0
f90c822e73f8
child 6876
710a3c8b516e
permissions
-rw-r--r--

Added MIPS support in hotspot/test/test_env.sh

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 /*
aoqi@0 26 * @test Test7116786
aoqi@0 27 * @summary verify that VerifyError messages are as expected
aoqi@0 28 * @library testcases.jar
aoqi@0 29 * @run main/othervm -Xverify:all Test7116786
aoqi@0 30 */
aoqi@0 31
aoqi@0 32
aoqi@0 33 /**
aoqi@0 34 * This class contains information regarding when a VerifyError is thrown
aoqi@0 35 * in the verifier. Most of the data is informational-only, and can be
aoqi@0 36 * used to track down where and why VerifyErrors are thrown. As such it
aoqi@0 37 * is possible the information may go out-of-date.
aoqi@0 38 *
aoqi@0 39 * The only fields used for the purpose of testing is the 'caseName' and
aoqi@0 40 * the 'message'. The 'caseName' corresponds to a classfile which exhibits
aoqi@0 41 * the VerifyError, and the 'message' is a regular expression which we expect
aoqi@0 42 * to match the verify error message. If the 'message' doesn't match what
aoqi@0 43 * we expect, it warrents investigation to see if we are still triggering
aoqi@0 44 * the VerifyError that we expect. It could simply just be that the message
aoqi@0 45 * changed, which is fine.
aoqi@0 46 *
aoqi@0 47 * Some cases are not testable, either because the code is probably unreachable
aoqi@0 48 * or the test classfile would be too onerous to create. These cases are
aoqi@0 49 * marked with 'testable' == false, and the test runner will skip them.
aoqi@0 50 */
aoqi@0 51 class Case {
aoqi@0 52 private String caseName; // Name of the case
aoqi@0 53 private String file; // Source file where VerifyError is thrown
aoqi@0 54 private String location; // enclosing function or switch case
aoqi@0 55 private String description; // What causes this VerifyError
aoqi@0 56 private String message; // The VerifyError message used.
aoqi@0 57
aoqi@0 58 private boolean testable; // Whether this case is testable or not.
aoqi@0 59
aoqi@0 60 public Case(String caseName, String file, boolean testable,
aoqi@0 61 String location, String description, String message) {
aoqi@0 62 this.caseName = caseName;
aoqi@0 63 this.file = file;
aoqi@0 64 this.testable = testable;
aoqi@0 65 this.location = location;
aoqi@0 66 this.description = description;
aoqi@0 67 this.message = message;
aoqi@0 68 }
aoqi@0 69
aoqi@0 70 String getCaseName() { return this.caseName; }
aoqi@0 71 String getFile() { return this.file; }
aoqi@0 72 String getLocation() { return this.location; }
aoqi@0 73 String getDescription() { return this.description; }
aoqi@0 74 String getMessage() { return this.message; }
aoqi@0 75
aoqi@0 76 boolean isTestable() { return this.testable; }
aoqi@0 77 }
aoqi@0 78
aoqi@0 79 /**
aoqi@0 80 * These are the locations in the source code where VerifyErrors are thrown
aoqi@0 81 * as of today, 2012/07/18. These may change as the verification code is
aoqi@0 82 * modified, which is ok. This test is trying to provide coverage for all
aoqi@0 83 * VerifyErrors (just to make sure there are no crashes) and it's probably
aoqi@0 84 * not necessary to update it every time the VM changes.
aoqi@0 85 */
aoqi@0 86 class VerifyErrorCases {
aoqi@0 87 public static final Case[] cases = {
aoqi@0 88
aoqi@0 89 new Case("case00", "stackMapFrame.cpp", true, "pop_stack_ex",
aoqi@0 90 "stack underflow",
aoqi@0 91 "Operand stack underflow"),
aoqi@0 92
aoqi@0 93 new Case("case01", "stackMapFrame.cpp", true, "pop_stack_ex",
aoqi@0 94 "stack pop not assignable to expected",
aoqi@0 95 "Bad type on operand stack"),
aoqi@0 96
aoqi@0 97 new Case("case02", "stackMapFrame.cpp", true, "get_local",
aoqi@0 98 "local index out-of-bounds",
aoqi@0 99 "Local variable table overflow"),
aoqi@0 100
aoqi@0 101 new Case("case03", "stackMapFrame.cpp", true, "get_local",
aoqi@0 102 "local not assignable to expected",
aoqi@0 103 "Bad local variable type"),
aoqi@0 104
aoqi@0 105 new Case("case04", "stackMapFrame.cpp", true, "get_local_2",
aoqi@0 106 "local index out-of-bounds [type2]",
aoqi@0 107 "get long/double overflows locals"),
aoqi@0 108
aoqi@0 109 new Case("case05", "stackMapFrame.cpp", true, "get_local_2",
aoqi@0 110 "local not assignabled to expected [type2]",
aoqi@0 111 "Bad local variable type"),
aoqi@0 112
aoqi@0 113 /* Unreachable: Can't split long/double on stack */
aoqi@0 114 new Case("case06", "stackMapFrame.cpp", false, "get_local_2",
aoqi@0 115 "local second-word not assignabled to expected",
aoqi@0 116 "Bad local variable type"),
aoqi@0 117
aoqi@0 118 new Case("case07", "stackMapFrame.cpp", true, "set_local",
aoqi@0 119 "local index out-of-bounds",
aoqi@0 120 "Local variable table overflow"),
aoqi@0 121
aoqi@0 122 new Case("case08", "stackMapFrame.cpp", true, "set_local_2",
aoqi@0 123 "local index out-of-bounds [type2]",
aoqi@0 124 "Local variable table overflow"),
aoqi@0 125
aoqi@0 126 new Case("case09", "stackMapFrame.hpp", true, "push_stack",
aoqi@0 127 "stack overflow",
aoqi@0 128 "Operand stack overflow"),
aoqi@0 129
aoqi@0 130 new Case("case10", "stackMapFrame.hpp", true, "push_stack_2",
aoqi@0 131 "stack overflow [type2]",
aoqi@0 132 "Operand stack overflow"),
aoqi@0 133
aoqi@0 134 new Case("case11", "stackMapFrame.hpp", true, "pop_stack",
aoqi@0 135 "stack underflow",
aoqi@0 136 "Operand stack underflow"),
aoqi@0 137
aoqi@0 138 new Case("case12", "stackMapTable.cpp", true, "StackMapTable ctor",
aoqi@0 139 "stackmap offset beyond code size",
aoqi@0 140 "StackMapTable error: bad offset"),
aoqi@0 141
aoqi@0 142 new Case("case13", "stackMapTable.cpp", true, "match_stackmap",
aoqi@0 143 "no stackmap frame at expected location",
aoqi@0 144 "Expecting a stackmap frame at branch target "),
aoqi@0 145
aoqi@0 146 new Case("case14", "stackMapTable.cpp", true, "check_jump_target",
aoqi@0 147 "no stackmap frame at jump location or bad jump",
aoqi@0 148 "Inconsistent stackmap frames at branch target "),
aoqi@0 149
aoqi@0 150 /* Backward jump with uninit is allowed starting with JDK 8 */
aoqi@0 151 new Case("case15", "stackMapTable.cpp", false, "check_new_object",
aoqi@0 152 "backward jump with uninit",
aoqi@0 153 "Uninitialized object exists on backward branch "),
aoqi@0 154
aoqi@0 155 /* Unreachable: wide instructions verified during bytecode analysis */
aoqi@0 156 new Case("case16", "verifier.cpp", false, "loop header",
aoqi@0 157 "bad op in wide instruction",
aoqi@0 158 "Bad wide instruction"),
aoqi@0 159
aoqi@0 160 new Case("case17", "verifier.cpp", true, "case iaload",
aoqi@0 161 "TOS not X array",
aoqi@0 162 "Bad type on operand stack in iaload"),
aoqi@0 163
aoqi@0 164 new Case("case18", "verifier.cpp", true, "case baload",
aoqi@0 165 "TOS not X array",
aoqi@0 166 "Bad type on operand stack in baload"),
aoqi@0 167
aoqi@0 168 new Case("case19", "verifier.cpp", true, "case caload",
aoqi@0 169 "TOS not X array",
aoqi@0 170 "Bad type on operand stack in caload"),
aoqi@0 171
aoqi@0 172 new Case("case20", "verifier.cpp", true, "case saload",
aoqi@0 173 "TOS not X array",
aoqi@0 174 "Bad type on operand stack in saload"),
aoqi@0 175
aoqi@0 176 new Case("case21", "verifier.cpp", true, "case laload",
aoqi@0 177 "TOS not X array",
aoqi@0 178 "Bad type on operand stack in laload"),
aoqi@0 179
aoqi@0 180 new Case("case22", "verifier.cpp", true, "case faload",
aoqi@0 181 "TOS not X array",
aoqi@0 182 "Bad type on operand stack in faload"),
aoqi@0 183
aoqi@0 184 new Case("case23", "verifier.cpp", true, "case daload",
aoqi@0 185 "TOS not X array",
aoqi@0 186 "Bad type on operand stack in daload"),
aoqi@0 187
aoqi@0 188 new Case("case24", "verifier.cpp", true, "case aaload",
aoqi@0 189 "TOS not X array",
aoqi@0 190 "Bad type on operand stack in aaload"),
aoqi@0 191
aoqi@0 192 new Case("case25", "verifier.cpp", true, "case iastore",
aoqi@0 193 "TOS not int array",
aoqi@0 194 "Bad type on operand stack in iastore"),
aoqi@0 195
aoqi@0 196 new Case("case26", "verifier.cpp", true, "case bastore",
aoqi@0 197 "TOS not byte array",
aoqi@0 198 "Bad type on operand stack in bastore"),
aoqi@0 199
aoqi@0 200 new Case("case27", "verifier.cpp", true, "case castore",
aoqi@0 201 "TOS not char array",
aoqi@0 202 "Bad type on operand stack in castore"),
aoqi@0 203
aoqi@0 204 new Case("case28", "verifier.cpp", true, "case sastore",
aoqi@0 205 "TOS not short array",
aoqi@0 206 "Bad type on operand stack in sastore"),
aoqi@0 207
aoqi@0 208 new Case("case29", "verifier.cpp", true, "case lastore",
aoqi@0 209 "TOS not long array",
aoqi@0 210 "Bad type on operand stack in lastore"),
aoqi@0 211
aoqi@0 212 new Case("case30", "verifier.cpp", true, "case fastore",
aoqi@0 213 "TOS not float array",
aoqi@0 214 "Bad type on operand stack in fastore"),
aoqi@0 215
aoqi@0 216 new Case("case31", "verifier.cpp", true, "case dastore",
aoqi@0 217 "TOS not double array",
aoqi@0 218 "Bad type on operand stack in dastore"),
aoqi@0 219
aoqi@0 220 new Case("case32", "verifier.cpp", true, "case aastore",
aoqi@0 221 "TOS not object array",
aoqi@0 222 "Bad type on operand stack in aastore"),
aoqi@0 223
aoqi@0 224 /* Unreachable: In order to hit this case, we would need a
aoqi@0 225 * category2_1st at TOS which is not possible. */
aoqi@0 226 new Case("case33", "verifier.cpp", false, "case pop2",
aoqi@0 227 "TOS is category2_1st (would split)",
aoqi@0 228 "Bad type on operand stack in pop2"),
aoqi@0 229
aoqi@0 230 /* Unreachable: In order to hit this case, we would need a
aoqi@0 231 * category2_1st at stack depth 2 with category_1 on TOS which is not
aoqi@0 232 * possible. */
aoqi@0 233 new Case("case34", "verifier.cpp", false, "case dup_x2",
aoqi@0 234 "TOS-1 is category2_1st (would split)",
aoqi@0 235 "Bad type on operand stack in dup_x2"),
aoqi@0 236
aoqi@0 237 /* Unreachable: In order to hit this case, we would need a
aoqi@0 238 * category2_1st at TOS which is not possible. */
aoqi@0 239 new Case("case35", "verifier.cpp", false, "case dup2",
aoqi@0 240 "TOS-1 is category2_1st (would split)",
aoqi@0 241 "Bad type on operand stack in dup2"),
aoqi@0 242
aoqi@0 243 /* Unreachable: In order to hit this case, we would need a
aoqi@0 244 * category2_1st at TOS which is not possible. */
aoqi@0 245 new Case("case36", "verifier.cpp", false, "case dup2_x1",
aoqi@0 246 "TOS-1 is category2_1st (would split)",
aoqi@0 247 "Bad type on operand stack in dup2_x1"),
aoqi@0 248
aoqi@0 249 /* Unreachable: In order to hit this case, we would need a
aoqi@0 250 * category2_1st at TOS which is not possible. */
aoqi@0 251 new Case("case37", "verifier.cpp", false, "case dup2_x2",
aoqi@0 252 "TOS-1 is category2_1st (would split)",
aoqi@0 253 "Bad type on operand stack in dup2_x2"),
aoqi@0 254
aoqi@0 255 /* Unreachable: In order to hit this case, we would need a
aoqi@0 256 * category2_1st at stack depth 3 with either 2 category_1 or 1
aoqi@0 257 * category_2 on TOS, which is not possible. */
aoqi@0 258 new Case("case38", "verifier.cpp", false, "case dup2_x2",
aoqi@0 259 "TOS-3 is category2_1st (would split)",
aoqi@0 260 "Bad type on operand stack in dup2_x2"),
aoqi@0 261
aoqi@0 262 new Case("case39", "verifier.cpp", true, "case return",
aoqi@0 263 "return type of method is not void",
aoqi@0 264 "Method expects a return value"),
aoqi@0 265
aoqi@0 266 new Case("case40", "verifier.cpp", true, "case return",
aoqi@0 267 "return with uninitialized this ",
aoqi@0 268 "Constructor must call super() or this() before return"),
aoqi@0 269
aoqi@0 270 new Case("case41", "verifier.cpp", true, "case new",
aoqi@0 271 "cp index not a class type",
aoqi@0 272 "Illegal new instruction"),
aoqi@0 273
aoqi@0 274 new Case("case42", "verifier.cpp", true, "case arraylength",
aoqi@0 275 "TOS is not an array",
aoqi@0 276 "Bad type on operand stack in arraylength"),
aoqi@0 277
aoqi@0 278 new Case("case43", "verifier.cpp", true, "case multianewarray",
aoqi@0 279 "CP index does not refer to array type",
aoqi@0 280 "Illegal constant pool index in multianewarray instruction"),
aoqi@0 281
aoqi@0 282 new Case("case44", "verifier.cpp", true, "case multianewarray",
aoqi@0 283 "Bad dimension (<1) or does not match CP signature",
aoqi@0 284 "Illegal dimension in multianewarray instruction: "),
aoqi@0 285
aoqi@0 286 new Case("case45", "verifier.cpp", true, "case default",
aoqi@0 287 "Unrecognized bytecode",
aoqi@0 288 "Bad instruction: "),
aoqi@0 289
aoqi@0 290 new Case("case46", "verifier.cpp", true, "loop end",
aoqi@0 291 "control flow falls off method",
aoqi@0 292 "Control flow falls through code end"),
aoqi@0 293
aoqi@0 294 new Case("case47", "verifier.cpp", true, "generate_code_data",
aoqi@0 295 "illegal bytecode via RawBytecodeStream (breakpoint)",
aoqi@0 296 "Bad instruction"),
aoqi@0 297
aoqi@0 298 new Case("case48", "verifier.cpp", true, "generate_code_data",
aoqi@0 299 "illegal bytecode via RawBytecodeStream (other illegal)",
aoqi@0 300 "Bad instruction"),
aoqi@0 301
aoqi@0 302 new Case("case49", "verifier.cpp", true,
aoqi@0 303 "verify_exception_handler_table",
aoqi@0 304 "catch_type is not throwable",
aoqi@0 305 "Catch type is not a subclass of Throwable in " +
aoqi@0 306 "exception handler "),
aoqi@0 307
aoqi@0 308 new Case("case50", "verifier.cpp", true, "verify_stackmap_table",
aoqi@0 309 "missing a stack map frame @ target location (mid table)",
aoqi@0 310 "Expecting a stack map frame"),
aoqi@0 311
aoqi@0 312 new Case("case51", "verifier.cpp", true, "verify_stackmap_table",
aoqi@0 313 "stack map does not match?",
aoqi@0 314 "Instruction type does not match stack map"),
aoqi@0 315
aoqi@0 316 new Case("case52", "verifier.cpp", true, "verify_stackmap_table",
aoqi@0 317 "missing a stack map frame @ target location (end of table)",
aoqi@0 318 "Expecting a stack map frame"),
aoqi@0 319
aoqi@0 320 new Case("case53", "verifier.cpp", true,
aoqi@0 321 "verify_exception_handler_targets",
aoqi@0 322 "stackmap mismatch at exception handler",
aoqi@0 323 "Stack map does not match the one at exception handler "),
aoqi@0 324
aoqi@0 325 new Case("case54", "verifier.cpp", true, "verify_cp_index",
aoqi@0 326 "constant pool index is out-of-bounds",
aoqi@0 327 "Illegal constant pool index "),
aoqi@0 328
aoqi@0 329 new Case("case55", "verifier.cpp", true, "verify_cp_type",
aoqi@0 330 "constant pool entry is not expected type",
aoqi@0 331 "Illegal type at constant pool entry "),
aoqi@0 332
aoqi@0 333 new Case("case56", "verifier.cpp", true, "verify_cp_class_type",
aoqi@0 334 "constant pool entry is not an object type",
aoqi@0 335 "Illegal type at constant pool entry "),
aoqi@0 336
aoqi@0 337 /* Unreachable: verify_cp_type gates this case */
aoqi@0 338 new Case("case57", "verifier.cpp", false, "verify_ldc",
aoqi@0 339 "invalid constant pool index in ldc",
aoqi@0 340 "Invalid index in ldc"),
aoqi@0 341
aoqi@0 342 /* No longer a valid test case for bytecode version >= 51. Nonzero
aoqi@0 343 * padding bytes are permitted with lookupswitch and tableswitch
aoqi@0 344 * bytecodes as of JVMS 3d edition */
aoqi@0 345 new Case("case58", "verifier.cpp", false, "verify_switch",
aoqi@0 346 "bad switch padding",
aoqi@0 347 "Nonzero padding byte in lookupswitch or tableswitch"),
aoqi@0 348
aoqi@0 349 new Case("case59", "verifier.cpp", true, "verify_switch",
aoqi@0 350 "tableswitch low is greater than high",
aoqi@0 351 "low must be less than or equal to high in tableswitch"),
aoqi@0 352
aoqi@0 353 /* Unreachable on 64-bit? Only way to get here is to overflow
aoqi@0 354 * the 'keys' variable which can't happen on 64-bit since we're dealing
aoqi@0 355 * with 32-bit values. Perhaps reachable on 32-bit but the
aoqi@0 356 * triggering class would be quite large */
aoqi@0 357 new Case("case60", "verifier.cpp", false, "verify_switch",
aoqi@0 358 "high - low + 1 < 0 (overflow?)",
aoqi@0 359 "too many keys in tableswitch"),
aoqi@0 360
aoqi@0 361 /* Would have to create a 16G classfile to trip this. Possible but
aoqi@0 362 * not reasonable to do in a test. */
aoqi@0 363 new Case("case61", "verifier.cpp", false, "verify_switch",
aoqi@0 364 "lookupswitch keys < 0",
aoqi@0 365 "number of keys in lookupswitch less than 0"),
aoqi@0 366
aoqi@0 367 new Case("case62", "verifier.cpp", true, "verify_switch",
aoqi@0 368 "lookupswitch keys out-of-order",
aoqi@0 369 "Bad lookupswitch instruction"),
aoqi@0 370
aoqi@0 371 /* Unreachable: Class file parser verifies Fieldref contents */
aoqi@0 372 new Case("case63", "verifier.cpp", false, "verify_field_instructions",
aoqi@0 373 "referenced class is not an CP object",
aoqi@0 374 "Expecting reference to class in class "),
aoqi@0 375
aoqi@0 376 new Case("case64", "verifier.cpp", true, "verify_field_instructions",
aoqi@0 377 "TOS not assignable to field type in putfield",
aoqi@0 378 "Bad type on operand stack in putfield"),
aoqi@0 379
aoqi@0 380 new Case("case65", "verifier.cpp", true, "verify_field_instructions",
aoqi@0 381 "TOS not assignable to class when accessing protected field",
aoqi@0 382 "Bad access to protected data in getfield"),
aoqi@0 383
aoqi@0 384 new Case("case66", "verifier.cpp", true, "verify_invoke_init",
aoqi@0 385 "Uninit_this is not of the current type or it's supertype",
aoqi@0 386 "Bad <init> method call"),
aoqi@0 387
aoqi@0 388 /* Unreachable: Stack map parsing ensures valid type and new
aoqi@0 389 * instructions have a valid BCI. */
aoqi@0 390 new Case("case67", "verifier.cpp", false, "verify_invoke_init",
aoqi@0 391 "Uninit type with bad new instruction index",
aoqi@0 392 "Expecting new instruction"),
aoqi@0 393
aoqi@0 394 new Case("case68", "verifier.cpp", true, "verify_invoke_init",
aoqi@0 395 "calling other class's <init> method",
aoqi@0 396 "Call to wrong <init> method"),
aoqi@0 397
aoqi@0 398 new Case("case69", "verifier.cpp", true, "verify_invoke_init",
aoqi@0 399 "Calling protected <init> and type unassignable from current",
aoqi@0 400 "Bad access to protected <init> method"),
aoqi@0 401
aoqi@0 402 new Case("case70", "verifier.cpp", true, "verify_invoke_init",
aoqi@0 403 "TOS is not an uninitialized (or Uninit_this) type",
aoqi@0 404 "Bad operand type when invoking <init>"),
aoqi@0 405
aoqi@0 406 new Case("case71", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 407 "Arg count in instruction doesn't match signature",
aoqi@0 408 "Inconsistent args count operand in invokeinterface"),
aoqi@0 409
aoqi@0 410 new Case("case72", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 411 "Non-zero pad in invokeinterface",
aoqi@0 412 "Fourth operand byte of invokeinterface must be zero"),
aoqi@0 413
aoqi@0 414 new Case("case73", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 415 "Non-zero pad in invokedynamic",
aoqi@0 416 "Third and fourth operand bytes of " +
aoqi@0 417 "invokedynamic must be zero"),
aoqi@0 418
aoqi@0 419 new Case("case74", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 420 "Non-invokespecial trying to invoke a '<' method",
aoqi@0 421 "Illegal call to internal method"),
aoqi@0 422
aoqi@0 423 new Case("case75", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 424 "invokespecial and current unassignable from referenced type",
aoqi@0 425 "Bad invokespecial instruction: current class isn't " +
aoqi@0 426 "assignable to reference class."),
aoqi@0 427
aoqi@0 428 new Case("case76", "verifier.cpp", true, "verify_invoke_instructions",
aoqi@0 429 "TOS not assignable to current when calling protected method",
aoqi@0 430 "Bad access to protected data in invokevirtual"),
aoqi@0 431
aoqi@0 432 /* Unreachable: class file parser enforces void signature */
aoqi@0 433 new Case("case77", "verifier.cpp", false, "verify_invoke_instructions",
aoqi@0 434 "<init> method is not void return",
aoqi@0 435 "Return type must be void in <init> method"),
aoqi@0 436
aoqi@0 437 new Case("case78", "verifier.cpp", true, "get_newarray_type",
aoqi@0 438 "newarray type invalid",
aoqi@0 439 "Illegal newarray instruction"),
aoqi@0 440
aoqi@0 441 new Case("case79", "verifier.cpp", true, "verify_return_value",
aoqi@0 442 "void return from method which has a return value",
aoqi@0 443 "Method expects a return value"),
aoqi@0 444
aoqi@0 445 new Case("case80", "verifier.cpp", true, "verify_return_value",
aoqi@0 446 "TOS type does not match signature",
aoqi@0 447 "Bad return type"),
aoqi@0 448
aoqi@0 449 new Case("case81", "verifier.cpp", true, "verify_stackmap_table",
aoqi@0 450 "stack map does not match (flags)",
aoqi@0 451 "Instruction type does not match stack map")
aoqi@0 452 };
aoqi@0 453 }
aoqi@0 454
aoqi@0 455 public class Test7116786 {
aoqi@0 456 public static void main(String argv[]) throws Exception {
aoqi@0 457 for (Case c : VerifyErrorCases.cases) {
aoqi@0 458 System.out.println("******** " + c.getCaseName() + " ********");
aoqi@0 459 if (c.isTestable()) {
aoqi@0 460 try {
aoqi@0 461 ClassLoader cl = Test7116786.class.getClassLoader();
aoqi@0 462 Class<?> cls = Class.forName(c.getCaseName(), true, cl);
aoqi@0 463 throw new RuntimeException(
aoqi@0 464 "++ FAIL: No verify error encountered");
aoqi@0 465 } catch (VerifyError ve) {
aoqi@0 466 String message = c.getMessage();
aoqi@0 467 String veMessage = ve.getMessage();
aoqi@0 468 System.out.print(veMessage);
aoqi@0 469 if (!veMessage.startsWith(message)) {
aoqi@0 470 // We're not seeing the message we expect. Could be
aoqi@0 471 // that we've gotten the wrong VerifyError case, or
aoqi@0 472 // maybe the message changed.
aoqi@0 473 System.out.println("++ FAIL? " +
aoqi@0 474 "Message does not match what was expected: " +
aoqi@0 475 message);
aoqi@0 476 continue;
aoqi@0 477 }
aoqi@0 478 if (!veMessage.contains("Exception Details:") &&
aoqi@0 479 !veMessage.contains("Reason:")) {
aoqi@0 480 System.out.println("++ FAIL: No details found");
aoqi@0 481 throw new RuntimeException("FAIL: No details found");
aoqi@0 482 }
aoqi@0 483 System.out.println("++ PASS");
aoqi@0 484 }
aoqi@0 485 } else {
aoqi@0 486 System.out.println("++ SKIPPED");
aoqi@0 487 }
aoqi@0 488 }
aoqi@0 489 }
aoqi@0 490 }

mercurial