jdk/test/com/sun/jdi/JITDebug.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1999-2006 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
 *  Note 1: JITDebug.java is no longer a standalone regression test,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
 *  due to chronic test failures on win32 platforms.  When testing,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
 *  use the wrapper script (JITDebug.sh) instead, which will in turn
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 *  invoke this program.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *  The problems are related to inconsistent use of "SystemRoot"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *  versus "SYSTEMROOT" environment variables in different win32 O/S
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *  installations.  Refer to the Comments and Evaluation on bugs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *  4522770 and 4461673 for more information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *  Undefined SystemRoot in a win32 environment causes the O/S socket()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *  layer to fail with WSAEPROVIDERFAILEDINIT.  The workaround used by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *  JITDebug.sh and JITDebug.java is to select the dt_shmem transport
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *  on any win32 platform where SystemRoot is not found.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *  Note 2: What seems to be an excessive use of System.xxx.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *  is actually necessary to combat lost output on win32 systems.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *  @t e s t
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *  @bug 4291701 4376819 4422312 4522770
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *  @summary Test JIT debugging -
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *  assure that launching on uncaught exception works
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *  @author Robert Field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *  @run main/othervm JITDebug
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
import com.sun.jdi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
import com.sun.jdi.connect.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * This class implements three separate small programs, each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * of which (directly or indirectly) invokes the next.  These
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * programs are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *    test launcher -
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *        Runs the debug target.  It exists to work around a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *        bug in the test tools which do not allow quoted spaces
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *        in command lines.  It launchs the debug target in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *        such a way that when it encounters an uncaught exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 *        it (in turn) will launch the trivial debugger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *    debug target -
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *        A one line program which throws an uncaught exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *    trivial debugger -
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 *        A debugger which attachs to the debug target and shuts
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *        it down with a zero exit code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * These programs are differentiated by their command line arguments:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *    test launcher - (no args)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *    debug target - ("TARGET")
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 *    trivial debugger - ("DEBUGGER", host and port)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
public class JITDebug {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        if (!new JITDebug().parseArgs(args)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
            throw new RuntimeException("Unexpected command line arguments: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                                       + args);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    boolean parseArgs(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        switch (args.length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        case 0:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            testLaunch();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        case 1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            if (args[0].equals("TARGET")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                debugTarget();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
            if (args[0].equals("DEBUGGER")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                trivialDebugger(args[2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    void testLaunch() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        class DisplayOutput extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
            InputStream in;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
            DisplayOutput(InputStream in) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                this.in = in;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
            public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                    transfer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                } catch (IOException exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
                    new RuntimeException("Unexpected exception: " + exc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
            void transfer() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                int ch;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                while ((ch = in.read()) != -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                    System.out.print((char)ch);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                in.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        String transportMethod = System.getProperty("TRANSPORT_METHOD");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        if (transportMethod == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            transportMethod = "dt_socket"; //Default to socket transport.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        String javaExe = System.getProperty("java.home") +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                         File.separator + "bin" + File.separator +"java";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        List largs = new ArrayList();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        largs.add(javaExe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        largs.add("-agentlib:jdwp=transport=" + transportMethod + ",server=y,onuncaught=y," +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                  "launch=" +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                  javaExe + " -DTRANSPORT_METHOD=" + transportMethod + " " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                  this.getClass().getName() + " DEBUGGER ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        largs.add("JITDebug");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        largs.add("TARGET");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        System.out.println("Launching: " + largs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        String[] sargs = (String[])largs.toArray(new String[largs.size()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        Runtime rt = Runtime.getRuntime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            Process proc = rt.exec(VMConnection.insertDebuggeeVMOptions(sargs));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            DisplayOutput inThread = new DisplayOutput(proc.getInputStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
            DisplayOutput erThread = new DisplayOutput(proc.getErrorStream());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            inThread.start();  // transfer all in&err
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            erThread.start();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            inThread.join();  // make sure they are done
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            erThread.join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            int exitValue = proc.waitFor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
            if (exitValue != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                throw new RuntimeException("Failure exit status: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                                           exitValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        } catch (Exception exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            throw new RuntimeException("Unexpected exception: " + exc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        System.out.println("JIT Debugging test PASSED");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    void displayOutput(InputStream in) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    // Target VM code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    void debugTarget() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        System.out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        System.out.println("trigger onuncaught launch");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        System.out.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        throw new RuntimeException("Start-up onuncaught handling");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    void trivialDebugger(String transportAddress) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        System.out.println("trivial debugger started");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        String transportMethod = System.getProperty("TRANSPORT_METHOD");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        String connectorName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        if ("dt_shmem".equals(transportMethod)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            connectorName = "com.sun.jdi.SharedMemoryAttach";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        } else if ("dt_socket".equals(transportMethod)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            connectorName = "com.sun.jdi.SocketAttach";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            System.err.println("Unknown transportMethod: " + transportMethod + " - hanging");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            hang();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        List conns = Bootstrap.virtualMachineManager().attachingConnectors();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        for (Iterator it = conns.iterator(); it.hasNext(); ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            AttachingConnector conn = (AttachingConnector)it.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            if (conn.name().equals(connectorName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                doAttach(connectorName, conn, transportAddress);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        System.err.println("No attaching connector matching: " + connectorName + " - hanging");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        hang();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    void doAttach(String connectorName, AttachingConnector conn, String transportAddress) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        Map connArgs = conn.defaultArguments();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        if ("com.sun.jdi.SharedMemoryAttach".equals(connectorName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            Connector.Argument portArg = (Connector.Argument)connArgs.get("name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            portArg.setValue(transportAddress);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
            Connector.Argument portArg = (Connector.Argument)connArgs.get("port");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            portArg.setValue(transportAddress);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            VirtualMachine vm = conn.attach(connArgs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            System.out.println("attached to: " + transportAddress);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
            vm.exit(0); // we are happy - terminate VM with no error
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            System.out.println("we are happy - terminated VM with no error");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        } catch (Exception exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            System.err.println("Exception: " + exc + " - hanging");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            System.err.flush();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            hang();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    /** Hang so that test fails */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    void hang() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            // ten minute nap
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            Thread.currentThread().sleep(10 * 60 * 1000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        } catch (InterruptedException exc) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            // shouldn't happen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
}