test/hotspot/jtreg/vmTestbase/nsk/share/Harakiri.java
author jcbeyler
Wed, 21 Nov 2018 10:46:45 -0800
changeset 52642 9cfc8b0c45fd
parent 49934 44839fbb20db
permissions -rw-r--r--
8214149: Move out assignments when not using NSK*VERIFY macros Summary: Move out the assignments from ifs Reviewed-by: sspitsyn, cjplummer
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49934
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     1
/*
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     2
 * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     4
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     8
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    14
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    18
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    21
 * questions.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    22
 */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    23
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    24
package nsk.share;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    25
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    26
/**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    27
 * Harakiri is used to terminate a stress test with PASS exit status
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    28
 * before the test is terminated as timed out (and so failed).
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    29
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    30
 * <p>Harakiri class holds a thread which sleeps for the given amount
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    31
 * of time, and then wakes up and executes <tt>System.exit()</tt>
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    32
 * with the given exit status. That thread is daemon, so it doesn't
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    33
 * prevent application from exiting once all its threads finish
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    34
 * before it's time for harakiri. Appointing harakiri in zero
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    35
 * delay implies immediate <tt>exit()</tt>.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    36
 *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    37
 * <p>There is a limitation: you may appoint no more than one harakiri
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    38
 * per application.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    39
 */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    40
public class Harakiri {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    41
    /**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    42
     * Use specific <tt>appoint()</tt> method to appoint harakiri.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    43
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    44
     * @see #appoint(int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    45
     * @see #appoint(int,int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    46
     */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    47
    protected Harakiri() {}
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    48
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    49
    /**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    50
     * One harakiri per application, or <tt>null</tt> (by default).
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    51
     */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    52
    private static Thread harakiri = null;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    53
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    54
    /**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    55
     * <p>Return timeout (or waittime) value munus the margin
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    56
     * value (which is assumed 1 minute by default).
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    57
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    58
     * <p>Treat <tt>args[0]</tt> as <tt>$TIMEOUT</tt> value, or seek for
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    59
     * <tt>-waittime=$WAITTIME</tt> value. If both parameters
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    60
     * (or either none of them) are assigned, throw an exception to
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    61
     * report parameters inconsistency.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    62
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    63
     * <p>Also, seek for <tt>-margin=...</tt> assignment, or assume margin
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    64
     * is 1 minute.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    65
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    66
     * @param args Is usually obtained via the application's command-line.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    67
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    68
     * @throws IllegalArgumentException If <tt>args[]</tt> is inconsistent.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    69
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    70
     * @see #appoint(int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    71
     * @see #appoint(int,int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    72
     */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    73
    public static int parseAppointment(String args[]) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    74
        int timeout=-1, margin=1;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    75
        int timeouts=0, waittimes=0, margins=0;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    76
        for (int i=0; i<args.length; i++) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    77
            if (args[i].startsWith("-")) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    78
                if (args[i].startsWith("-waittime=")) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    79
                    timeout = Integer.parseInt(args[i].substring(10));
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    80
                    waittimes++;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    81
                }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    82
                if (args[i].startsWith("-margin=")) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    83
                    margin = Integer.parseInt(args[i].substring(8));
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    84
                    margins++;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    85
                }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    86
            } else {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    87
                if (i == 0) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    88
                    timeout = Integer.parseInt(args[i]);
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    89
                    timeouts++;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    90
                }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    91
            }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    92
        };
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    93
        if (timeouts==0 && waittimes==0)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    94
            throw new IllegalArgumentException(
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    95
                "no $TIMEOUT, nor -waittime=$WAITTIME is set");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    96
        if (waittimes > 1)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    97
            throw new IllegalArgumentException(
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    98
                "more than one -waittime=... is set");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
    99
        if (margins > 1)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   100
            throw new IllegalArgumentException(
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   101
                "more than one -margin=... is set");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   102
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   103
        int result = timeout - margin;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   104
        if (result <= 0)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   105
            throw new IllegalArgumentException(
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   106
                "delay appointment must be greater than "+margin+" minutes");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   107
        return result;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   108
    }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   109
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   110
    /**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   111
     * Appoint harakiri after the given amount of <tt>minutes</tt>,
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   112
     * so that exit status would be 95 (to simulate JCK-like PASS
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   113
     * status).
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   114
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   115
     * @throws IllegalStateException If harakiri is already appointed.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   116
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   117
     * @see #appoint(int,int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   118
     * @see #parseAppointment(String[])
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   119
     */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   120
    public static void appoint(int minutes) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   121
        appoint(minutes,95); // JCK-like PASS status
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   122
    }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   123
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   124
    /**
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   125
     * Appoint Harakiri for the given amount of <tt>minutes</tt>,
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   126
     * so that the given <tt>status</tt> would be exited when time
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   127
     * is over.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   128
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   129
     * @throws IllegalStateException If harakiri is already appointed.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   130
     *
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   131
     * @see #appoint(int)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   132
     * @see #parseAppointment(String[])
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   133
     */
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   134
    public static void appoint(int minutes, int status) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   135
        if (harakiri != null)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   136
            throw new IllegalStateException("Harakiri is already appointed.");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   137
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   138
        final long timeToExit = System.currentTimeMillis() + 60*1000L*minutes;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   139
        final int  exitStatus = status;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   140
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   141
        harakiri = new Thread(Harakiri.class.getName()) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   142
            public void run() {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   143
                long timeToSleep = timeToExit - System.currentTimeMillis();
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   144
                if (timeToSleep > 0)
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   145
                    try {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   146
                        //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   147
                        // Use wait() instead of sleep(), because Java 2
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   148
                        // specification doesn't guarantee the method
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   149
                        // sleep() to yield to other threads.
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   150
                        //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   151
                        Object someDummyObject = new Object();
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   152
                        synchronized (someDummyObject) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   153
                            someDummyObject.wait(timeToSleep);
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   154
                        }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   155
                    } catch (InterruptedException exception) {
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   156
                        exception.printStackTrace(System.err);
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   157
                       //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   158
                       // OOPS, the dagger for harakiri looks broken:
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   159
                       //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   160
                       return;
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   161
                    };
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   162
                //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   163
                // OK, lets do it now:
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   164
                //
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   165
                System.err.println(
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   166
                    "#\n# Harakiri: prescheduled program termination.\n#");
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   167
                System.exit(exitStatus); // harakiri to all threads
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   168
            }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   169
        };
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   170
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   171
        harakiri.setPriority(Thread.MAX_PRIORITY);
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   172
        harakiri.setDaemon(true);
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   173
        harakiri.start();
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   174
    }
44839fbb20db 8199643: [TESTBUG] Open source common VM testbase code
iignatyev
parents:
diff changeset
   175
}