Skip to content

Commit 405eec8

Browse files
committed
8270961: [TESTBUG] Move GotWrongOOMEException into vm.share.gc package
Backport-of: 258f188bff07b6c873128a181746afcf8053d936
1 parent e06115c commit 405eec8

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,13 @@
2424

2525
import java.net.MalformedURLException;
2626

27+
import vm.share.gc.HeapOOMEException;
2728
import vm.share.gc.TriggerUnloadingByFillingMetaspace;
2829
import vm.share.gc.TriggerUnloadingHelper;
2930
import vm.share.gc.TriggerUnloadingWithWhiteBox;
3031

3132
import metaspace.stressHierarchy.common.classloader.tree.Node;
3233
import metaspace.stressHierarchy.common.classloader.tree.Tree;
33-
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
3434
import metaspace.stressHierarchy.common.exceptions.TimeIsOverException;
3535
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper;
3636
import metaspace.stressHierarchy.common.generateHierarchy.GenerateHierarchyHelper.Type;
@@ -109,8 +109,8 @@ public void run() {
109109

110110
System.out.println("Whole test took " + ((System.currentTimeMillis() - startTimeStamp)/1000/60.0) +" min");
111111
log.info("Test PASSED");
112-
} catch (GotWrongOOMEException e) {
113-
log.info("GotWrongOOMEExc: " + e.getMessage());
112+
} catch (HeapOOMEException e) {
113+
log.info("HeapOOMEException: " + e.getMessage());
114114
log.info("Got wrong type of OOME. We are passing test as it breaks test logic. We have dedicated test configurations" +
115115
" for each OOME type provoking class unloading, that's why we are not missing test coverage here.");
116116
} catch (OutOfMemoryError e) {

test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/exceptions/GotWrongOOMEException.java renamed to test/hotspot/jtreg/vmTestbase/vm/share/gc/HeapOOMEException.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -20,18 +20,16 @@
2020
* or visit www.oracle.com if you need additional information or have any
2121
* questions.
2222
*/
23-
package metaspace.stressHierarchy.common.exceptions;
23+
package vm.share.gc;
2424

2525
/**
26-
* Usually this means that we got OOME:heap while trying to gain OOME:metaspace.
27-
* We pass test in this case as this breaks test logic. We have dedicated test configurations
28-
* for OOME:heap provoking class unloading, that why we are not missing test coverage here.
26+
* This class is used to distinguish between OOME in metaspace and OOME in heap when triggering class unloading.
2927
*/
30-
public class GotWrongOOMEException extends RuntimeException {
28+
public class HeapOOMEException extends RuntimeException {
3129

3230
private static final long serialVersionUID = 1L;
3331

34-
public GotWrongOOMEException(String string) {
32+
public HeapOOMEException(String string) {
3533
super(string);
3634
}
3735

test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,6 @@
2323
package vm.share.gc;
2424

2525
import nsk.share.test.ExecutionController;
26-
import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
2726
import nsk.share.gc.gp.classload.GeneratedClassProducer;
2827

2928
public class TriggerUnloadingByFillingMetaspace implements
@@ -50,7 +49,7 @@ public void triggerUnloading(ExecutionController stresser) {
5049
generatedClassProducer.get().create(-100500); //argument is not used.
5150
} catch (Throwable oome) {
5251
if (!isInMetaspace(oome)) {
53-
throw new GotWrongOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
52+
throw new HeapOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
5453
}
5554
gotOOME = true;
5655
}

0 commit comments

Comments
 (0)