author | mockner |
Fri, 29 Apr 2016 22:40:51 -0400 | |
changeset 38151 | fffedc5e5cf8 |
parent 37453 | e333d1d43e75 |
child 38152 | 80e5da81fb2c |
permissions | -rw-r--r-- |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
1 |
/* |
35858
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
4 |
* |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
8 |
* |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
13 |
* accompanied this code). |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
14 |
* |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
18 |
* |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
21 |
* questions. |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
22 |
*/ |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
23 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
24 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
25 |
/* |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
26 |
* @test ClassInitializationTest |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
27 |
* @bug 8142976 |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
28 |
* @library /testlibrary |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
29 |
* @compile BadMap50.jasm |
35193
1e85994e9f56
8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents:
34628
diff
changeset
|
30 |
* @build jdk.test.lib.OutputAnalyzer jdk.test.lib.Platform jdk.test.lib.ProcessTools |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
31 |
* @run driver ClassInitializationTest |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
32 |
*/ |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
33 |
|
35193
1e85994e9f56
8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents:
34628
diff
changeset
|
34 |
import jdk.test.lib.OutputAnalyzer; |
1e85994e9f56
8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents:
34628
diff
changeset
|
35 |
import jdk.test.lib.Platform; |
1e85994e9f56
8145445: [TESTBUG] runtime/logging tests need to properly build and import libraries
rprotacio
parents:
34628
diff
changeset
|
36 |
import jdk.test.lib.ProcessTools; |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
37 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
38 |
public class ClassInitializationTest { |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
39 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
40 |
public static void main(String... args) throws Exception { |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
41 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
42 |
// (1) |
38151
fffedc5e5cf8
8154110: Update class* and safepoint* logging subsystems
mockner
parents:
37453
diff
changeset
|
43 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info", |
35858
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
44 |
"-Xverify:all", |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
45 |
"-Xmx64m", |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
46 |
"BadMap50"); |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
47 |
OutputAnalyzer out = new OutputAnalyzer(pb.start()); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
48 |
out.shouldContain("Start class verification for:"); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
49 |
out.shouldContain("End class verification for:"); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
50 |
out.shouldContain("Initializing"); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
51 |
out.shouldContain("Verification for BadMap50 failed"); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
52 |
out.shouldContain("Fail over class verification to old verifier for: BadMap50"); |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
53 |
|
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
54 |
// (2) |
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
55 |
if (Platform.isDebugBuild()) { |
38151
fffedc5e5cf8
8154110: Update class* and safepoint* logging subsystems
mockner
parents:
37453
diff
changeset
|
56 |
pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=info", |
35858
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
57 |
"-Xverify:all", |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
58 |
"-XX:+EagerInitialization", |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
59 |
"-Xmx64m", |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
60 |
InnerClass.class.getName()); |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
61 |
out = new OutputAnalyzer(pb.start()); |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
62 |
out.shouldContain("[Initialized").shouldContain("without side effects]"); |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
63 |
out.shouldHaveExitValue(0); |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
64 |
} |
37453
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
65 |
|
38151
fffedc5e5cf8
8154110: Update class* and safepoint* logging subsystems
mockner
parents:
37453
diff
changeset
|
66 |
// (3) class+init should turn off. |
fffedc5e5cf8
8154110: Update class* and safepoint* logging subsystems
mockner
parents:
37453
diff
changeset
|
67 |
pb = ProcessTools.createJavaProcessBuilder("-Xlog:class+init=off", |
37453
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
68 |
"-Xverify:all", |
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
69 |
"-Xmx64m", |
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
70 |
"BadMap50"); |
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
71 |
out = new OutputAnalyzer(pb.start()); |
38151
fffedc5e5cf8
8154110: Update class* and safepoint* logging subsystems
mockner
parents:
37453
diff
changeset
|
72 |
out.shouldNotContain("[class,init]"); |
37453
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
73 |
out.shouldNotContain("Fail over class verification to old verifier for: BadMap50"); |
e333d1d43e75
8145704: Make test for classinit logging more robust.
mockner
parents:
37044
diff
changeset
|
74 |
|
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
75 |
} |
35858
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
76 |
public static class InnerClass { |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
77 |
public static void main(String[] args) throws Exception { |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
78 |
System.out.println("Inner Class"); |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
79 |
} |
6e704583a38f
8146435: [TESTBUG] Logging tests are failing intermittently on windows when executed by JPRT
rprotacio
parents:
35193
diff
changeset
|
80 |
} |
34628
6d08ec72803b
8142976: Reimplement TraceClassInitialization with Unified Logging
mockner
parents:
diff
changeset
|
81 |
} |