Skip to content

Commit

Permalink
Backport 2b4a4b7bd84806f997adc107abbd4351425e8d1d
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Sep 19, 2024
1 parent 5faa0df commit bfaef7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,16 @@ private void check(Collection<Assertion> assertions) {
}

private static void checkGCCounters() {
// System.out.println("WhiteBox.getWhiteBox().g1GetTotalCollections() = \t" + WhiteBox.getWhiteBox().g1GetTotalCollections());
// System.out.println("WhiteBox.getWhiteBox().g1GetTotalFullCollections() = \t" + WhiteBox.getWhiteBox().g1GetTotalFullCollections());
GarbageCollectorMXBean oldGenBean = null;
for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
System.out.println("bean.getName() = \t\"" + bean.getName() + "\", bean.getCollectionCount() = \t" + bean.getCollectionCount());
if (bean.getName().contains("Old")) {
oldGenBean = bean;
}
}
// if (WhiteBox.getWhiteBox().g1GetTotalFullCollections() != 0 || (oldGenBean != null && oldGenBean.getCollectionCount() != 0)) {

if (oldGenBean != null && oldGenBean.getCollectionCount() != 0) {
throw new RuntimeException("Full gc happened. Test was useless.");
throw new SkippedException("Full gc happened, skip the test.");
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/hotspot/jtreg/vmTestbase/nsk/share/test/Tests.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

package nsk.share.test;

import jtreg.SkippedException;

import nsk.share.log.*;
import nsk.share.runner.*;
import nsk.share.TestFailure;
Expand Down Expand Up @@ -82,6 +84,8 @@ public void execute(Object o) {
((Runnable) o).run();
if (o instanceof TestExitCode)
exitCode = ((TestExitCode) o).getExitCode();
} catch (SkippedException se) {
throw se;
} catch (RuntimeException t) {
getLog().error(t);
exitCode = 97;
Expand Down

0 comments on commit bfaef7c

Please sign in to comment.