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