1 /* 2 * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 /* 26 * @test 27 * @summary "AOT" aliases for traditional CDS command-line options 28 * @requires vm.cds 29 * @requires vm.flagless 30 * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds/test-classes 31 * @build Hello 32 * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar hello.jar Hello 33 * @run driver AOTFlags 34 */ 35 36 import java.io.File; 37 import jdk.test.lib.cds.CDSTestUtils; 38 import jdk.test.lib.helpers.ClassFileInstaller; 39 import jdk.test.lib.process.OutputAnalyzer; 40 import jdk.test.lib.process.ProcessTools; 41 42 public class AOTFlags { 43 static String appJar = ClassFileInstaller.getJarPath("hello.jar"); 44 static String aotConfigFile = "hello.aotconfig"; 45 static String aotCacheFile = "hello.aot"; 46 static String helloClass = "Hello"; 47 48 public static void main(String[] args) throws Exception { 49 positiveTests(); 50 negativeTests(); 51 } 52 53 static void positiveTests() throws Exception { 54 //---------------------------------------------------------------------- 55 printTestCase("Training Run"); 56 ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( 57 "-XX:AOTMode=record", 58 "-XX:AOTConfiguration=" + aotConfigFile, 59 "-Xlog:aot=debug", 60 "-cp", appJar, helloClass); 61 62 OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "train"); 63 out.shouldContain("Hello World"); 64 out.shouldContain("AOTConfiguration recorded: " + aotConfigFile); 65 out.shouldHaveExitValue(0); 66 67 //---------------------------------------------------------------------- 68 printTestCase("Assembly Phase (AOTClassLinking unspecified -> should be enabled by default)"); 69 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 70 "-XX:AOTMode=create", 71 "-XX:AOTConfiguration=" + aotConfigFile, 72 "-XX:AOTCache=" + aotCacheFile, 73 "-Xlog:aot", 74 "-cp", appJar); 75 out = CDSTestUtils.executeAndLog(pb, "asm"); 76 out.shouldContain("AOTCache creation is complete"); 77 out.shouldMatch("hello[.]aot"); 78 out.shouldHaveExitValue(0); 79 80 //---------------------------------------------------------------------- 81 printTestCase("Production Run with AOTCache"); 82 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 83 "-XX:AOTCache=" + aotCacheFile, 84 "-Xlog:aot", 85 "-cp", appJar, helloClass); 86 out = CDSTestUtils.executeAndLog(pb, "prod"); 87 out.shouldContain("Using AOT-linked classes: true (static archive: has aot-linked classes)"); 88 out.shouldContain("Opened AOT cache hello.aot."); 89 out.shouldContain("Hello World"); 90 out.shouldHaveExitValue(0); 91 92 //---------------------------------------------------------------------- 93 printTestCase("AOTMode=off"); 94 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 95 "-XX:AOTCache=" + aotCacheFile, 96 "--show-version", 97 "-Xlog:aot", 98 "-XX:AOTMode=off", 99 "-cp", appJar, helloClass); 100 out = CDSTestUtils.executeAndLog(pb, "prod"); 101 out.shouldNotContain(", sharing"); 102 out.shouldNotContain("Opened AOT cache hello.aot."); 103 out.shouldContain("Hello World"); 104 out.shouldHaveExitValue(0); 105 106 //---------------------------------------------------------------------- 107 printTestCase("AOTMode=auto"); 108 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 109 "-XX:AOTCache=" + aotCacheFile, 110 "--show-version", 111 "-Xlog:aot", 112 "-XX:AOTMode=auto", 113 "-cp", appJar, helloClass); 114 out = CDSTestUtils.executeAndLog(pb, "prod"); 115 out.shouldContain(", sharing"); 116 out.shouldContain("Opened AOT cache hello.aot."); 117 out.shouldContain("Hello World"); 118 out.shouldHaveExitValue(0); 119 120 //---------------------------------------------------------------------- 121 printTestCase("AOTMode=on"); 122 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 123 "-XX:AOTCache=" + aotCacheFile, 124 "--show-version", 125 "-Xlog:aot", 126 "-XX:AOTMode=on", 127 "-cp", appJar, helloClass); 128 out = CDSTestUtils.executeAndLog(pb, "prod"); 129 out.shouldContain(", sharing"); 130 out.shouldContain("Opened AOT cache hello.aot."); 131 out.shouldContain("Hello World"); 132 out.shouldHaveExitValue(0); 133 134 //---------------------------------------------------------------------- 135 printTestCase("Assembly Phase with -XX:-AOTClassLinking"); 136 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 137 "-XX:AOTMode=create", 138 "-XX:-AOTClassLinking", 139 "-XX:AOTConfiguration=" + aotConfigFile, 140 "-XX:AOTCache=" + aotCacheFile, 141 "-Xlog:aot", 142 "-cp", appJar); 143 out = CDSTestUtils.executeAndLog(pb, "asm"); 144 out.shouldContain("AOTCache creation is complete"); 145 out.shouldMatch("hello[.]aot"); 146 out.shouldHaveExitValue(0); 147 148 //---------------------------------------------------------------------- 149 printTestCase("Production Run with AOTCache, which was created with -XX:-AOTClassLinking"); 150 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 151 "-XX:AOTCache=" + aotCacheFile, 152 "-Xlog:aot", 153 "-cp", appJar, helloClass); 154 out = CDSTestUtils.executeAndLog(pb, "prod"); 155 out.shouldContain("Using AOT-linked classes: false (static archive: no aot-linked classes)"); 156 out.shouldContain("Opened AOT cache hello.aot."); 157 out.shouldContain("Hello World"); 158 out.shouldHaveExitValue(0); 159 160 //---------------------------------------------------------------------- 161 printTestCase("Training run with -XX:-AOTClassLinking, but assembly run with -XX:+AOTClassLinking"); 162 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 163 "-XX:AOTMode=record", 164 "-XX:-AOTClassLinking", 165 "-XX:AOTConfiguration=" + aotConfigFile, 166 "-Xlog:aot=debug", 167 "-cp", appJar, helloClass); 168 out = CDSTestUtils.executeAndLog(pb, "train"); 169 out.shouldContain("Hello World"); 170 out.shouldContain("AOTConfiguration recorded: " + aotConfigFile); 171 out.shouldHaveExitValue(0); 172 173 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 174 "-XX:AOTMode=create", 175 "-XX:+AOTClassLinking", 176 "-XX:AOTConfiguration=" + aotConfigFile, 177 "-XX:AOTCache=" + aotCacheFile, 178 "-Xlog:aot=debug", 179 "-cp", appJar); 180 out = CDSTestUtils.executeAndLog(pb, "asm"); 181 out.shouldContain("Writing AOTCache file:"); 182 out.shouldMatch("aot.*hello[.]aot"); 183 out.shouldHaveExitValue(0); 184 185 //---------------------------------------------------------------------- 186 printTestCase("One step training run (JEP-514"); 187 188 // Set all AOTMode/AOTCacheOutput/AOTConfiguration 189 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 190 "-XX:AOTMode=record", 191 "-XX:AOTCacheOutput=" + aotCacheFile, 192 "-XX:AOTConfiguration=" + aotConfigFile, 193 "-Xlog:aot=debug", 194 "-cp", appJar, helloClass); 195 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 196 out.shouldContain("Hello World"); 197 out.shouldContain("AOTConfiguration recorded: " + aotConfigFile); 198 out.shouldContain("AOTCache creation is complete: hello.aot"); 199 out.shouldHaveExitValue(0); 200 201 // Set AOTCacheOutput/AOTConfiguration only; Ergo for: AOTMode=record 202 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 203 "-XX:AOTCacheOutput=" + aotCacheFile, 204 "-XX:AOTConfiguration=" + aotConfigFile, 205 "-Xlog:aot=debug", 206 "-cp", appJar, helloClass); 207 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 208 out.shouldContain("Hello World"); 209 out.shouldContain("AOTConfiguration recorded: " + aotConfigFile); 210 out.shouldContain("AOTCache creation is complete: hello.aot"); 211 out.shouldHaveExitValue(0); 212 213 // Set AOTCacheOutput/AOTConfiguration/AOTMode=auto; Ergo changes: AOTMode=record 214 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 215 "-XX:AOTMode=auto", 216 "-XX:AOTCacheOutput=" + aotCacheFile, 217 "-XX:AOTConfiguration=" + aotConfigFile, 218 "-Xlog:aot=debug", 219 "-cp", appJar, helloClass); 220 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 221 out.shouldContain("Hello World"); 222 out.shouldContain("AOTConfiguration recorded: " + aotConfigFile); 223 out.shouldContain("AOTCache creation is complete: hello.aot"); 224 out.shouldHaveExitValue(0); 225 226 // Set AOTCacheOutput only; Ergo for: AOTMode=record, AOTConfiguration=<temp> 227 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 228 "-XX:AOTCacheOutput=" + aotCacheFile, 229 "-Xlog:aot=debug", 230 "-cp", appJar, helloClass); 231 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 232 out.shouldContain("Hello World"); 233 out.shouldContain("Temporary AOTConfiguration recorded: " + aotCacheFile + ".config"); 234 out.shouldContain("AOTCache creation is complete: hello.aot"); 235 out.shouldHaveExitValue(0); 236 237 // Set AOTCacheOutput/AOTMode=auto only; Ergo for: AOTMode=record, AOTConfiguration=<temp> 238 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 239 "-XX:AOTMode=auto", 240 "-XX:AOTCacheOutput=" + aotCacheFile, 241 "-Xlog:aot=debug", 242 "-cp", appJar, helloClass); 243 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 244 out.shouldContain("Hello World"); 245 out.shouldContain("Temporary AOTConfiguration recorded: " + aotCacheFile + ".config"); 246 out.shouldContain("AOTCache creation is complete: hello.aot"); 247 out.shouldHaveExitValue(0); 248 249 // Quoating of space characters in child JVM process 250 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 251 "-XX:AOTCacheOutput=" + aotCacheFile, 252 "-Dmy.prop=My string -Xshare:off here", // -Xshare:off should not be treated as a single VM opt for the child JVM 253 "-Xlog:aot=debug", 254 "-cp", appJar, helloClass); 255 out = CDSTestUtils.executeAndLog(pb, "ontstep-train"); 256 out.shouldContain("Hello World"); 257 out.shouldContain("AOTCache creation is complete: hello.aot"); 258 out.shouldMatch("Picked up JAVA_TOOL_OPTIONS:.* -Dmy.prop=My' 'string' '-Xshare:off' 'here"); 259 out.shouldHaveExitValue(0); 260 261 // Training run with -XX:+PrintTieredEvents (see JDK-8362530). 262 printTestCase("Training run with -XX:+PrintTieredEvents"); 263 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 264 "-XX:AOTMode=record", 265 "-XX:+PrintTieredEvents", 266 "-XX:AOTConfiguration=" + aotConfigFile, 267 "-cp", appJar, helloClass); 268 out = CDSTestUtils.executeAndLog(pb, "train-with-tiered-events"); 269 out.shouldHaveExitValue(0); 270 } 271 272 static void negativeTests() throws Exception { 273 //---------------------------------------------------------------------- 274 printTestCase("Mixing old and new options"); 275 String mixOldNewErrSuffix = " cannot be used at the same time with -Xshare:on, -Xshare:auto, " 276 + "-Xshare:off, -Xshare:dump, DumpLoadedClassList, SharedClassListFile, " 277 + "or SharedArchiveFile"; 278 279 ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( 280 "-Xshare:off", 281 "-XX:AOTConfiguration=" + aotConfigFile, 282 "-cp", appJar, helloClass); 283 284 OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "neg"); 285 out.shouldContain("Option AOTConfiguration" + mixOldNewErrSuffix); 286 out.shouldNotHaveExitValue(0); 287 288 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 289 "-XX:SharedArchiveFile=" + aotCacheFile, 290 "-XX:AOTCache=" + aotCacheFile, 291 "-cp", appJar, helloClass); 292 out = CDSTestUtils.executeAndLog(pb, "neg"); 293 out.shouldContain("Option AOTCache" + mixOldNewErrSuffix); 294 out.shouldNotHaveExitValue(0); 295 296 //---------------------------------------------------------------------- 297 printTestCase("Use AOTConfiguration without AOTMode/AOTCacheOutput"); 298 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 299 "-XX:AOTConfiguration=" + aotConfigFile, 300 "-cp", appJar, helloClass); 301 302 out = CDSTestUtils.executeAndLog(pb, "neg"); 303 out.shouldContain("AOTConfiguration can only be used with when AOTMode is record or create (selected AOTMode = auto)"); 304 out.shouldNotHaveExitValue(0); 305 306 //---------------------------------------------------------------------- 307 printTestCase("Use AOTConfiguration with AOTMode=on"); 308 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 309 "-XX:AOTMode=on", 310 "-XX:AOTConfiguration=" + aotConfigFile, 311 "-cp", appJar, helloClass); 312 313 out = CDSTestUtils.executeAndLog(pb, "neg"); 314 out.shouldContain("AOTConfiguration can only be used with when AOTMode is record or create (selected AOTMode = on)"); 315 out.shouldNotHaveExitValue(0); 316 317 //---------------------------------------------------------------------- 318 printTestCase("Use AOTMode without AOTCacheOutput or AOTConfiguration"); 319 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 320 "-XX:AOTMode=record", 321 "-cp", appJar, helloClass); 322 323 out = CDSTestUtils.executeAndLog(pb, "neg"); 324 out.shouldContain("At least one of AOTCacheOutput and AOTConfiguration must be specified when using -XX:AOTMode=record"); 325 326 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 327 "-XX:AOTMode=create", 328 "-cp", appJar, helloClass); 329 330 out = CDSTestUtils.executeAndLog(pb, "neg"); 331 out.shouldContain("AOTConfiguration must be specified when using -XX:AOTMode=create"); 332 out.shouldNotHaveExitValue(0); 333 334 //---------------------------------------------------------------------- 335 printTestCase("Bad AOTMode"); 336 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 337 "-XX:AOTMode=foo", 338 "-cp", appJar, helloClass); 339 340 out = CDSTestUtils.executeAndLog(pb, "neg"); 341 out.shouldContain("Unrecognized value foo for AOTMode. Must be one of the following: off, record, create, auto, on"); 342 out.shouldNotHaveExitValue(0); 343 344 //---------------------------------------------------------------------- 345 printTestCase("AOTCache specified with -XX:AOTMode=record"); 346 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 347 "-XX:AOTMode=record", 348 "-XX:AOTConfiguration=" + aotConfigFile, 349 "-XX:AOTCache=" + aotCacheFile, 350 "-cp", appJar, helloClass); 351 352 out = CDSTestUtils.executeAndLog(pb, "neg"); 353 out.shouldContain("AOTCache must not be specified when using -XX:AOTMode=record"); 354 out.shouldNotHaveExitValue(0); 355 356 //---------------------------------------------------------------------- 357 printTestCase("AOTCache/AOTCacheOutput not specified with -XX:AOTMode=create"); 358 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 359 "-XX:AOTMode=create", 360 "-XX:AOTConfiguration=" + aotConfigFile, 361 "-cp", appJar, helloClass); 362 363 out = CDSTestUtils.executeAndLog(pb, "neg"); 364 out.shouldContain("AOTCache or AOTCacheOutput must be specified when using -XX:AOTMode=create"); 365 out.shouldNotHaveExitValue(0); 366 367 //---------------------------------------------------------------------- 368 printTestCase("AOTCache and AOTCacheOutput have different values"); 369 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 370 "-XX:AOTMode=create", 371 "-XX:AOTConfiguration=" + aotConfigFile, 372 "-XX:AOTCache=aaa", 373 "-XX:AOTCacheOutput=aaa", 374 "-cp", appJar, helloClass); 375 376 out = CDSTestUtils.executeAndLog(pb, "neg"); 377 out.shouldContain("Only one of AOTCache or AOTCacheOutput can be specified"); 378 out.shouldNotHaveExitValue(0); 379 380 //---------------------------------------------------------------------- 381 printTestCase("No such config file"); 382 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 383 "-XX:AOTMode=create", 384 "-XX:AOTConfiguration=no-such-file", 385 "-XX:AOTCache=" + aotCacheFile, 386 "-cp", appJar, helloClass); 387 388 out = CDSTestUtils.executeAndLog(pb, "neg"); 389 out.shouldContain("Must be a valid AOT configuration generated by the current JVM: no-such-file"); 390 out.shouldNotHaveExitValue(0); 391 392 //---------------------------------------------------------------------- 393 printTestCase("AOTConfiguration file cannot be used as a CDS archive"); 394 395 // first make sure we have a valid aotConfigFile 396 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 397 "-XX:AOTMode=record", 398 "-XX:AOTConfiguration=" + aotConfigFile, 399 "-cp", appJar, helloClass); 400 401 out = CDSTestUtils.executeAndLog(pb, "train"); 402 out.shouldHaveExitValue(0); 403 404 // Cannot use this config file as a AOT cache 405 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 406 "-XX:AOTMode=on", 407 "-XX:AOTCache=" + aotConfigFile, 408 "-cp", appJar, helloClass); 409 410 out = CDSTestUtils.executeAndLog(pb, "neg"); 411 out.shouldContain("Not a valid AOT cache (hello.aotconfig)"); 412 out.shouldNotHaveExitValue(0); 413 414 // Cannot use this config file as a CDS archive 415 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 416 "-Xshare:on", 417 "-XX:SharedArchiveFile=" + aotConfigFile, 418 "-cp", appJar, helloClass); 419 420 out = CDSTestUtils.executeAndLog(pb, "neg"); 421 out.shouldContain("Not a valid shared archive file (hello.aotconfig)"); 422 out.shouldNotHaveExitValue(0); 423 424 //---------------------------------------------------------------------- 425 printTestCase("Classpath mismatch when creating archive"); 426 427 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 428 "-XX:AOTMode=create", 429 "-XX:AOTConfiguration=" + aotConfigFile, 430 "-XX:AOTCache=" + aotCacheFile, 431 "-cp", "noSuchJar.jar"); 432 433 out = CDSTestUtils.executeAndLog(pb, "neg"); 434 out.shouldContain("class path and/or module path are not compatible with the ones " + 435 "specified when the AOTConfiguration file was recorded"); 436 out.shouldContain("Unable to use create AOT cache"); 437 out.shouldHaveExitValue(1); 438 439 //---------------------------------------------------------------------- 440 printTestCase("Cannot use multiple paths in AOTConfiguration"); 441 442 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 443 "-XX:AOTMode=record", 444 "-XX:AOTConfiguration=" + aotConfigFile + File.pathSeparator + "dummy", 445 "-cp", "noSuchJar.jar"); 446 447 out = CDSTestUtils.executeAndLog(pb, "neg"); 448 out.shouldContain("Option AOTConfiguration must specify a single file name"); 449 out.shouldHaveExitValue(1); 450 451 //---------------------------------------------------------------------- 452 printTestCase("Cannot use multiple paths in AOTCache"); 453 454 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 455 "-XX:AOTMode=create", 456 "-XX:AOTConfiguration=" + aotConfigFile, 457 "-XX:AOTCache=" + aotCacheFile + File.pathSeparator + "dummy", 458 "-cp", "noSuchJar.jar"); 459 460 out = CDSTestUtils.executeAndLog(pb, "neg"); 461 out.shouldContain("Option AOTCache must specify a single file name"); 462 out.shouldHaveExitValue(1); 463 464 //---------------------------------------------------------------------- 465 printTestCase("Cannot use a dynamic CDS archive for -XX:AOTCache"); 466 String staticArchive = "static.jsa"; 467 String dynamicArchive = "dynamic.jsa"; 468 469 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 470 "-Xshare:dump", 471 "-XX:SharedArchiveFile=" + staticArchive); 472 out = CDSTestUtils.executeAndLog(pb, "static"); 473 out.shouldHaveExitValue(0); 474 475 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 476 "-XX:SharedArchiveFile=" + staticArchive, 477 "-XX:ArchiveClassesAtExit=" + dynamicArchive, 478 "--version"); 479 out = CDSTestUtils.executeAndLog(pb, "dynamic"); 480 out.shouldHaveExitValue(0); 481 482 pb = ProcessTools.createLimitedTestJavaProcessBuilder( 483 "-Xlog:aot", 484 "-XX:AOTMode=on", 485 "-XX:AOTCache=" + dynamicArchive, 486 "--version"); 487 488 out = CDSTestUtils.executeAndLog(pb, "neg"); 489 out.shouldContain("Unable to use AOT cache."); 490 out.shouldContain("Not a valid AOT cache (dynamic.jsa)"); 491 out.shouldHaveExitValue(1); 492 493 //---------------------------------------------------------------------- 494 testEmptyValue("AOTCache"); 495 testEmptyValue("AOTConfiguration"); 496 testEmptyValue("AOTMode"); 497 testEmptyValue("AOTCacheOutput"); 498 } 499 500 static void testEmptyValue(String option) throws Exception { 501 printTestCase("Empty values for " + option); 502 ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( 503 "-XX:" + option + "=", "--version"); 504 OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "neg"); 505 out.shouldContain("Improperly specified VM option '" + option + "='"); 506 out.shouldHaveExitValue(1); 507 } 508 509 static int testNum = 0; 510 static void printTestCase(String s) { 511 System.out.println("vvvvvvv TEST CASE " + testNum + ": " + s + ": starts here vvvvvvv"); 512 testNum++; 513 } 514 }