Path: blob/master/test/hotspot/jtreg/vmTestbase/gc/hashcode/HashCodeTestC/HashCodeTestC.java
40948 views
/*1* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* @test25* @key stress randomness26*27* @summary converted from VM Testbase gc/hashcode/HashCodeTestC.28* VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, jrockit]29* VM Testbase readme:30* DESCRIPTION31* Test that verifies external hash codes. This class tests the scenario32* with FullGC (compaction).33*34* COMMENTS35* This test was ported from JRockit test suite.36*37* @library /vmTestbase38* /test/lib39* @run main/othervm -XX:-UseGCOverheadLimit gc.hashcode.HashCodeTestC.HashCodeTestC40*/4142package gc.hashcode.HashCodeTestC;4344import gc.hashcode.HCHelper;45import nsk.share.TestFailure;46import nsk.share.gc.GC;47import nsk.share.gc.GCTestBase;48import nsk.share.test.Stresser;49import nsk.share.gc.gp.GarbageUtils;5051/**52* Test that verifies external hash codes. This class tests the scenario53* with compaction.54*/55public class HashCodeTestC extends GCTestBase {565758/**59* Test external hash codes when a compaction have been performed.60*61* @return Success if all hash codes matches original hash codes62*/63@Override64public void run(){65Stresser stresser = new Stresser(runParams.getStressOptions());66stresser.start(0);67HCHelper hch = new HCHelper(512, 3584, runParams.getSeed(),680.7, 10240);6970hch.setupLists();71hch.clearList(HCHelper.EVAC_LIST_1);72GarbageUtils.eatMemory(stresser);73if (!stresser.continueExecution()) {74return;// we didn't trigger GC, nothing75}76boolean testResult = hch.verifyHashCodes();77hch.cleanupLists();7879if(!testResult) {80throw new TestFailure("Some hash codes didn't match");81}82}8384public static void main(String[] args) {85GC.runTest(new HashCodeTestC(), args);86}8788}899091