test/hotspot/jtreg/gc/metaspace/TestMetaspaceInitialization.java
author iignatyev
Wed, 17 Jan 2018 21:44:44 -0800
changeset 48791 6e079ff6c83c
parent 47216 71c04702a3d5
child 53523 4c5184c56dc2
permissions -rw-r--r--
8186635: ClassFileInstaller should be run as a driver Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     1
/*
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     4
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     8
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    13
 * accompanied this code).
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    14
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    18
 *
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    21
 * questions.
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    22
 */
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    23
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    24
import java.util.ArrayList;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    25
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    26
/* @test TestMetaspaceInitialization
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
    27
 * @bug 8024945
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    28
 * @summary Tests to initialize metaspace with a very low MetaspaceSize
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 24847
diff changeset
    29
 * @modules java.base/jdk.internal.misc
39692
57f307f875e0 8024945: Remove check on minimum size of MetaspaceSize
jmasa
parents: 38152
diff changeset
    30
 * @run main/othervm -XX:MetaspaceSize=0 TestMetaspaceInitialization
24847
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    31
 */
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    32
public class TestMetaspaceInitialization {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    33
    private class Internal {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    34
        public int x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    35
        public Internal(int x) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    36
            this.x = x;
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    37
        }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    38
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    39
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    40
    private void test() {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    41
        ArrayList<Internal> l = new ArrayList<>();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    42
        l.add(new Internal(17));
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    43
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    44
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    45
    public static void main(String[] args) {
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    46
        new TestMetaspaceInitialization().test();
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    47
    }
37c354b113fe 8042933: assert(capacity_until_gc >= committed_bytes) failed
ehelin
parents:
diff changeset
    48
}