test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001.java
author iignatyev
Wed, 30 May 2018 20:54:45 -0700
changeset 50317 cf71bff5f533
permissions -rw-r--r--
8199371: [TESTBUG] Open source vm testbase JDWP tests Reviewed-by: sspitsyn, mseledtsov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50317
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     1
/*
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     2
 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     4
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     8
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    14
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    18
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    21
 * questions.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    22
 */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    23
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    24
package nsk.jdwp.Event.VM_DEATH;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    25
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    26
import java.io.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    27
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    28
import nsk.share.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    29
import nsk.share.jpda.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    30
import nsk.share.jdwp.*;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    31
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    32
/**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    33
 * Test for JDWP event: VM_DEATH.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    34
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    35
 * See vmdeath001.README for description of test execution.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    36
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    37
 * This class represents debugger part of the test.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    38
 * Test is executed by invoking method runIt().
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    39
 * JDWP event is tested in the method waitForTestedEvent().
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    40
 *
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    41
 * @see #runIt()
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    42
 * @see #waitForTestedEvent()
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    43
 */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    44
public class vmdeath001 {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    45
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    46
    // exit status constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    47
    static final int JCK_STATUS_BASE = 95;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    48
    static final int PASSED = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    49
    static final int FAILED = 2;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    50
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    51
    // package and classes names constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    52
    static final String PACKAGE_NAME = "nsk.jdwp.Event.VM_DEATH";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    53
    static final String TEST_CLASS_NAME = PACKAGE_NAME + "." + "vmdeath001";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    54
    static final String DEBUGEE_CLASS_NAME = TEST_CLASS_NAME + "a";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    55
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    56
    // tested JDWP command constants
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    57
    static final String JDWP_COMMAND_NAME = "Event.Composite";
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    58
    static final int JDWP_COMMAND_ID = JDWP.Command.Event.Composite;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    59
    static final int JDWP_EVENT_KIND = JDWP.EventKind.VM_DEATH;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    60
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    61
    // usual scaffold objects
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    62
    ArgumentHandler argumentHandler = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    63
    Log log = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    64
    Binder binder = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    65
    Debugee debugee = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    66
    Transport transport = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    67
    int waitTime = 0;  // minutes
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    68
    long timeout = 0;  // milliseconds
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    69
    boolean dead = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    70
    boolean success = true;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    71
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    72
    // -------------------------------------------------------------------
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    73
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    74
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    75
     * Start test from command line.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    76
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    77
    public static void main(String argv[]) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    78
        System.exit(run(argv,System.out) + JCK_STATUS_BASE);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    79
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    80
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    81
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    82
     * Start test from JCK-compilant environment.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    83
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    84
    public static int run(String argv[], PrintStream out) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    85
        return new vmdeath001().runIt(argv, out);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    86
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    87
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    88
    // -------------------------------------------------------------------
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    89
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    90
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    91
     * Perform test execution.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    92
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    93
    public int runIt(String argv[], PrintStream out) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    94
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    95
        // make log for debugger messages
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    96
        argumentHandler = new ArgumentHandler(argv);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    97
        log = new Log(out, argumentHandler);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    98
        waitTime = argumentHandler.getWaitTime();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
    99
        timeout = waitTime * 60 * 1000;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   100
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   101
        // execute test and display results
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   102
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   103
            log.display("\n>>> Starting debugee \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   104
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   105
            // launch debuggee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   106
            binder = new Binder(argumentHandler, log);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   107
            log.display("Launching debugee");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   108
            debugee = binder.bindToDebugee(DEBUGEE_CLASS_NAME);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   109
            transport = debugee.getTransport();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   110
            log.display("  ... debugee launched");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   111
            log.display("");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   112
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   113
            // set timeout for debuggee responces
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   114
            log.display("Setting timeout for debuggee responces: " + waitTime + " minute(s)");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   115
            transport.setReadTimeout(timeout);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   116
            log.display("  ... timeout set");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   117
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   118
            // wait for debuggee started
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   119
            log.display("Waiting for VM_INIT event");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   120
            debugee.waitForVMInit();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   121
            log.display("  ... VM_INIT event received");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   122
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   123
            // query debugee for VM-dependent ID sizes
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   124
            log.display("Querying for IDSizes");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   125
            debugee.queryForIDSizes();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   126
            log.display("  ... size of VM-dependent types adjusted");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   127
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   128
            // resume debuggee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   129
            log.display("Resumindg debuggee");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   130
            debugee.resume();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   131
            log.display("  ... debuggee resumed");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   132
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   133
            // wait for tested VM_DEATH event
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   134
            log.display("\n>>> Testing JDWP event \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   135
            waitForTestedEvent();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   136
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   137
        } catch (Failure e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   138
            log.complain("TEST FAILED: " + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   139
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   140
        } catch (Exception e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   141
            e.printStackTrace(out);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   142
            log.complain("Caught unexpected exception while running the test:\n\t" + e);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   143
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   144
        } finally {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   145
            // quit debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   146
            log.display("\n>>> Finishing test \n");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   147
            quitDebugee();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   148
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   149
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   150
        // check test results
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   151
        if (!success) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   152
            log.complain("TEST FAILED");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   153
            return FAILED;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   154
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   155
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   156
        out.println("TEST PASSED");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   157
        return PASSED;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   158
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   159
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   160
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   161
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   162
     * Wait for tested VM_DEATH event.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   163
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   164
    void waitForTestedEvent() {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   165
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   166
        EventPacket eventPacket = null;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   167
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   168
        // receive reply packet from debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   169
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   170
            log.display("Waiting for event packet (for " + timeout + "ms timeout)");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   171
            eventPacket = debugee.getEventPacket(timeout);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   172
            log.display("  ... event packet received:\n" + eventPacket);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   173
        } catch (IOException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   174
            log.complain("Unable to read tested event packet:\n\t" + e);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   175
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   176
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   177
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   178
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   179
        // check reply packet header
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   180
        try{
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   181
            log.display("Checking header of event packet");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   182
            eventPacket.checkHeader();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   183
            log.display("  ... packet header is OK");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   184
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   185
            log.complain("Bad header of tested event packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   186
                        + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   187
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   188
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   189
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   190
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   191
        // start parsing reply packet data
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   192
        log.display("Parsing event packet:");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   193
        eventPacket.resetPosition();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   194
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   195
        // get suspendPolicy value
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   196
        byte suspendPolicy = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   197
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   198
            suspendPolicy = eventPacket.getByte();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   199
            log.display("    suspendPolicy: " + suspendPolicy);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   200
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   201
            log.complain("Unable to get suspendPolicy value from tested event packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   202
                        + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   203
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   204
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   205
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   206
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   207
        // check suspendPolicy value
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   208
        if (suspendPolicy != JDWP.SuspendPolicy.NONE) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   209
            log.complain("Unexpected SuspendPolicy in tested event packet: " +
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   210
                        suspendPolicy + " (expected: " + JDWP.SuspendPolicy.NONE + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   211
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   212
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   213
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   214
        // get events count
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   215
        int events = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   216
        try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   217
            events = eventPacket.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   218
            log.display("    events: " + events);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   219
        } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   220
            log.complain("Unable to get events count from tested event packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   221
                        + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   222
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   223
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   224
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   225
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   226
        // check events count
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   227
        if (events < 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   228
            log.complain("Negative value of events number in tested event packet: " +
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   229
                        events + " (expected: " + 1 + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   230
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   231
        } else if (events != 1) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   232
            log.complain("Invalid number of events in tested event packet: " +
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   233
                        events + " (expected: " + 1 + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   234
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   235
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   236
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   237
        // extract each event
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   238
        for (int i = 0; i < events; i++) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   239
            log.display("    event #" + i + ":");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   240
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   241
            // get eventKind
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   242
            byte eventKind = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   243
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   244
                eventKind = eventPacket.getByte();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   245
                log.display("      eventKind: " + eventKind);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   246
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   247
                log.complain("Unable to get eventKind of event #" + i + " from tested event packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   248
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   249
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   250
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   251
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   252
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   253
            // check eventKind
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   254
            if (eventKind != JDWP.EventKind.VM_DEATH) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   255
                log.complain("Unexpected eventKind of event " + i + " in tested event packet: " +
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   256
                            eventKind + " (expected: " + JDWP.EventKind.VM_DEATH + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   257
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   258
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   259
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   260
            dead = true;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   261
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   262
            // get requestID
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   263
            int requestID = 0;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   264
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   265
                requestID = eventPacket.getInt();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   266
                log.display("      requestID: " + requestID);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   267
            } catch (BoundException e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   268
                log.complain("Unable to get requestID of event #" + i + " from tested event packet:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   269
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   270
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   271
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   272
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   273
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   274
            // check requestID
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   275
            if (requestID != 0) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   276
                log.complain("Unexpected requestID of event " + i + " in tested event packet: " +
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   277
                            requestID + " (expected: " + 0 + ")");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   278
                success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   279
                return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   280
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   281
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   282
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   283
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   284
        // check for extra data in event packet
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   285
        if (!eventPacket.isParsed()) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   286
            log.complain("Extra trailing bytes found in event packet at: "
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   287
                        + eventPacket.offsetString());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   288
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   289
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   290
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   291
        log.display("  ... event parsed");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   292
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   293
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   294
    /**
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   295
     * Disconnect debuggee and wait for it exited.
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   296
     */
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   297
    void quitDebugee() {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   298
        if (debugee == null)
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   299
            return;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   300
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   301
        // disconnect debugee
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   302
        if (!dead) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   303
            try {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   304
                log.display("Disconnecting debuggee");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   305
                debugee.dispose();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   306
                log.display("  ... debuggee disconnected");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   307
            } catch (Failure e) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   308
                log.display("Failed to finally disconnect debuggee:\n\t"
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   309
                            + e.getMessage());
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   310
            }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   311
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   312
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   313
        // wait for debugee exited
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   314
        log.display("Waiting for debuggee exit");
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   315
        int code = debugee.waitFor();
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   316
        log.display("  ... debuggee exited with exit code: " + code);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   317
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   318
        // analize debugee exit status code
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   319
        if (code != JCK_STATUS_BASE + PASSED) {
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   320
            log.complain("Debuggee FAILED with exit code: " + code);
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   321
            success = false;
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   322
        }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   323
    }
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   324
cf71bff5f533 8199371: [TESTBUG] Open source vm testbase JDWP tests
iignatyev
parents:
diff changeset
   325
}