8270961: [TESTBUG] Move GotWrongOOMEException into vm.share.gc package

Reviewed-by: kbarrett, tschatzl
This commit is contained in:
Leonid Mesnik 2021-07-22 18:18:14 +00:00
parent 3cadc36060
commit 258f188bff
3 changed files with 11 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,13 +24,13 @@ package metaspace.stressHierarchy.common;
import java.net.MalformedURLException;
import vm.share.gc.HeapOOMEException;
import vm.share.gc.TriggerUnloadingByFillingMetaspace;
import vm.share.gc.TriggerUnloadingHelper;
import vm.share.gc.TriggerUnloadingWithWhiteBox;
import metaspace.stressHierarchy.common.classloader.tree.Node;
import metaspace.stressHierarchy.common.classloader.tree.Tree;
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
import metaspace.stressHierarchy.common.exceptions.TimeIsOverException;
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper;
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper.Type;
@ -109,8 +109,8 @@ abstract public class StressHierarchyBaseClass extends TestBase {
System.out.println("Whole test took " + ((System.currentTimeMillis() - startTimeStamp)/1000/60.0) +" min");
log.info("Test PASSED");
} catch (GotWrongOOMEException e) {
log.info("GotWrongOOMEExc: " + e.getMessage());
} catch (HeapOOMEException e) {
log.info("HeapOOMEException: " + e.getMessage());
log.info("Got wrong type of OOME. We are passing test as it breaks test logic. We have dedicated test configurations" +
" for each OOME type provoking class unloading, that's why we are not missing test coverage here.");
} catch (OutOfMemoryError e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -20,18 +20,16 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package metaspace.stressHierarchy.common.exceptions;
package vm.share.gc;
/**
* Usually this means that we got OOME:heap while trying to gain OOME:metaspace.
* We pass test in this case as this breaks test logic. We have dedicated test configurations
* for OOME:heap provoking class unloading, that why we are not missing test coverage here.
* This class is used to distinguish between OOME in metaspace and OOME in heap when triggering class unloading.
*/
public class GotWrongOOMEException extends RuntimeException {
public class HeapOOMEException extends RuntimeException {
private static final long serialVersionUID = 1L;
public GotWrongOOMEException(String string) {
public HeapOOMEException(String string) {
super(string);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,6 @@
package vm.share.gc;
import nsk.share.test.ExecutionController;
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
import nsk.share.gc.gp.classload.GeneratedClassProducer;
public class TriggerUnloadingByFillingMetaspace implements
@ -50,7 +49,7 @@ public class TriggerUnloadingByFillingMetaspace implements
generatedClassProducer.get().create(-100500); //argument is not used.
} catch (Throwable oome) {
if (!isInMetaspace(oome)) {
throw new GotWrongOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
throw new HeapOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
}
gotOOME = true;
}