Path: blob/master/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java
41154 views
/*1* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @modules jdk.compiler26* @summary Test cases which run against customized image, check the situation where27* 1. logger provider is the default one supplied by java.base,28* 2. clients are in named/unnamed module,29* patched system module, or Xbootclasspath30* This test does not require existence of java.logging module,31* but require jdk.compiler module32* @library /test/lib33* @build Base jdk.test.lib.compiler.CompilerUtils34* @run main/othervm JDKLoggerForImageTest35*/3637public class JDKLoggerForImageTest extends Base {3839public static void main(String args[]) throws Throwable {40JDKLoggerForImageTest t = new JDKLoggerForImageTest();41t.setup();42t.test();43}4445private void setup() throws Throwable {46setupAllClient();4748setupJavaBaseImage();49}5051private void test() throws Throwable {52if (!checkJMODS()) {53return;54}5556// logger client is in named module m.t.a57runTest(IMAGE,58"--module-path", DEST_NAMED_CLIENT.toString(),59"-m", CLIENT_A, "system", SIMPLE_LOGGER);60// logger client is in unnamed module61runTest(IMAGE,62"--class-path", DEST_UNNAMED_CLIENT.toString(),63CLIENT_B, "system", SIMPLE_LOGGER);64// logger client gets logger through boot class BootUsage65runTest(IMAGE,66"-Xbootclasspath/a:" + DEST_BOOT_USAGE.toString(),67"--class-path", DEST_BOOT_CLIENT.toString(),68BOOT_CLIENT, "system", SIMPLE_LOGGER);69// logger client gets logger through patched class70// java.base/java.lang.PatchedUsage71runTest(IMAGE,72"--patch-module", "java.base=" + DEST_PATCHED_USAGE.toString(),73"--class-path", DEST_PATCHED_CLIENT.toString(),74PATCHED_CLIENT, "system", SIMPLE_LOGGER);75}76}777879