author | prr |
Fri, 25 May 2018 12:12:24 -0700 | |
changeset 50347 | b2f046ae8eb6 |
parent 50060 | 06d5b1f66553 |
permissions | -rw-r--r-- |
36511 | 1 |
/* |
48663
b742e0f9ce80
8161348: Several tools/jlink tests failed in "-Xcomp" mode due to time out
anazarov
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
36511 | 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 |
import java.io.IOException; |
|
25 |
import java.nio.file.Files; |
|
26 |
import java.nio.file.Path; |
|
27 |
import java.nio.file.Paths; |
|
28 |
import java.util.Collections; |
|
29 |
||
30 |
import tests.Helper; |
|
31 |
||
32 |
/* |
|
33 |
* @test |
|
34 |
* @summary Test image creation |
|
35 |
* @author Jean-Francois Denise |
|
48663
b742e0f9ce80
8161348: Several tools/jlink tests failed in "-Xcomp" mode due to time out
anazarov
parents:
47216
diff
changeset
|
36 |
* @requires (vm.compMode != "Xcomp" & os.maxMemory >= 2g) |
36511 | 37 |
* @library ../lib |
38 |
* @modules java.base/jdk.internal.jimage |
|
39 |
* jdk.jdeps/com.sun.tools.classfile |
|
40 |
* jdk.jlink/jdk.tools.jlink.internal |
|
41 |
* jdk.jlink/jdk.tools.jmod |
|
42 |
* jdk.jlink/jdk.tools.jimage |
|
43 |
* jdk.compiler |
|
44 |
* @build tests.* |
|
45 |
* @run main/othervm -verbose:gc -Xmx1g JLinkPluginsTest |
|
46 |
*/ |
|
47 |
public class JLinkPluginsTest { |
|
48 |
||
49 |
private static String createProperties(String fileName, String content) throws IOException { |
|
50 |
Path p = Paths.get(fileName); |
|
51 |
Files.write(p, Collections.singletonList(content)); |
|
52 |
return p.toAbsolutePath().toString(); |
|
53 |
} |
|
54 |
||
55 |
public static void main(String[] args) throws Exception { |
|
56 |
Helper helper = Helper.newHelper(); |
|
57 |
if (helper == null) { |
|
58 |
System.err.println("Test not run"); |
|
59 |
return; |
|
60 |
} |
|
61 |
helper.generateDefaultModules(); |
|
62 |
{ |
|
63 |
// Skip debug |
|
64 |
String[] userOptions = {"--strip-debug"}; |
|
65 |
String moduleName = "skipdebugcomposite"; |
|
66 |
helper.generateDefaultJModule(moduleName, "composite2"); |
|
67 |
Path imageDir = helper.generateDefaultImage(userOptions, moduleName).assertSuccess(); |
|
68 |
helper.checkImage(imageDir, moduleName, null, null); |
|
69 |
} |
|
70 |
{ |
|
71 |
// Filter out files |
|
72 |
String[] userOptions = {"--exclude-resources", "*.jcov, */META-INF/*"}; |
|
73 |
String moduleName = "excludecomposite"; |
|
74 |
helper.generateDefaultJModule(moduleName, "composite2"); |
|
75 |
String[] res = {".jcov", "/META-INF/"}; |
|
76 |
Path imageDir = helper.generateDefaultImage(userOptions, moduleName).assertSuccess(); |
|
77 |
helper.checkImage(imageDir, moduleName, res, null); |
|
78 |
} |
|
39635
07c4b195280d
8161067: jlink: Enable plugins to use the module pool for class lookup
jlaskey
parents:
36511
diff
changeset
|
79 |
{ |
41831
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
80 |
// disable generate jli classes - JDK-8160063 |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
81 |
String[] userOptions = {"--disable-plugin", "generate-jli-classes"}; |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
82 |
String moduleName = "jlidisabled"; |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
83 |
helper.generateDefaultJModule(moduleName, "composite2"); |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
84 |
Path imageDir = helper.generateDefaultImage(userOptions, moduleName).assertSuccess(); |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
85 |
helper.checkImage(imageDir, moduleName, null, null); |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
86 |
} |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
87 |
{ |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
88 |
// disable invalid plugin - JDK-8160063 |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
89 |
String[] userOptions = {"--disable-plugin", "non-existent-plugin"}; |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
90 |
String moduleName = "invaliddisabled"; |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
91 |
helper.generateDefaultJModule(moduleName, "composite2"); |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
92 |
helper.generateDefaultImage(userOptions, moduleName). |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
93 |
assertFailure("Error: No such plugin: non-existent-plugin"); |
2dd91b18195b
8160063: Provide a means to disable a plugin via the command line
sundar
parents:
39635
diff
changeset
|
94 |
} |
36511 | 95 |
} |
96 |
} |