author | ihse |
Tue, 22 Oct 2019 09:51:52 +0200 | |
branch | ihse-cflags-rewrite-branch |
changeset 58736 | e878a0b7cff0 |
parent 58280 | ef8c8cf9256a |
permissions | -rw-r--r-- |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
1 |
/* |
58280
ef8c8cf9256a
8231171: remove remaining sun.java.launcher.pid references
mbaesken
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
4 |
* |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
8 |
* |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
13 |
* accompanied this code). |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
14 |
* |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
18 |
* |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
21 |
* questions. |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
22 |
*/ |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
23 |
|
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
24 |
/* |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
25 |
* @test |
29373
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
26 |
* @bug 7124089 7131021 8042469 8066185 8074373 |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
27 |
* @summary Checks for Launcher special flags, such as MacOSX specific flags, |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
28 |
* and JVM NativeMemoryTracking flags. |
45944
882cea808912
8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider
anazarov
parents:
37540
diff
changeset
|
29 |
* @modules jdk.compiler |
882cea808912
8179292: a number of launcher tests fail when run with --limit-modules due to CNFE: javax.tools.ToolProvider
anazarov
parents:
37540
diff
changeset
|
30 |
* jdk.zipfs |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
31 |
* @compile -XDignore.symbol.file TestSpecialArgs.java EnvironmentVariables.java |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
32 |
* @run main TestSpecialArgs |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
33 |
*/ |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
34 |
import java.io.File; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
35 |
import java.io.FileNotFoundException; |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
36 |
import java.util.HashMap; |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
37 |
import java.util.HashSet; |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
38 |
import java.util.Map; |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
39 |
import java.util.Set; |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
40 |
|
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
41 |
public class TestSpecialArgs extends TestHelper { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
42 |
|
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
43 |
public static void main(String... args) throws Exception { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
44 |
new TestSpecialArgs().run(args); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
45 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
46 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
47 |
@Test |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
48 |
void testDocking() { |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
49 |
final Map<String, String> envMap = new HashMap<>(); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
50 |
envMap.put("_JAVA_LAUNCHER_DEBUG", "true"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
51 |
TestResult tr = doExec(envMap, javaCmd, "-XstartOnFirstThread", "-version"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
52 |
if (isMacOSX) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
53 |
if (!tr.contains("In same thread")) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
54 |
System.out.println(tr); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
55 |
throw new RuntimeException("Error: not running in the same thread ?"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
56 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
57 |
if (!tr.isOK()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
58 |
System.out.println(tr); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
59 |
throw new RuntimeException("Error: arg was rejected ????"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
60 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
61 |
} else { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
62 |
if (tr.isOK()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
63 |
System.out.println(tr); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
64 |
throw new RuntimeException("Error: argument was accepted ????"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
65 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
66 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
67 |
|
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
68 |
tr = doExec(javaCmd, "-Xdock:/tmp/not-available", "-version"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
69 |
if (isMacOSX) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
70 |
if (!tr.isOK()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
71 |
System.out.println(tr); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
72 |
throw new RuntimeException("Error: arg was rejected ????"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
73 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
74 |
} else { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
75 |
if (tr.isOK()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
76 |
System.out.println(tr); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
77 |
throw new RuntimeException("Error: argument was accepted ????"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
78 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
79 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
80 |
// MacOSX specific tests ensue...... |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
81 |
if (!isMacOSX) { |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
82 |
return; |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
83 |
} |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
84 |
Set<String> envToRemove = new HashSet<>(); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
85 |
Map<String, String> map = System.getenv(); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
86 |
for (String s : map.keySet()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
87 |
if (s.startsWith("JAVA_MAIN_CLASS_") |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
88 |
|| s.startsWith("APP_NAME_") |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
89 |
|| s.startsWith("APP_ICON_")) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
90 |
envToRemove.add(s); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
91 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
92 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
93 |
runTest(envToRemove, javaCmd, "-cp", TEST_CLASSES_DIR.getAbsolutePath(), |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
94 |
"EnvironmentVariables", "JAVA_MAIN_CLASS_*", |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
95 |
"EnvironmentVariables"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
96 |
|
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
97 |
runTest(envToRemove, javaCmd, "-cp", TEST_CLASSES_DIR.getAbsolutePath(), |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
98 |
"-Xdock:name=TestAppName", "EnvironmentVariables", |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
99 |
"APP_NAME_*", "TestAppName"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
100 |
|
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
101 |
runTest(envToRemove, javaCmd, "-cp", TEST_CLASSES_DIR.getAbsolutePath(), |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
102 |
"-Xdock:icon=TestAppIcon", "EnvironmentVariables", |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
103 |
"APP_ICON_*", "TestAppIcon"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
104 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
105 |
|
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
106 |
void runTest(Set<String> envToRemove, String... args) { |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
107 |
TestResult tr = doExec(null, envToRemove, args); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
108 |
if (!tr.isOK()) { |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
109 |
System.err.println(tr.toString()); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
110 |
throw new RuntimeException("Test Fails"); |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
111 |
} |
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
112 |
} |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
113 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
114 |
@Test |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
115 |
void testNativeMemoryTracking() { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
116 |
final Map<String, String> envMap = new HashMap<>(); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
117 |
envMap.put("_JAVA_LAUNCHER_DEBUG", "true"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
118 |
TestResult tr; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
119 |
/* |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
120 |
* test argument : -XX:NativeMemoryTracking=value |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
121 |
* A JVM flag, comsumed by the JVM, but requiring launcher |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
122 |
* to set an environmental variable if and only if value is supplied. |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
123 |
* Test and order: |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
124 |
* 1) execute with valid parameter: -XX:NativeMemoryTracking=MyValue |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
125 |
* a) check for correct env variable name: "NMT_LEVEL_" + pid |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
126 |
* b) check that "MyValue" was found in local env. |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
127 |
* 2) execute with invalid parameter: -XX:NativeMemoryTracking= |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
128 |
* !) Won't find "NativeMemoryTracking:" |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
129 |
* Code to create env variable not executed. |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
130 |
* 3) execute with invalid parameter: -XX:NativeMemoryTracking |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
131 |
* !) Won't find "NativeMemoryTracking:" |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
132 |
* Code to create env variable not executed. |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
133 |
* 4) give and invalid value and check to make sure JVM commented |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
134 |
*/ |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
135 |
String envVarPidString = "TRACER_MARKER: NativeMemoryTracking: env var is NMT_LEVEL_"; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
136 |
String NMT_Option_Value = "off"; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
137 |
String myClassName = "helloworld"; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
138 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
139 |
// === Run the tests === |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
140 |
// ---Test 1a |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
141 |
tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=" + NMT_Option_Value, |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
142 |
"-version"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
143 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
144 |
// get the PID from the env var we set for the JVM |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
145 |
String envVarPid = null; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
146 |
for (String line : tr.testOutput) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
147 |
if (line.contains(envVarPidString)) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
148 |
int sindex = envVarPidString.length(); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
149 |
envVarPid = line.substring(sindex); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
150 |
break; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
151 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
152 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
153 |
// did we find envVarPid? |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
154 |
if (envVarPid == null) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
155 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
156 |
throw new RuntimeException("Error: failed to find env Var Pid in tracking info"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
157 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
158 |
// we think we found the pid string. min test, not "". |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
159 |
if (envVarPid.length() < 1) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
160 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
161 |
throw new RuntimeException("Error: env Var Pid in tracking info is empty string"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
162 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
163 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
164 |
// --- Test 1b |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
165 |
if (!tr.contains("NativeMemoryTracking: got value " + NMT_Option_Value)) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
166 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
167 |
throw new RuntimeException("Error: Valid param failed to set env variable"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
168 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
169 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
170 |
// --- Test 2 |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
171 |
tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=", |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
172 |
"-version"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
173 |
if (tr.contains("NativeMemoryTracking:")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
174 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
175 |
throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
176 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
177 |
if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
178 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
179 |
throw new RuntimeException("Error: invalid param not checked by JVM"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
180 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
181 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
182 |
// --- Test 3 |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
183 |
tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking", |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
184 |
"-version"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
185 |
if (tr.contains("NativeMemoryTracking:")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
186 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
187 |
throw new RuntimeException("Error: invalid param caused env variable to be erroneously created"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
188 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
189 |
if (!tr.contains("Syntax error, expecting -XX:NativeMemoryTracking=")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
190 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
191 |
throw new RuntimeException("Error: invalid param not checked by JVM"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
192 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
193 |
// --- Test 4 |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
194 |
tr = doExec(envMap, javaCmd, "-XX:NativeMemoryTracking=BADVALUE", |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
195 |
"-version"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
196 |
if (!tr.contains("expecting -XX:NativeMemoryTracking")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
197 |
System.out.println(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
198 |
throw new RuntimeException("Error: invalid param did not get JVM Syntax error message"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
199 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
200 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
201 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
202 |
@Test |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
203 |
void testNMArgumentProcessing() throws FileNotFoundException { |
37540
e92d95400f31
8154470: defines.h confused about PROGNAME and JAVA_ARGS
martin
parents:
29373
diff
changeset
|
204 |
TestResult tr; |
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
205 |
// the direct invokers of the VM |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
206 |
String options[] = { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
207 |
"-version", "-fullversion", "-help", "-?", "-X" |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
208 |
}; |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
209 |
for (String option : options) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
210 |
tr = doExec(javaCmd, option, "-XX:NativeMemoryTracking=summary"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
211 |
checkTestResult(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
212 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
213 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
214 |
// create a test jar |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
215 |
File jarFile = new File("test.jar"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
216 |
createJar(jarFile, "public static void main(String... args){}"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
217 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
218 |
// ones that involve main-class of some sort |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
219 |
tr = doExec(javaCmd, "-jar", jarFile.getName(), |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
220 |
"-XX:NativeMemoryTracking=summary"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
221 |
checkTestResult(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
222 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
223 |
tr = doExec(javaCmd, "-cp", jarFile.getName(), "Foo", |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
224 |
"-XX:NativeMemoryTracking=summary"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
225 |
checkTestResult(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
226 |
|
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
227 |
final Map<String, String> envMap = new HashMap<>(); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
228 |
// checkwith CLASSPATH set ie. no -cp or -classpath |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
229 |
envMap.put("CLASSPATH", "."); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
230 |
tr = doExec(envMap, javaCmd, "Foo", "-XX:NativeMemoryTracking=summary"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
231 |
checkTestResult(tr); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
232 |
|
29373
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
233 |
// should accept with no warnings |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
234 |
tr = doExec(javaCmd, "-cp", jarFile.getName(), |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
235 |
"-XX:NativeMemoryTracking=summary", "Foo"); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
236 |
ensureNoWarnings(tr); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
237 |
|
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
238 |
// should accept with no warnings |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
239 |
tr = doExec(javaCmd, "-classpath", jarFile.getName(), |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
240 |
"-XX:NativeMemoryTracking=summary", "Foo"); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
241 |
ensureNoWarnings(tr); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
242 |
|
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
243 |
// make sure a missing class is handled correctly, because the class |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
244 |
// resolution is performed by the JVM. |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
245 |
tr = doExec(javaCmd, "AbsentClass", "-XX:NativeMemoryTracking=summary"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
246 |
if (!tr.contains("Error: Could not find or load main class AbsentClass")) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
247 |
throw new RuntimeException("Test Fails"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
248 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
249 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
250 |
|
29373
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
251 |
void ensureNoWarnings(TestResult tr) { |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
252 |
checkTestResult(tr); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
253 |
if (tr.contains("warning: Native Memory Tracking")) { |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
254 |
System.err.println(tr.toString()); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
255 |
throw new RuntimeException("Test Fails"); |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
256 |
} |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
257 |
} |
8f41a04d1a02
8074373: NMT is not enabled if NMT option is specified after class path specifiers
ksrini
parents:
29114
diff
changeset
|
258 |
|
29114
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
259 |
void checkTestResult(TestResult tr) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
260 |
if (!tr.isOK()) { |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
261 |
System.err.println(tr.toString()); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
262 |
throw new RuntimeException("Test Fails"); |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
263 |
} |
a9b39a645e85
8066185: VM crashed with SIGSEGV VirtualMemoryTracker::add_reserved_region
ksrini
parents:
25816
diff
changeset
|
264 |
} |
12527
22abaf748b5b
7131021: [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
anthony
parents:
diff
changeset
|
265 |
} |