author | mr |
Wed, 16 Jan 2019 16:27:21 -0800 | |
changeset 53372 | 4003935e6e5f |
parent 51675 | b487c1e914d0 |
permissions | -rw-r--r-- |
45004 | 1 |
/* |
51675 | 2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
45004 | 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 |
* @test |
|
48397
ead47ddf5844
8191788: add jdk.internal.vm.compiler to --limit-modules if -Djvmci.Compiler=graal is in the command line
kvn
parents:
47216
diff
changeset
|
26 |
* @requires !vm.graal.enabled |
45004 | 27 |
* @modules jdk.jdeps jdk.zipfs |
51675 | 28 |
* @library /test/lib |
29 |
* @build ShowModuleResolutionTest |
|
45004 | 30 |
* @run testng ShowModuleResolutionTest |
31 |
* @summary Basic test for java --show-module-resolution |
|
32 |
*/ |
|
33 |
||
51675 | 34 |
import jdk.test.lib.process.ProcessTools; |
45004 | 35 |
|
36 |
import org.testng.annotations.Test; |
|
37 |
import static org.testng.Assert.*; |
|
38 |
||
39 |
@Test |
|
40 |
public class ShowModuleResolutionTest { |
|
41 |
||
42 |
/** |
|
43 |
* Test that the resolution does not bind any services |
|
44 |
*/ |
|
45 |
private void expectJavaBase(String... args) throws Exception { |
|
46 |
int exitValue = ProcessTools.executeTestJava(args) |
|
47 |
.outputTo(System.out) |
|
48 |
.errorTo(System.out) |
|
49 |
.stdoutShouldContain("root java.base") |
|
50 |
.stdoutShouldNotContain("java.base binds") |
|
51 |
.getExitValue(); |
|
52 |
assertTrue(exitValue == 0); |
|
53 |
} |
|
54 |
||
55 |
/** |
|
56 |
* Test that the resolution binds services that resolves additional |
|
57 |
* modules |
|
58 |
*/ |
|
59 |
private void expectProviders(String... args) throws Exception { |
|
60 |
int exitValue = ProcessTools.executeTestJava(args) |
|
61 |
.outputTo(System.out) |
|
62 |
.errorTo(System.out) |
|
63 |
.stdoutShouldContain("root java.base") |
|
64 |
.stdoutShouldContain("root java.compiler") |
|
65 |
.stdoutShouldContain("root jdk.compiler") |
|
66 |
.stdoutShouldContain("root java.compiler") |
|
67 |
.stdoutShouldContain("jdk.compiler requires java.compiler") |
|
68 |
.stdoutShouldContain("java.base binds jdk.compiler") |
|
69 |
.stdoutShouldContain("java.base binds jdk.jdeps") |
|
70 |
.stdoutShouldContain("java.base binds jdk.zipfs") |
|
71 |
.stdoutShouldContain("java.compiler binds jdk.compiler") |
|
72 |
.stdoutShouldContain("jdk.jdeps requires jdk.compiler") |
|
73 |
.getExitValue(); |
|
74 |
assertTrue(exitValue == 0); |
|
75 |
} |
|
76 |
||
77 |
public void test() throws Exception { |
|
78 |
expectJavaBase("--show-module-resolution", |
|
79 |
"--limit-modules", "java.base", |
|
80 |
"-version"); |
|
81 |
expectProviders("--show-module-resolution", |
|
82 |
"--limit-modules", "java.base,jdk.jdeps,jdk.zipfs", |
|
83 |
"-version"); |
|
84 |
} |
|
85 |
} |