author | lana |
Thu, 04 May 2017 00:02:23 +0000 | |
changeset 44892 | ec794e820a8e |
parent 40631 | ed82623d7831 |
child 44997 | 3f875168ce21 |
permissions | -rw-r--r-- |
36379
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
1 |
/* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
2 |
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
3 |
* Copyright (c) 2016, SAP SE and/or its affiliates. All rights reserved. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
5 |
* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
9 |
* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
10 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
11 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
12 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
13 |
* version 2 for more details (a copy is included in the LICENSE file that |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
14 |
* accompanied this code). |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
15 |
* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
16 |
* You should have received a copy of the GNU General Public License version |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
17 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
18 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
19 |
* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
20 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
21 |
* or visit www.oracle.com if you need additional information or have any |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
22 |
* questions. |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
23 |
*/ |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
24 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
25 |
/* |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
26 |
* @test |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
27 |
* @bug 8149036 8150619 |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
28 |
* @summary os+thread output should contain logging calls for thread start stop attaches detaches |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
36851
diff
changeset
|
29 |
* @library /test/lib |
36851 | 30 |
* @modules java.base/jdk.internal.misc |
36379
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
31 |
* java.management |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
32 |
* @run driver ThreadLoggingTest |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
33 |
* @author Thomas Stuefe (SAP) |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
34 |
*/ |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
35 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
36 |
import java.io.File; |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
37 |
import java.util.Map; |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
36851
diff
changeset
|
38 |
import jdk.test.lib.process.OutputAnalyzer; |
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
36851
diff
changeset
|
39 |
import jdk.test.lib.process.ProcessTools; |
36379
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
40 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
41 |
public class ThreadLoggingTest { |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
42 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
43 |
static void analyzeOutputForInfoLevel(OutputAnalyzer output) throws Exception { |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
44 |
output.shouldContain("Thread started"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
45 |
output.shouldContain("Thread is alive"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
46 |
output.shouldContain("Thread finished"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
47 |
output.shouldHaveExitValue(0); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
48 |
} |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
49 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
50 |
static void analyzeOutputForDebugLevel(OutputAnalyzer output) throws Exception { |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
51 |
analyzeOutputForInfoLevel(output); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
52 |
output.shouldContain("stack dimensions"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
53 |
output.shouldContain("stack guard pages"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
54 |
} |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
55 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
56 |
public static void main(String[] args) throws Exception { |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
57 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
58 |
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread", "-version"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
59 |
OutputAnalyzer output = new OutputAnalyzer(pb.start()); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
60 |
analyzeOutputForInfoLevel(output); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
61 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
62 |
pb = ProcessTools.createJavaProcessBuilder("-Xlog:os+thread=debug", "-version"); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
63 |
output = new OutputAnalyzer(pb.start()); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
64 |
analyzeOutputForDebugLevel(output); |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
65 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
66 |
} |
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
67 |
|
0c596dc28ed7
8150619: Improve thread based logging introduced with 8149036
stuefe
parents:
diff
changeset
|
68 |
} |