test/hotspot/jtreg/vmTestbase/nsk/jdb/exclude/exclude001/exclude001.java
author gadams
Fri, 28 Sep 2018 14:31:36 -0400
changeset 51956 f1f7ff620f83
parent 51308 acf02a6f369e
permissions -rw-r--r--
8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again Reviewed-by: cjplummer, amenkov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     1
/*
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     2
 * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     4
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     8
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    14
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    18
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    21
 * questions.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    22
 */
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    23
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    24
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    25
/*
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    26
 * @test
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    27
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    28
 * @summary converted from VM Testbase nsk/jdb/exclude/exclude001.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    29
 * VM Testbase keywords: [jpda, jdb, quarantine]
51298
3e08503ad77e 8208358: update bug ids mentioned in tests
iignatyev
parents: 50889
diff changeset
    30
 * VM Testbase comments: 8191037
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    31
 * VM Testbase readme:
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    32
 * DECSRIPTION
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    33
 * A positive test for the 'exclude' command.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    34
 * The debuggee program (exclude001a.java) starts three
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    35
 * addional threads of MyThread class. The 'run' method of these
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    36
 * threads invokes java.lang.System.currentTimeMillis() and
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
    37
 * sun.util.calendar.Gregorian() methods.
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    38
 * There are three test cases:
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    39
 *  - block all exclude filter;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    40
 *  - modified exclude filter allowing tracing events for java.* methods,
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    41
 *    which is set with 'exclude javax.*,sun.*,com.sun.*,jdk.*' command;
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
    42
 *  - modified exclude filter allowing tracing events for sun.* methods,
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
    43
 *    which is set with 'exclude java.*,javax.*,com.sun.*,jdk.*' command.
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    44
 *  - non-modified, predefined exclude filter;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    45
 *  - modified exclude filter allowing tracing events for java.* methods,
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    46
 *    which is set with 'exclude javax.*,sun.*,com.sun.*' command;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    47
 *  - modified exclude filter allowing tracing events for all system methods,
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    48
 *    which is set with 'exclude none' command.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    49
 * For each test case the correspondent MyThread thread is started and
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    50
 * suspended at a breakpoint. Then method tracing is turned on with
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    51
 * 'trace methods <thread id>' command with correspondent exclude filtering.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    52
 * The test passes if debuggee suspends on method enter/exit of only
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    53
 * filtered classes, i.e. in comply with exclude filter previously set.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    54
 * The test consists of two program:
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    55
 *   exclude001.java - launches jdb and debuggee, writes commands to jdb, reads the jdb output,
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    56
 *   exclude001a.java - the debugged application.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    57
 * COMMENTS
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    58
 *
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    59
 * @library /vmTestbase
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    60
 *          /test/lib
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    61
 * @run driver jdk.test.lib.FileInstaller . .
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    62
 * @build nsk.jdb.exclude.exclude001.exclude001
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    63
 *        nsk.jdb.exclude.exclude001.exclude001a
51956
f1f7ff620f83 8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again
gadams
parents: 51308
diff changeset
    64
 * @run main/othervm/timeout=600 PropertyResolvingWrapper nsk.jdb.exclude.exclude001.exclude001
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    65
 *      -arch=${os.family}-${os.simpleArch}
51956
f1f7ff620f83 8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again
gadams
parents: 51308
diff changeset
    66
 *      -waittime=10
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    67
 *      -debugee.vmkind=java
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    68
 *      -transport.address=dynamic
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    69
 *      -jdb=${test.jdk}/bin/jdb
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    70
 *      -java.options="${test.vm.opts} ${test.java.opts}"
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    71
 *      -workdir=.
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    72
 *      -debugee.vmkeys="${test.vm.opts} ${test.java.opts}"
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    73
 */
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    74
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    75
package nsk.jdb.exclude.exclude001;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    76
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    77
import nsk.share.*;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    78
import nsk.share.jdb.*;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    79
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    80
import java.io.*;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    81
import java.util.*;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    82
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    83
public class exclude001 extends JdbTest {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    84
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    85
    public static void main (String argv[]) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    86
        System.exit(run(argv, System.out) + JCK_STATUS_BASE);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    87
    }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    88
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    89
    public static int run(String argv[], PrintStream out) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    90
        debuggeeClass =  DEBUGGEE_CLASS;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    91
        firstBreak = FIRST_BREAK;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    92
        lastBreak = LAST_BREAK;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    93
        return new exclude001().runTest(argv, out);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    94
    }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    95
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    96
    static final String PACKAGE_NAME    = "nsk.jdb.exclude.exclude001";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    97
    static final String TEST_CLASS      = PACKAGE_NAME + ".exclude001";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    98
    static final String DEBUGGEE_CLASS  = TEST_CLASS + "a";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
    99
    static final String FIRST_BREAK     = DEBUGGEE_CLASS + ".main";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   100
    static final String LAST_BREAK      = DEBUGGEE_CLASS + ".lastBreak";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   101
    static final String MYTHREAD        = "MyThread";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   102
    static final String DEBUGGEE_THREAD = PACKAGE_NAME + "." + MYTHREAD;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   103
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   104
    static final String JAVA_CORE_METHOD = "java.lang.System.currentTimeMillis";
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
   105
    static final String SUN_METHOD   = "sun.util.calendar.Gregorian";
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   106
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   107
    protected void runCases() {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   108
        String[] reply;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   109
        Paragrep grep;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   110
        int count;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   111
        Vector v;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   112
        String found;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   113
        String[] threads;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   114
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   115
        String oldExclude = "";
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   116
        boolean javaTraced = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   117
        boolean comTraced = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   118
        boolean nskTraced = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   119
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   120
        jdb.setBreakpointInMethod(LAST_BREAK);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   121
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   122
        // getting predefined 'exclude' value
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   123
        reply = jdb.receiveReplyFor(JdbCommand.exclude);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   124
        if (reply.length == 0) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   125
            log.complain("Predefined excluded lists of classes is empty");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   126
            success = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   127
        } else {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   128
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   129
            oldExclude = reply[0];
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   130
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   131
            for (int testCase = 0; testCase < exclude001a.numThreads; testCase++) {
51956
f1f7ff620f83 8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again
gadams
parents: 51308
diff changeset
   132
                String expectedPrompt = MYTHREAD + "-" + testCase + "[1]";
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   133
                reply = jdb.receiveReplyFor(JdbCommand.cont);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   134
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   135
                if (jdb.isAtBreakpoint(reply, LAST_BREAK)) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   136
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   137
                    threads = jdb.getThreadIds(DEBUGGEE_THREAD);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   138
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   139
                    if (threads.length != 1) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   140
                        log.complain("jdb should report 1 instance of " + DEBUGGEE_THREAD);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   141
                        log.complain("Found: " + threads.length);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   142
                        success = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   143
                    } else {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   144
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   145
                        reply = jdb.receiveReplyFor(JdbCommand.step); // to get out of lastBreak;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   146
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   147
                        switch (testCase) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   148
                        case 0: // block all
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   149
                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,sun.*,com.sun.*,jdk.*");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   150
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   151
                                break;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   152
                        case 1: // allow java.*
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   153
                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "javax.*,sun.*,com.sun.*,jdk.*");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   154
                                break;
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
   155
                        case 2: // allow sun.*
51956
f1f7ff620f83 8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again
gadams
parents: 51308
diff changeset
   156
                                reply = jdb.receiveReplyFor(JdbCommand.exclude + "java.*,javax.*,com.sun.*,jdk.*");
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   157
                                break;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   158
                        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   159
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   160
                        reply = jdb.receiveReplyFor(JdbCommand.trace + "methods " + threads[0]);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   161
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   162
                        while (true) {
51956
f1f7ff620f83 8208473: [TESTBUG] nsk/jdb/exclude/exclude001/exclude001.java is timing out on solaris-sparc again
gadams
parents: 51308
diff changeset
   163
                            reply = jdb.receiveReplyForWithMessageWait(JdbCommand.cont, expectedPrompt);
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   164
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   165
                            grep = new Paragrep(reply);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   166
                            count = grep.find(JAVA_CORE_METHOD);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   167
                            if (count > 0) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   168
                                if (testCase != 0) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   169
                                    javaTraced = true;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   170
                                } else {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   171
                                    log.complain("Trace message for excluded method: " + JAVA_CORE_METHOD);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   172
                                }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   173
                            }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   174
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
   175
                            count = grep.find(SUN_METHOD);
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   176
                            if (count > 0) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   177
                                if (testCase == 2) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   178
                                    comTraced = true;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   179
                                } else {
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
   180
                                    log.complain("Trace message for excluded method: " + SUN_METHOD);
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   181
                                }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   182
                            }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   183
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   184
                            count = grep.find(DEBUGGEE_THREAD + ".run");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   185
                            if (count > 0) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   186
                                nskTraced = true;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   187
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   188
                                reply = jdb.receiveReplyFor(JdbCommand.exclude + oldExclude);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   189
                                reply = jdb.receiveReplyFor(JdbCommand.untrace + "methods "+ threads[0]);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   190
                                break;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   191
                            }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   192
                        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   193
                    }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   194
                }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   195
            }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   196
        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   197
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   198
        jdb.contToExit(2);
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   199
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   200
        if (!javaTraced) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   201
            log.complain("There were no tracing events for " + JAVA_CORE_METHOD + "() method while turned off filter");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   202
            success = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   203
        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   204
        if (!comTraced) {
51049
70295a56c207 8206007: nsk/jdb/exclude001 test is taking a long time on some builds
gadams
parents: 50889
diff changeset
   205
            log.complain("There were no tracing events for " + SUN_METHOD + "() method while turned off filter");
50220
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   206
            success = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   207
        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   208
        if (!nskTraced) {
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   209
            log.complain("There were no tracing events for " + DEBUGGEE_THREAD + ".run() method ");
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   210
            success = false;
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   211
        }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   212
    }
31361382634b 8199379: [TESTBUG] Open source vm testbase JDB tests
iignatyev
parents:
diff changeset
   213
}