test/hotspot/jtreg/runtime/cds/BootAppendTests.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 57705 7cf02b2c1455
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     1
/*
57567
b000362a89a0 8202339: [TESTBUG] Consolidate the tests in runtime/SharedArchiveFile and runtime/appcds
coleenp
parents: 50679
diff changeset
     2
 * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     4
 *
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     7
 * published by the Free Software Foundation.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     8
 *
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    13
 * accompanied this code).
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    14
 *
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    18
 *
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    21
 * questions.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    22
 */
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    23
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    24
/**
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    25
 * @test
48397
ead47ddf5844 8191788: add jdk.internal.vm.compiler to --limit-modules if -Djvmci.Compiler=graal is in the command line
kvn
parents: 48171
diff changeset
    26
 * @requires vm.cds & !vm.graal.enabled
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    27
 * @summary Testing -Xbootclasspath/a support for CDS
48469
7312ae4465d6 8193672: [test] Enhance vm.cds property to check for all conditions required to run CDS tests
iklam
parents: 48397
diff changeset
    28
 * @requires vm.cds
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40244
diff changeset
    29
 * @library /test/lib
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    30
 * @compile javax/sound/sampled/MyClass.jasm
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
    31
 * @compile javax/annotation/processing/FilerException.jasm
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    32
 * @compile nonjdk/myPackage/MyClass.java
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40244
diff changeset
    33
 * @build LoadClass
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    34
 * @run main/othervm BootAppendTests
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    35
 */
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    36
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    37
import java.io.File;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    38
import java.io.FileOutputStream;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    39
import java.io.IOException;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    40
import java.io.PrintStream;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    41
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    42
import java.nio.file.Path;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    43
import java.nio.file.Paths;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    44
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    45
import jdk.test.lib.cds.CDSOptions;
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    46
import jdk.test.lib.cds.CDSTestUtils;
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40244
diff changeset
    47
import jdk.test.lib.process.ProcessTools;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40244
diff changeset
    48
