1 /* |
1 /* |
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
61 } |
59 } |
62 |
60 |
63 ProcessBuilder pb = ProcessTools. |
61 ProcessBuilder pb = ProcessTools. |
64 createJavaProcessBuilder( |
62 createJavaProcessBuilder( |
65 "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED", |
63 "--add-exports", "jdk.attach/sun.tools.attach=ALL-UNNAMED", |
66 "-XX:+UseConcMarkSweepGC", // this will cause MaxNewSize to be FLAG_SET_ERGO |
64 "-XX:+UseG1GC", // this will cause MaxNewSize to be FLAG_SET_ERGO |
67 "-XX:+UseCodeAging", |
65 "-XX:+UseCodeAging", |
68 "-XX:+UseCerealGC", // Should be ignored. |
66 "-XX:+UseCerealGC", // Should be ignored. |
69 "-XX:Flags=" + flagsFile.getAbsolutePath(), |
67 "-XX:Flags=" + flagsFile.getAbsolutePath(), |
70 "-Djdk.attach.allowAttachSelf", |
68 "-Djdk.attach.allowAttachSelf", |
71 "-cp", System.getProperty("test.class.path"), |
69 "-cp", System.getProperty("test.class.path"), |
72 "CheckOrigin", |
70 "CheckOrigin", |
73 "-runtests"); |
71 "-runtests"); |
74 |
72 |
75 Map<String, String> env = pb.environment(); |
73 Map<String, String> env = pb.environment(); |
76 // "UseCMSGC" should be ignored. |
74 env.put("_JAVA_OPTIONS", "-XX:+CheckJNICalls"); |
77 env.put("_JAVA_OPTIONS", "-XX:+CheckJNICalls -XX:+UseCMSGC"); |
|
78 // "UseGOneGC" should be ignored. |
75 // "UseGOneGC" should be ignored. |
79 env.put("JAVA_TOOL_OPTIONS", "-XX:+IgnoreUnrecognizedVMOptions " |
76 env.put("JAVA_TOOL_OPTIONS", "-XX:+IgnoreUnrecognizedVMOptions " |
80 + "-XX:+PrintVMOptions -XX:+UseGOneGC"); |
77 + "-XX:+PrintVMOptions -XX:+UseGOneGC"); |
81 |
78 |
82 pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); |
79 pb.redirectOutput(ProcessBuilder.Redirect.INHERIT); |
108 checkOrigin("PrintVMOptions", Origin.ENVIRON_VAR); |
105 checkOrigin("PrintVMOptions", Origin.ENVIRON_VAR); |
109 // Set in -XX:Flags file |
106 // Set in -XX:Flags file |
110 checkOrigin("PrintVMQWaitTime", Origin.CONFIG_FILE); |
107 checkOrigin("PrintVMQWaitTime", Origin.CONFIG_FILE); |
111 // Set through j.l.m |
108 // Set through j.l.m |
112 checkOrigin("HeapDumpOnOutOfMemoryError", Origin.MANAGEMENT); |
109 checkOrigin("HeapDumpOnOutOfMemoryError", Origin.MANAGEMENT); |
113 // Should be set by the VM, when we set UseConcMarkSweepGC |
110 // Should be set by the VM, when we set UseG1GC |
114 checkOrigin("MaxNewSize", Origin.ERGONOMIC); |
111 checkOrigin("MaxNewSize", Origin.ERGONOMIC); |
115 // Set using attach |
112 // Set using attach |
116 checkOrigin("HeapDumpPath", Origin.ATTACH_ON_DEMAND); |
113 checkOrigin("HeapDumpPath", Origin.ATTACH_ON_DEMAND); |
117 } |
114 } |
118 } |
115 } |