test/gc/arguments/TestG1HeapRegionSize.java

changeset 7785
f967da7f0c3c
parent 0
f90c822e73f8
child 9595
26c65bb80287
     1.1 --- a/test/gc/arguments/TestG1HeapRegionSize.java	Wed Apr 22 05:05:49 2015 -0700
     1.2 +++ b/test/gc/arguments/TestG1HeapRegionSize.java	Thu Apr 23 15:59:48 2015 +0200
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 -* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8  *
     1.9  * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -25,11 +25,12 @@
    1.11   * @test TestG1HeapRegionSize
    1.12   * @key gc
    1.13   * @bug 8021879
    1.14 + * @requires vm.gc=="G1" | vm.gc=="null"
    1.15   * @summary Verify that the flag G1HeapRegionSize is updated properly
    1.16   * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
    1.17 - * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
    1.18 - * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
    1.19 - * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
    1.20 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
    1.21 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
    1.22 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432
    1.23   */
    1.24  
    1.25  import sun.management.ManagementFactoryHelper;
    1.26 @@ -41,14 +42,8 @@
    1.27    public static void main(String[] args) {
    1.28      HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
    1.29  
    1.30 -    VMOption option = diagnostic.getVMOption("UseG1GC");
    1.31 -    if (option.getValue().equals("false")) {
    1.32 -      System.out.println("Skipping this test. It is only a G1 test.");
    1.33 -      return;
    1.34 -    }
    1.35 -
    1.36      String expectedValue = getExpectedValue(args);
    1.37 -    option = diagnostic.getVMOption("G1HeapRegionSize");
    1.38 +    VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
    1.39      if (!expectedValue.equals(option.getValue())) {
    1.40        throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
    1.41      }

mercurial