import jdk.test.lib.process.OutputAnalyzer;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    49
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    50
public class BootAppendTests {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    51
    private static final String APP_CLASS = "LoadClass";
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    52
    private static final String BOOT_APPEND_MODULE_CLASS = "javax/sound/sampled/MyClass";
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
    53
    private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS =
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
    54
        "javax/annotation/processing/FilerException";
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    55
    private static final String BOOT_APPEND_CLASS = "nonjdk/myPackage/MyClass";
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    56
    private static final String BOOT_APPEND_MODULE_CLASS_NAME =
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    57
        BOOT_APPEND_MODULE_CLASS.replace('/', '.');
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    58
    private static final String BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME =
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    59
        BOOT_APPEND_DUPLICATE_MODULE_CLASS.replace('/', '.');
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    60
    private static final String BOOT_APPEND_CLASS_NAME =
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    61
        BOOT_APPEND_CLASS.replace('/', '.');
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    62
    private static final String[] ARCHIVE_CLASSES =
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    63
        {BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS, BOOT_APPEND_CLASS};
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    64
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    65
    private static final String modes[] = {"on", "off"};
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    66
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    67
    private static String appJar;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    68
    private static String bootAppendJar;
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    69
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    70
    public static void main(String... args) throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    71
        dumpArchive();
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    72
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    73
        logTestCase("1");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    74
        testBootAppendModuleClass();
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    75
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
    76
        logTestCase("2");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    77
        testBootAppendDuplicateModuleClass();
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    78
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    79
        logTestCase("3");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    80
        testBootAppendExcludedModuleClass();
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    81
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    82
        logTestCase("4");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    83
        testBootAppendDuplicateExcludedModuleClass();
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    84
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    85
        logTestCase("5");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    86
        testBootAppendClass();
48171
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
    87
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
    88
        logTestCase("6");
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
    89
        testBootAppendExtraDir();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    90
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    91
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    92
    private static void logTestCase(String msg) {
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    93
        System.out.println();
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    94
        System.out.printf("TESTCASE: %s", msg);
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    95
        System.out.println();
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    96
    }
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
    97
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    98
    static void dumpArchive() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
    99
        // create the classlist
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   100
        File classlist = CDSTestUtils.makeClassList(ARCHIVE_CLASSES);
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   101
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   102
        // build jar files
37263
08dec586ed5c 8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents: 36508
diff changeset
   103
        appJar = ClassFileInstaller.writeJar("app.jar", APP_CLASS);
08dec586ed5c 8153300: [TESTBUG] Enhance test/testlibrary/ClassFileInstaller.java to support JAR files
iklam
parents: 36508
diff changeset
   104
        bootAppendJar = ClassFileInstaller.writeJar("bootAppend.jar",
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   105
            BOOT_APPEND_MODULE_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS, BOOT_APPEND_CLASS);
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   106
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   107
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   108
        OutputAnalyzer out = CDSTestUtils.createArchiveAndCheck(
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   109
                                 "-Xbootclasspath/a:" + bootAppendJar,
49931
840e26123940 8193213: Make the UseAppCDS option obsolete.
jiangli
parents: 49894
diff changeset
   110
                                 "-cp", appJar,
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   111
                                 "-XX:SharedClassListFile=" + classlist.getPath());
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   112
        // Make sure all the classes were successfully archived.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   113
        for (String archiveClass : ARCHIVE_CLASSES) {
50206
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   114
            String msg = "Preload Warning: Cannot find " + archiveClass;
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   115
            if (archiveClass.equals(BOOT_APPEND_MODULE_CLASS)) {
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   116
                // We shouldn't archive a class in the appended boot class path that
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   117
                // are the java.desktop module. Such a class cannot be loaded
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   118
                // at runtime anyway.
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   119
                out.shouldContain(msg);
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   120
            } else {
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   121
                out.shouldNotContain(msg);
adec398d9051 8193332: MetaspaceShared::check_shared_class_loader_type is not used during archive creation
iklam
parents: 49931
diff changeset
   122
            }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   123
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   124
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   125
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   126
    // Test #1: If a class on -Xbootclasspath/a is from a package defined in
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   127
    //          bootmodules, the class is not loaded at runtime.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   128
    //          Verify the behavior is the same when the class is archived
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   129
    //          with CDS enabled at runtime.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   130
    //
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   131
    //          The javax.sound.sampled package is defined in the java.desktop module.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   132
    //          The archived javax.sound.sampled.MyClass from the -Xbootclasspath/a
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   133
    //          should not be loaded at runtime.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   134
    public static void testBootAppendModuleClass() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   135
        for (String mode : modes) {
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   136
            CDSOptions opts = (new CDSOptions())
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   137
                .setXShareMode(mode).setUseVersion(false)
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   138
                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar, "-showversion")
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   139
                .addSuffix(APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   140
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   141
            OutputAnalyzer out = CDSTestUtils.runWithArchive(opts);
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   142
            CDSTestUtils.checkExec(out, opts, "java.lang.ClassNotFoundException: javax.sound.sampled.MyClass");
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   143
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   144
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   145
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   146
    // Test #2: If a class on -Xbootclasspath/a has the same fully qualified
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   147
    //          name as a class defined in boot modules, the class is not loaded
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   148
    //          from -Xbootclasspath/a. Verify the behavior is the same at runtime
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   149
    //          when CDS is enabled.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   150
    //
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   151
    //          The javax/annotation/processing/FilerException is a platform module
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   152
    //          class. The class on the -Xbootclasspath/a path that has the same
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   153
    //          fully-qualified name should not be loaded at runtime when CDS is enabled.
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   154
    //          The one from the platform modules should be loaded instead.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   155
    public static void testBootAppendDuplicateModuleClass() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   156
        for (String mode : modes) {
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   157
            CDSOptions opts = (new CDSOptions())
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   158
                .setXShareMode(mode).setUseVersion(false)
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   159
                .addPrefix("-showversion",
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   160
                           "-Xbootclasspath/a:" + bootAppendJar, "-cp", appJar)
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   161
                .addSuffix("-Xlog:class+load=info",
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   162
                           APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   163
49931
840e26123940 8193213: Make the UseAppCDS option obsolete.
jiangli
parents: 49894
diff changeset
   164
            String MATCH_PATTERN = ".class.load. javax.annotation.processing.FilerException source:.*bootAppend.jar*";
50679
58dac477766c 8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents: 50206
diff changeset
   165
            CDSTestUtils.run(opts)
58dac477766c 8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents: 50206
diff changeset
   166
                .assertNormalExit(out -> {
58dac477766c 8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents: 50206
diff changeset
   167
                    out.shouldNotMatch(MATCH_PATTERN);
58dac477766c 8204701: [TESTBUG] runtime/SharedArchiveFile/BootAppendTests.java should handle mapping failure
mseledtsov
parents: 50206
diff changeset
   168
                });
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   169
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   170
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   171
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   172
    // Test #3: If a class on -Xbootclasspath/a is from a package defined in boot modules,
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   173
    //          the class can be loaded from -Xbootclasspath/a when the module is excluded
40244
b3055c216762 8136930: Simplify use of module-system options by custom launchers
hseigel
parents: 38151
diff changeset
   174
    //          using --limit-modules. Verify the behavior is the same at runtime when CDS
b3055c216762 8136930: Simplify use of module-system options by custom launchers
hseigel
parents: 38151
diff changeset
   175
    //          is enabled.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   176
    //
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   177
    //          The java.desktop module is excluded using --limit-modules at runtime
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   178
    //          CDS will be disabled with the --limit-modules option during runtime.
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   179
    //          javax.sound.sampled.MyClass will be loaded from the jar at runtime.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   180
    public static void testBootAppendExcludedModuleClass() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   181
        for (String mode : modes) {
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   182
            CDSOptions opts = (new CDSOptions())
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   183
                .setXShareMode(mode).setUseVersion(false)
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   184
                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
48023
4b7462e3b552 8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents: 48004
diff changeset
   185
                           "--limit-modules=java.base", "-cp", appJar)
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   186
                .addSuffix("-Xlog:class+load=info",
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   187
                           APP_CLASS, BOOT_APPEND_MODULE_CLASS_NAME);
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   188
            CDSTestUtils.Result res = CDSTestUtils.run(opts);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   189
            String MATCH_PATTERN =
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   190
                ".class.load. javax.sound.sampled.MyClass source:.*bootAppend.jar*";
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   191
            if (mode.equals("on")) {
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   192
                res.assertSilentlyDisabledCDS(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   193
                    out.shouldHaveExitValue(0)
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   194
                       .shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   195
                    });
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   196
            } else {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   197
                res.assertNormalExit(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   198
                    out.shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   199
                    });
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   200
            }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   201
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   202
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   203
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   204
    // Test #4: If a class on -Xbootclasspath/a has the same fully qualified
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   205
    //          name as a class defined in boot modules, the class is loaded
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   206
    //          from -Xbootclasspath/a when the boot module is excluded using
40244
b3055c216762 8136930: Simplify use of module-system options by custom launchers
hseigel
parents: 38151
diff changeset
   207
    //          --limit-modules. Verify the behavior is the same at runtime
b3055c216762 8136930: Simplify use of module-system options by custom launchers
hseigel
parents: 38151
diff changeset
   208
    //          when CDS is enabled.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   209
    //
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   210
    //          The javax.annotation.processing.FilerException is a platform module class.
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   211
    //          The class on -Xbootclasspath/a that has the same fully-qualified name
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   212
    //          as javax.annotation.processing.FilerException can be loaded at runtime when
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   213
    //          java.compiler is excluded.
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   214
    //          CDS is disabled during runtime if the --limit-modules option is
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   215
    //          specified.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   216
    public static void testBootAppendDuplicateExcludedModuleClass() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   217
        for (String mode : modes) {
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   218
            CDSOptions opts = (new CDSOptions())
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   219
                .setXShareMode(mode).setUseVersion(false)
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   220
                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
48023
4b7462e3b552 8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents: 48004
diff changeset
   221
                           "--limit-modules=java.base", "-cp", appJar)
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   222
                .addSuffix("-Xlog:class+load=info",
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   223
                           APP_CLASS, BOOT_APPEND_DUPLICATE_MODULE_CLASS_NAME);
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   224
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   225
            CDSTestUtils.Result res = CDSTestUtils.run(opts);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   226
            String MATCH_PATTERN =
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   227
                ".class.load. javax.annotation.processing.FilerException source:.*bootAppend.jar*";
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   228
            if (mode.equals("on")) {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   229
                res.assertSilentlyDisabledCDS(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   230
                    out.shouldHaveExitValue(0)
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   231
                       .shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   232
                    });
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   233
            } else {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   234
                res.assertNormalExit(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   235
                    out.shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   236
                    });
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   237
            }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   238
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   239
    }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   240
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   241
    // Test #5: If a class on -Xbootclasspath/a is not from named modules,
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   242
    //          the class can be loaded at runtime. Verify the behavior is
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   243
    //          the same at runtime when CDS is enabled.
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   244
    //
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   245
    //          The nonjdk.myPackage is not defined in named modules. The
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   246
    //          nonjdk.myPackage.MyClass will be loaded from the jar in
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   247
    //          -Xbootclasspath/a since CDS will be disabled with the
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   248
    //          --limit-modules option.
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   249
    public static void testBootAppendClass() throws Exception {
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   250
        for (String mode : modes) {
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   251
            CDSOptions opts = (new CDSOptions())
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   252
                .setXShareMode(mode).setUseVersion(false)
46410
5ffd0f5000cc 8179103: [Testbug] re-enable the runtime/SharedArchiveFile/BootAppendTests.java test
ccheung
parents: 46389
diff changeset
   253
                .addPrefix("-Xbootclasspath/a:" + bootAppendJar, "-showversion",
48023
4b7462e3b552 8191653: Test failures in BootAppendTests - missing jdk.internal.vm.compiler module
ccheung
parents: 48004
diff changeset
   254
                           "--limit-modules=java.base", "-cp", appJar)
46389
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   255
                .addSuffix("-Xlog:class+load=info",
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   256
                           APP_CLASS, BOOT_APPEND_CLASS_NAME);
d55896236dfd 8177728: [TESTBUG] Improve CDS test utils
mseledtsov
parents: 43467
diff changeset
   257
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   258
            CDSTestUtils.Result res = CDSTestUtils.run(opts);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   259
            String MATCH_PATTERN =
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   260
                ".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*";
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   261
            if (mode.equals("on")) {
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   262
                res.assertSilentlyDisabledCDS(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   263
                    out.shouldHaveExitValue(0)
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   264
                       .shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   265
                    });
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   266
            } else {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   267
                res.assertNormalExit(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   268
                    out.shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   269
                    });
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   270
            }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   271
        }
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   272
    }
