Path: blob/master/test/hotspot/jtreg/vmTestbase/gc/hashcode/HashCodeTestP/HashCodeTestP.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/HashCodeTestP.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 promotion.33*34* COMMENTS35* This test was ported from JRockit test suite.36*37* @library /vmTestbase38* /test/lib39* @run main/othervm -XX:-UseGCOverheadLimit gc.hashcode.HashCodeTestP.HashCodeTestP40*/4142package gc.hashcode.HashCodeTestP;4344import gc.hashcode.HCHelper;45import nsk.share.TestFailure;46import nsk.share.gc.GC;47import nsk.share.gc.GCTestBase;48import nsk.share.gc.gp.GarbageUtils;49import nsk.share.test.Stresser;5051/**52* Test that verifies external hash codes. This class tests the scenario53* with promotion.54*/55public class HashCodeTestP extends GCTestBase {5657/**58* Test external hash codes when a promotion have been performed.59*60* @return Success if all hash codes matches original hash codes61*/62@Override63public final void run() {64HCHelper hch = new HCHelper(512, 2000, runParams.getSeed(),650.7, 10240);6667hch.setupLists();68Stresser stresser = new Stresser(runParams.getStressOptions());69stresser.start(0);70GarbageUtils.eatMemory(stresser);71if (!stresser.continueExecution()) {72return;// we didn't trigger GC, nothing73}74boolean testResult = hch.verifyHashCodes();75hch.cleanupLists();7677if(!testResult) {78throw new TestFailure("Some hash codes didn't match");79}80}8182public static void main(String[] args) {83GC.runTest(new HashCodeTestP(), args);84}85}868788