test/jdk/sun/misc/SunMiscSignalTest.java
author mdoerr
Thu, 17 May 2018 14:19:54 +0200
changeset 50162 f9fe56417050
parent 48875 c1e7612f6b11
child 58744 c9c3bb79861e
permissions -rw-r--r--
8202713: Create a MacroAssembler::access_load/store_at wrapper for S390 and PPC Reviewed-by: eosterlund, goetz
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     1
/*
48875
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     4
 *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    10
 *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    15
 * accompanied this code).
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    16
 *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    20
 *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    23
 * questions.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    24
 */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    25
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    26
import java.util.ArrayList;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    27
import java.util.List;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    28
import java.util.Objects;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    29
import java.util.concurrent.Semaphore;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    30
import java.util.concurrent.TimeUnit;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    31
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    32
import org.testng.Assert;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    33
import org.testng.TestNG;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    34
import org.testng.annotations.Test;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    35
import org.testng.annotations.BeforeSuite;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    36
import org.testng.annotations.DataProvider;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    37
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    38
import jdk.test.lib.Platform;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    39
import jdk.test.lib.Utils;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    40
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    41
import sun.misc.Signal;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    42
import sun.misc.SignalHandler;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    43
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    44
/*
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    45
 * @test
40686
1b855fa5c9c5 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 36970
diff changeset
    46
 * @library /test/lib
36966
4209c9e19c45 8153737: Unsupported Module
chegar
parents: 36740
diff changeset
    47
 * @modules jdk.unsupported
36970
ae857479b5a8 8153928: test/lib/share/classes/jdk/test/lib/Utils.java introduced dependency to java.base/jdk.internal.misc
amlu
parents: 36966
diff changeset
    48
 *          java.base/jdk.internal.misc
45466
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    49
 * @build jdk.test.lib.Utils
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    50
 *        jdk.test.lib.Asserts
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    51
 *        jdk.test.lib.JDKToolFinder
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    52
 *        jdk.test.lib.JDKToolLauncher
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    53
 *        jdk.test.lib.Platform
faf1c55d2046 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
iignatyev
parents: 40686
diff changeset
    54
 *        jdk.test.lib.process.*
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    55
 * @run testng/othervm -Xrs -DXrs=true SunMiscSignalTest
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    56
 * @run testng/othervm SunMiscSignalTest
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    57
 * @summary sun.misc.Signal test
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    58
 */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    59
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    60
@Test
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    61
public class SunMiscSignalTest {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    62
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    63
    // Set to true to enable additional debug output
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    64
    static boolean debug = true;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    65
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    66
    // True to test while running with -Xrs
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    67
    static boolean RUNNING_WITH_Xrs = Boolean.getBoolean("Xrs");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    68
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    69
    /**
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    70
     * Print a debug message if enabled.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    71
     *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    72
     * @param format the format
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    73
     * @param args   the arguments
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    74
     */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    75
    static void printf(String format, Object... args) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    76
        if (debug) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    77
            System.out.printf("    " + format, args);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    78
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    79
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    80
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    81
    enum IsSupported {NO, YES}
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    82
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    83
    enum CanRegister {NO, YES}
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    84
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    85
    enum CanRaise {NO, YES}
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    86
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    87
    enum Invoked {NO, YES}
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    88
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    89
    enum RestrictedSignals {NORMAL, XRS}
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    90
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    91
    @BeforeSuite
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    92
    static void setup() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    93
        System.out.printf("-Xrs: %s%n", RUNNING_WITH_Xrs);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    94
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    95
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    96
    // Provider of signals to be tested with variations for -Xrs and
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    97
    // platform dependencies
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    98
    // -Xrs restricted signals signals the VM will not handle SIGINT, SIGTERM, SIGHUP and others
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
    99
    @DataProvider(name = "supportedSignals")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   100
    static Object[][] supportedSignals() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   101
        RestrictedSignals rs = RUNNING_WITH_Xrs ? RestrictedSignals.XRS : RestrictedSignals.NORMAL;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   102
        CanRegister registerXrs = RUNNING_WITH_Xrs ? CanRegister.NO : CanRegister.YES;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   103
        CanRaise raiseXrs = RUNNING_WITH_Xrs ? CanRaise.NO : CanRaise.YES;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   104
        Invoked invokedXrs = RUNNING_WITH_Xrs ? Invoked.NO : Invoked.YES;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   105
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   106
        Object[][] commonSignals = new Object[][]{
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   107
                {"INT",  IsSupported.YES, registerXrs, raiseXrs, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   108
                {"TERM", IsSupported.YES, registerXrs, raiseXrs, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   109
                {"ABRT", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   110
        };
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   111
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   112
        Object[][] posixSignals = {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   113
                {"HUP",  IsSupported.YES, registerXrs, raiseXrs, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   114
                {"QUIT", IsSupported.YES, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   115
                {"USR1", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   116
                {"USR2", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   117
                {"PIPE", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   118
                {"ALRM", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   119
                {"CHLD", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   120
                {"CONT", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   121
                {"TSTP", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   122
                {"TTIN", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   123
                {"TTOU", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   124
                {"URG",  IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   125
                {"XCPU", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   126
                {"XFSZ", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   127
                {"VTALRM", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   128
                {"PROF", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   129
                {"WINCH", IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   130
                {"IO",   IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   131
                {"SYS",   IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   132
        };
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   133
48875
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   134
        Object[][] posixNonOSXSignals = {
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   135
                {"BUS",  IsSupported.YES, CanRegister.YES, CanRaise.YES, invokedXrs},
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   136
        };
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   137
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   138
        Object[][] posixOSXSignals = {
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   139
                {"BUS",  IsSupported.YES, CanRegister.NO, CanRaise.NO, Invoked.NO},
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   140
        };
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   141
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   142
        Object[][] windowsSignals = {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   143
                {"HUP",  IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   144
                {"QUIT", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   145
                {"BUS",  IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   146
                {"USR1", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   147
                {"USR2", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   148
                {"PIPE", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   149
                {"ALRM", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   150
                {"CHLD", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   151
                {"CONT", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   152
                {"TSTP", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   153
                {"TTIN", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   154
                {"TTOU", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   155
                {"URG",  IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   156
                {"XCPU", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   157
                {"XFSZ", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   158
                {"VTALRM", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   159
                {"PROF", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   160
                {"WINCH", IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   161
                {"IO",   IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   162
                {"SYS",  IsSupported.NO, CanRegister.NO, CanRaise.NO, Invoked.NO},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   163
        };
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   164
48875
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   165
        Object[][] combinedPosixSignals = concatArrays(posixSignals,
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   166
                                                       (Platform.isOSX() ? posixOSXSignals : posixNonOSXSignals));
c1e7612f6b11 8193308: Disallow installing user signal handlers for SIGBUS on OSX
rwestberg
parents: 47216
diff changeset
   167
        return concatArrays(commonSignals, (Platform.isWindows() ? windowsSignals : combinedPosixSignals));
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   168
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   169
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   170
    // Provider of invalid signal names
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   171
    @DataProvider(name = "invalidSunMiscSignalNames")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   172
    Object[][] invalidSunMiscSignalNames() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   173
        return new Object[][]{
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   174
                {""},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   175
                {"I"},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   176
                {"SIG"},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   177
                {"SIGabc"},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   178
                {"SIGINT"},     // prefix not allowed
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   179
                {"abc"},
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   180
        };
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   181
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   182
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   183
    static Object[][] concatArrays(Object[][]... arrays) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   184
        int l = 0;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   185
        for (Object[][] a : arrays) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   186
            l += a.length;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   187
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   188
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   189
        Object[][] newArray = new Object[l][];
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   190
        l = 0;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   191
        for (int i = 0; i < arrays.length; i++) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   192
            System.arraycopy(arrays[i], 0, newArray, l, arrays[i].length);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   193
            l += arrays[i].length;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   194
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   195
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   196
        return newArray;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   197
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   198
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   199
    // Return true if the signal is one of the shutdown signals known to the VM
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   200
    private static boolean isShutdownSignal(Signal signal) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   201
        String name = signal.getName();
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   202
        return name.equals("INT") || name.equals("HUP") || name.equals("TERM");
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   203
    }
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   204
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   205
    /**
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   206
     * Quick verification of supported signals using sun.misc.Signal.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   207
     *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   208
     * @param name the signal name
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   209
     * @throws InterruptedException would be an error if thrown
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   210
     */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   211
    @Test(dataProvider = "supportedSignals")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   212
    static void testSunMisc(String name, IsSupported supported, CanRegister register,
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   213
                            CanRaise raise, Invoked invoked) throws InterruptedException {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   214
        Handler h = new Handler();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   215
        SignalHandler orig = null;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   216
        Signal signal = null;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   217
        try {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   218
            signal = new Signal(name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   219
            Assert.assertEquals(supported, IsSupported.YES, "Unexpected support for " + name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   220
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   221
            Assert.assertEquals(signal.getName(), name, "getName() mismatch, ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   222
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   223
            Assert.assertEquals(signal.toString(), "SIG" + name, "toString() mismatch, ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   224
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   225
            try {
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   226
                orig = Signal.handle(signal, h);
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   227
                printf("oldHandler: %s%n", orig);
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   228
                Assert.assertEquals(CanRegister.YES, register, "Unexpected handle succeeded " + name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   229
                try {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   230
                    Signal.raise(signal);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   231
                    Assert.assertEquals(CanRaise.YES, raise, "Unexpected raise success for " + name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   232
                    Invoked inv = h.semaphore().tryAcquire(Utils.adjustTimeout(100L),
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   233
                            TimeUnit.MILLISECONDS) ? Invoked.YES : Invoked.NO;
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   234
                    if (!isShutdownSignal(signal)) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   235
                        // Normal case
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   236
                        Assert.assertEquals(inv, invoked, "handler not invoked;");
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   237
                    } else {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   238
                        if (orig == SignalHandler.SIG_IGN) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   239
                            Assert.assertEquals(inv, Invoked.NO, "handler should not be invoked");
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   240
                        } else {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   241
                            Assert.assertEquals(inv, invoked, "handler not invoked;");
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   242
                        }
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   243
                    }
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   244
                } catch (IllegalArgumentException uoe3) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   245
                    Assert.assertNotEquals(CanRaise.YES, raise, "raise failed for " + name +
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   246
                            ": " + uoe3.getMessage());
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   247
                }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   248
            } catch (IllegalArgumentException uoe2) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   249
                Assert.assertNotEquals(CanRegister.YES, register, "handle failed for: " + name +
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   250
                        ": " + uoe2.getMessage());
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   251
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   252
        } catch (IllegalArgumentException uoe) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   253
            Assert.assertNotEquals(IsSupported.YES, supported, "Support missing for " + name +
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   254
                    ": " + uoe.getMessage());
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   255
            return;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   256
        } finally {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   257
            // Restore original signal handler
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   258
            if (orig != null && signal != null) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   259
                Signal.handle(signal, orig);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   260
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   261
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   262
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   263
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   264
    // Test Signal is equal to itself and not equals to others
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   265
    @Test(dataProvider = "supportedSignals")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   266
    static void testEquals(String name, IsSupported supported, CanRegister register,
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   267
                           CanRaise raise, Invoked invoked) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   268
        Object[][] data = supportedSignals();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   269
        for (int i = 0; i < data.length; i++) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   270
            IsSupported otherSupported = (IsSupported) data[i][1];
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   271
            if (supported == IsSupported.NO || otherSupported == IsSupported.NO) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   272
                continue;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   273
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   274
            String otherName = (String) data[i][0];
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   275
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   276
            Signal sig1 = new Signal(name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   277
            Signal sig2 = new Signal(otherName);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   278
            if (name.equals(otherName)) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   279
                Assert.assertEquals(sig1, sig2, "Equals failed; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   280
                Assert.assertEquals(sig1.hashCode(), sig2.hashCode(), "HashCode wrong; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   281
            } else {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   282
                Assert.assertNotEquals(sig1, sig2, "NotEquals failed; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   283
                Assert.assertNotEquals(sig1.hashCode(), sig2.hashCode(), "HashCode wrong; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   284
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   285
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   286
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   287
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   288
    @Test(dataProvider = "invalidSunMiscSignalNames")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   289
    static void testSunMiscIAE(String name) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   290
        try {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   291
            new Signal(name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   292
            Assert.fail("Should have thrown IAE for signal: " + name);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   293
        } catch (IllegalArgumentException iae) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   294
            Assert.assertEquals(iae.getMessage(), "Unknown signal: " + name, "getMessage() incorrect; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   295
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   296
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   297
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   298
    // Note: JDK 8 did not check/throw NPE, passing null resulted in a segv
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   299
    @Test(expectedExceptions = NullPointerException.class)
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   300
    static void nullSignal() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   301
        new Signal(null);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   302
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   303
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   304
    // Test expected exception when raising a signal when no handler defined
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   305
    @Test
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   306
    static void testRaiseNoConsumer() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   307
        Signal signal = new Signal("INT");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   308
        SignalHandler orig = null;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   309
        try {
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   310
            orig = Signal.handle(signal, SignalHandler.SIG_DFL);
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   311
            printf("oldHandler: %s%n", orig);
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   312
            if (orig == SignalHandler.SIG_IGN) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   313
                // SIG_IGN for TERM means it cannot be handled
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   314
                return;
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   315
            }
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   316
            Signal.raise(signal);
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   317
            Assert.fail("Should have thrown IllegalArgumentException");
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   318
        } catch (IllegalArgumentException iae) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   319
            printf("IAE message: %s%n", iae.getMessage());
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   320
        } finally {
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   321
            // Restore original signal handler
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   322
            if (orig != null && signal != null) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   323
                Signal.handle(signal, orig);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   324
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   325
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   326
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   327
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   328
    /**
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   329
     * The thread that runs the handler for sun.misc.Signal should be a
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   330
     * Daemon thread.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   331
     */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   332
    @Test
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   333
    static void isDaemonThread() throws InterruptedException {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   334
        if (RUNNING_WITH_Xrs) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   335
            return;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   336
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   337
        Handler handler = new Handler();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   338
        Signal signal = new Signal("INT");
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   339
        SignalHandler orig = Signal.handle(signal, handler);
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   340
        printf("oldHandler: %s%n", orig);
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   341
        if (orig == SignalHandler.SIG_IGN) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   342
            // SIG_IGN for INT means it cannot be handled
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   343
            return;
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   344
        }
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   345
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   346
        Signal.raise(signal);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   347
        boolean handled = handler.semaphore()
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   348
                .tryAcquire(Utils.adjustTimeout(100L), TimeUnit.MILLISECONDS);
36740
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   349
        if (!handled) {
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   350
            // For debug try again
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   351
            printf("Second try to see signal");
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   352
            handled = handler.semaphore()
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   353
                    .tryAcquire(Utils.adjustTimeout(2L), TimeUnit.SECONDS);
f80cd68bc7f4 8152005: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36117
diff changeset
   354
        }
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   355
        Assert.assertEquals(handled, !RUNNING_WITH_Xrs,
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   356
                "raising s.m.Signal did not get a callback;");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   357
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   358
        Assert.assertTrue(handler.wasDaemon(), "Thread.isDaemon running the handler; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   359
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   360
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   361
    // Check that trying to invoke SIG_DFL.handle throws UnsupportedOperationException.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   362
    @Test(expectedExceptions = UnsupportedOperationException.class)
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   363
    static void cannotHandleSIGDFL() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   364
        Signal signal = new Signal("INT");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   365
        Assert.assertNotNull(SignalHandler.SIG_DFL, "SIG_DFL null; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   366
        SignalHandler.SIG_DFL.handle(signal);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   367
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   368
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   369
    // Check that trying to invoke SIG_IGN.handle throws UnsupportedOperationException.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   370
    @Test(expectedExceptions = UnsupportedOperationException.class)
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   371
    static void cannotHandleSIGIGN() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   372
        Signal signal = new Signal("INT");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   373
        Assert.assertNotNull(SignalHandler.SIG_IGN, "SIG_IGN null; ");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   374
        SignalHandler.SIG_IGN.handle(signal);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   375
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   376
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   377
    // Check that setting a Signal handler returns the previous handler.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   378
    @Test()
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   379
    static void checkLastHandler() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   380
        if (RUNNING_WITH_Xrs) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   381
            return;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   382
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   383
        Signal signal = new Signal("TERM");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   384
        Handler h1 = new Handler();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   385
        Handler h2 = new Handler();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   386
        SignalHandler orig = Signal.handle(signal, h1);
36117
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   387
        if (orig == SignalHandler.SIG_IGN) {
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   388
            // SIG_IGN for TERM means it cannot be handled
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   389
            return;
f3e1df22686a 8150337: sun/misc/SunMiscSignalTest.java failed intermittently
rriggs
parents: 36009
diff changeset
   390
        }
36009
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   391
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   392
        try {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   393
            SignalHandler prev = Signal.handle(signal, h2);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   394
            Assert.assertSame(prev, h1, "prev handler mismatch");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   395
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   396
            prev = Signal.handle(signal, h1);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   397
            Assert.assertSame(prev, h2, "prev handler mismatch");
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   398
        } finally {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   399
            if (orig != null && signal != null) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   400
                Signal.handle(signal, orig);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   401
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   402
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   403
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   404
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   405
    /**
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   406
     * Test Handler, a SignalHandler for Signal notifications.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   407
     * Signals a semaphore when invoked and records whether
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   408
     * the thread calling the Handler was a daemon.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   409
     */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   410
    static class Handler implements SignalHandler {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   411
        // A semaphore to check for accept being called
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   412
        Semaphore sema = new Semaphore(0);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   413
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   414
        Boolean wasDaemon = null;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   415
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   416
        Semaphore semaphore() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   417
            return sema;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   418
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   419
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   420
        synchronized Boolean wasDaemon() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   421
            return wasDaemon;
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   422
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   423
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   424
        /**
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   425
         * Releases the semaphore when called as SignalHandler.handle.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   426
         *
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   427
         * @param signal the Signal that occurred
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   428
         */
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   429
        @Override
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   430
        public void handle(Signal signal) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   431
            synchronized (this) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   432
                wasDaemon = Thread.currentThread().isDaemon();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   433
            }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   434
            sema.release();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   435
            printf("sun.misc.handle sig: %s, num: %d%n", signal.getName(), signal.getNumber());
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   436
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   437
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   438
        public String toString() {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   439
            return "Handler: sem: " + sema.getQueueLength() +
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   440
                    ", wasDaemon: " + Objects.toString(wasDaemon());
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   441
        }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   442
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   443
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   444
    // Main can be used to run the tests from the command line with only testng.jar.
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   445
    @SuppressWarnings("raw_types")
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   446
    @Test(enabled = false)
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   447
    public static void main(String[] args) {
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   448
        Class<?>[] testclass = {SunMiscSignalTest.class};
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   449
        TestNG testng = new TestNG();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   450
        testng.setTestClasses(testclass);
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   451
        testng.run();
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   452
    }
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   453
2dbdf909ac81 8149750: Decouple sun.misc.Signal from the base module
rriggs
parents:
diff changeset
   454
}