48171
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   273
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   274
    // Test #6: This is similar to Test #5. During runtime, an extra dir
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   275
    //          is appended to the bootclasspath. It should not invalidate
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   276
    //          the shared archive. However, CDS will be disabled with the
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   277
    //          --limit-modules in the command line.
48171
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   278
    public static void testBootAppendExtraDir() throws Exception {
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   279
        for (String mode : modes) {
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   280
            CDSOptions opts = (new CDSOptions())
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   281
                .setXShareMode(mode).setUseVersion(false)
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   282
                .addPrefix("-Xbootclasspath/a:" + bootAppendJar + File.pathSeparator + appJar,
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   283
                           "-showversion", "--limit-modules=java.base", "-cp", appJar)
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   284
                .addSuffix("-Xlog:class+load=info",
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   285
                           APP_CLASS, BOOT_APPEND_CLASS_NAME);
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   286
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   287
            CDSTestUtils.Result res = CDSTestUtils.run(opts);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   288
            String MATCH_PATTERN =
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   289
                ".class.load. nonjdk.myPackage.MyClass source:.*bootAppend.jar*";
48171
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   290
            if (mode.equals("on")) {
49894
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   291
                res.assertSilentlyDisabledCDS(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   292
                    out.shouldHaveExitValue(0)
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   293
                       .shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   294
                    });
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   295
            } else {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   296
                res.assertNormalExit(out -> {
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   297
                    out.shouldMatch(MATCH_PATTERN);
c830e94b5606 8197959: [TESTBUG] Some (App)CDS tests require modification due to the removal of the Java EE and CORBA modules
ccheung
parents: 48469
diff changeset
   298
                    });
48171
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   299
            }
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   300
        }
7ad2d33a0f05 8174101: Bootclasspath append should not invalidate CDS archive
ccheung
parents: 48023
diff changeset
   301
    }
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents:
diff changeset
   302
}