hotspot/test/runtime/memory/RunUnitTestsConcurrently.java
author hseigel
Tue, 22 Sep 2015 14:24:31 -0400
changeset 32825 79488b52df9b
parent 30604 b8d532cb6420
child 33730 30e064828045
permissions -rw-r--r--
8135265: VM fails on 'empty' interface public <init>()V method with VerifyError Summary: Don't check for calls to super() or this() fro <init>()V methods if they are in interfaces. Because, they are not ctors. Reviewed-by: acorn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21554
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     1
/*
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28190
diff changeset
     2
 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
21554
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     4
 *
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     8
 *
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    13
 * accompanied this code).
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    14
 *
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    18
 *
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    21
 * questions.
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    22
 */
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    23
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    24
/*
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    25
 * @test
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    26
 * @summary Test launches unit tests inside vm concurrently
28190
5a6b07edeb21 8066433: Move Whitebox test library to top level repository
thartmann
parents: 25958
diff changeset
    27
 * @library /testlibrary /../../test/lib
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28190
diff changeset
    28
 * @modules java.base/sun.misc
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 28190
diff changeset
    29
 *          java.management
21554
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    30
 * @build RunUnitTestsConcurrently
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    31
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
25958
8dc85547d6d6 8011397: JTREG needs to copy additional WhiteBox class file to JTwork/scratch/sun/hotspot
mgerdin
parents: 21554
diff changeset
    32
 *                              sun.hotspot.WhiteBox$WhiteBoxPermission
21554
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    33
 * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI RunUnitTestsConcurrently 30 15000
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    34
 */
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    35
30604
b8d532cb6420 8067013: Rename the com.oracle.java.testlibary package
ykantser
parents: 29678
diff changeset
    36
import jdk.test.lib.*;
21554
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    37
import sun.hotspot.WhiteBox;
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    38
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    39
public class RunUnitTestsConcurrently {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    40
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    41
  private static WhiteBox wb;
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    42
  private static long timeout;
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    43
  private static long timeStamp;
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    44
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    45
  public static class Worker implements Runnable {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    46
    @Override
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    47
    public void run() {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    48
      while (System.currentTimeMillis() - timeStamp < timeout) {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    49
        WhiteBox.getWhiteBox().runMemoryUnitTests();
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    50
      }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    51
    }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    52
  }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    53
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    54
  public static void main(String[] args) throws InterruptedException {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    55
    if (!Platform.isDebugBuild() || !Platform.is64bit()) {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    56
      return;
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    57
    }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    58
    wb = WhiteBox.getWhiteBox();
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    59
    System.out.println("Starting threads");
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    60
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    61
    int threads = Integer.valueOf(args[0]);
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    62
    timeout = Long.valueOf(args[1]);
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    63
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    64
    timeStamp = System.currentTimeMillis();
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    65
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    66
    Thread[] threadsArray = new Thread[threads];
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    67
    for (int i = 0; i < threads; i++) {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    68
      threadsArray[i] = new Thread(new Worker());
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    69
      threadsArray[i].start();
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    70
    }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    71
    for (int i = 0; i < threads; i++) {
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    72
      threadsArray[i].join();
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    73
    }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    74
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    75
    System.out.println("Quitting test.");
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    76
  }
20b1821f4fbd 8027237: New tests on ReservedSpace/VirtualSpace classes
mgerdin
parents:
diff changeset
    77
}