hotspot/test/runtime/modules/PatchModule/PatchModuleTraceCL.java
changeset 46444 677be3444372
parent 40631 ed82623d7831
child 46488 01c282163d38
equal deleted inserted replaced
46443:cdb638b5ec53 46444:677be3444372
     1 /*
     1 /*
     2  * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 8069469
    26  * @bug 8069469
    27  * @summary Make sure -Xlog:classload=info works properly with "modules" jimage,
    27  * @summary Make sure -Xlog:class+load=info works properly with "modules" jimage,
    28             --patch-module, and with -Xbootclasspath/a
    28             --patch-module, and with -Xbootclasspath/a
    29  * @modules java.base/jdk.internal.misc
    29  * @modules java.base/jdk.internal.misc
    30  * @library /test/lib
    30  * @library /test/lib
    31  * @compile PatchModuleMain.java
    31  * @compile PatchModuleMain.java
    32  * @run main PatchModuleTraceCL
    32  * @run main PatchModuleTraceCL
    45                         "    static { "                             +
    45                         "    static { "                             +
    46                         "        System.out.println(\"I pass!\"); " +
    46                         "        System.out.println(\"I pass!\"); " +
    47                         "    } "                                    +
    47                         "    } "                                    +
    48                         "}";
    48                         "}";
    49 
    49 
    50         // Test -Xlog:classload=info output for --patch-module
    50         // Test -Xlog:class+load=info output for --patch-module
    51         ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager",
    51         ClassFileInstaller.writeClassToDisk("javax/naming/spi/NamingManager",
    52              InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
    52              InMemoryJavaCompiler.compile("javax.naming.spi.NamingManager", source, "-Xmodule:java.naming"),
    53              "mods/java.naming");
    53              "mods/java.naming");
    54 
    54 
    55         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming",
    55         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--patch-module=java.naming=mods/java.naming",
    61         // --patch-module case.
    61         // --patch-module case.
    62         output.shouldContain("[class,load] javax.naming.spi.NamingManager source: mods/java.naming");
    62         output.shouldContain("[class,load] javax.naming.spi.NamingManager source: mods/java.naming");
    63         // -cp case.
    63         // -cp case.
    64         output.shouldContain("[class,load] PatchModuleMain source: file");
    64         output.shouldContain("[class,load] PatchModuleMain source: file");
    65 
    65 
    66         // Test -Xlog:classload=info output for -Xbootclasspath/a
    66         // Test -Xlog:class+load=info output for -Xbootclasspath/a
    67         source = "package PatchModuleTraceCL_pkg; "                 +
    67         source = "package PatchModuleTraceCL_pkg; "                 +
    68                  "public class ItIsI { "                          +
    68                  "public class ItIsI { "                          +
    69                  "    static { "                                  +
    69                  "    static { "                                  +
    70                  "        System.out.println(\"I also pass!\"); " +
    70                  "        System.out.println(\"I also pass!\"); " +
    71                  "    } "                                         +
    71                  "    } "                                         +