author | iignatyev |
Wed, 02 May 2018 16:43:56 -0700 | |
changeset 49958 | cc29d7717e3a |
permissions | -rw-r--r-- |
49958
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
1 |
/* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
2 |
* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
4 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
8 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
13 |
* accompanied this code). |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
14 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
18 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
21 |
* questions. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
22 |
*/ |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
23 |
|
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
24 |
|
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
25 |
/* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
26 |
* @test |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
27 |
* @key stress |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
28 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
29 |
* @summary converted from VM Testbase nsk/monitoring/stress/thread/strace006. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
30 |
* VM Testbase keywords: [stress, monitoring, nonconcurrent, jdk_desktop] |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
31 |
* VM Testbase readme: |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
32 |
* DESCRIPTION |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
33 |
* The test checks that ThreadInfo.getStackTrace() returns correct results for |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
34 |
* a thread in "running" state. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
35 |
* Main thread starts a number of auxiliary threads. This number is specified |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
36 |
* in "-threadCount" option. Auxiliary threads begin a recursion until they |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
37 |
* reach specified depth ("-depth" option). Each thread may use pure java |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
38 |
* and/or native methods based on "-invocationType" option. Then the threads |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
39 |
* wait until they get a notification from main thread. So, those auxiliary |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
40 |
* threads are definitly in "running" state when main thread performs their |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
41 |
* checks. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
42 |
* Main thread makes a snapshot of stack trace for all threads and checks it: |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
43 |
* 1. If a thread is alive, ThreadMonitor.getThreadInfo(long, -1) must |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
44 |
* return not null ThreadInfo. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
45 |
* 2. The length of a trace must not be greater than (depth + 3). Number |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
46 |
* of recursionJava() or recursionNative() methods must not be greater |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
47 |
* than depth, also one Object.wait() or Thread.yield() method, one |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
48 |
* run(), and one waitForSign(). |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
49 |
* 3. The latest method of the stack trace must be RunningThread.run(). |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
50 |
* 4. getClassName() and getMethodName() methods must return expected |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
51 |
* values for each element of the stack trace. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
52 |
* If one of that testcases fail, the test also fails. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
53 |
* After all threads are checked, main thread notifies them to complete their |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
54 |
* job. Then the test repeats the procedure with starting threads and |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
55 |
* performing checks ITERATIONS times. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
56 |
* This particular test performs access to the MBeans' methods through custom |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
57 |
* MBeanServer and uses native methods in auxiliary threads. |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
58 |
* COMMENTS |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
59 |
* |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
60 |
* @library /vmTestbase |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
61 |
* /test/lib |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
62 |
* @run driver jdk.test.lib.FileInstaller . . |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
63 |
* @run main/othervm/native |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
64 |
* nsk.monitoring.stress.thread.strace001 |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
65 |
* -testMode=server |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
66 |
* -MBeanServer=custom |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
67 |
* -invocationType=native |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
68 |
* -threadCount=50 |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
69 |
* -depth=200 |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
70 |
*/ |
cc29d7717e3a
8199375: [TESTBUG] Open source vm testbase monitoring tests
iignatyev
parents:
diff
changeset
|
71 |