Java Code Examples for jdk.test.lib.Asserts#assertGTE()
The following examples show how to use
jdk.test.lib.Asserts#assertGTE() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GetCodeHeapEntriesTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void test() { System.out.printf("type %s%n", type); long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id); Asserts.assertNE(0, addr, "allocation failed"); CodeBlob[] blobs = CodeBlob.getCodeBlobs(type); Asserts.assertNotNull(blobs); CodeBlob blob = Arrays.stream(blobs) .filter(GetCodeHeapEntriesTest::filter) .findAny() .get(); Asserts.assertNotNull(blob); Asserts.assertEQ(blob.code_blob_type, type); Asserts.assertGTE(blob.size, SIZE); WHITE_BOX.freeCodeBlob(addr); blobs = CodeBlob.getCodeBlobs(type); long count = Arrays.stream(blobs) .filter(GetCodeHeapEntriesTest::filter) .count(); Asserts.assertEQ(0L, count); }
Example 2
Source File: VMBase.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public void testAction() { commonTests(); runVmTests(); cleanup(); if (runServer.orElseThrow(() -> new Error("runServer must be set")) && WhiteBox.getWhiteBox().getBooleanVMFlag("TieredCompilation")) { for (int stop = 1; stop < CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION; stop++) { String vmOpt = "-XX:TieredStopAtLevel=" + stop; generateReplay(/* need coredump = */ false, vmOpt); int replayCompLevel = getCompLevelFromReplay(); Asserts.assertGTE(stop, replayCompLevel, "Unexpected compLevel in replay"); positiveTest(vmOpt); } } }
Example 3
Source File: TestRTMTotalCountIncrRate.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Usage: * Test <inflate monitor> */ public static void main(String args[]) throws Throwable { Asserts.assertGTE(args.length, 1, "One argument required."); Test test = new Test(); boolean shouldBeInflated = Boolean.valueOf(args[0]); if (shouldBeInflated) { AbortProvoker.inflateMonitor(test.monitor); } for (long i = 0L; i < Test.TOTAL_ITERATIONS; i++) { AbortProvoker.verifyMonitorState(test.monitor, shouldBeInflated); // Force abort on first iteration to avoid rare case when // there were no aborts and locks count was not incremented // with RTMTotalCountIncrRate > 1 (in such case JVM won't // print JVM locking statistics). test.lock(i == 0); } }
Example 4
Source File: TestCapacityUntilGCWrapAround.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { if (Platform.is32bit()) { WhiteBox wb = WhiteBox.getWhiteBox(); long before = wb.metaspaceCapacityUntilGC(); // Now force possible overflow of capacity_until_GC. long after = wb.incMetaspaceCapacityUntilGC(MAX_UINT); Asserts.assertGTE(after, before, "Increasing with MAX_UINT should not cause wrap around: " + after + " < " + before); Asserts.assertLTE(after, MAX_UINT, "Increasing with MAX_UINT should not cause value larger than MAX_UINT:" + after); } }
Example 5
Source File: TestDriver.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void verifyVectorizationNumber(List<String> vectorizationLog) { for (Map.Entry<String, Long> entry : expectedVectorizationNumbers.entrySet()) { String v = "\t" + entry.getKey(); long actualNum = vectorizationLog.stream() .filter(s -> s.contains(v)).count(); long expectedNum = entry.getValue(); Asserts.assertGTE(actualNum, expectedNum, "Unexpected " + entry.getKey() + " number"); } }
Example 6
Source File: RecompilationTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override protected void test() throws Exception { if (testCase.isOsr()) { /* aot compiler is not using osr compilation */ System.out.println("Skipping OSR case"); return; } Executable e = testCase.getExecutable(); Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), testCase.name() + ": an executable expected to be compiled"); Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), COMP_LEVEL_AOT, String.format("%s: unexpected compilation level at start", testCase.name())); compile(); Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), testCase.name() + ": method expected to be compiled"); /* a case with AOT'ed code checks exact compilation level equality while another case checks minimum level and if method compiled because there might be different compilation level transitions */ if (CHECK_LEVEL != COMP_LEVEL_AOT) { Asserts.assertGTE(WHITE_BOX.getMethodCompilationLevel(e), CHECK_LEVEL, String.format("%s: expected compilation level" + " after compilation to be no less than %d for %s", testCase.name(), CHECK_LEVEL, testCase.name())); } else { Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), COMP_LEVEL_AOT, String.format("%s: expected compilation" + " level after compilation to be equal to %d for %s", testCase.name(), COMP_LEVEL_AOT, testCase.name())); } }
Example 7
Source File: CorrectnessTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) { if (!Platform.isServer() || Platform.isEmulatedClient()) { throw new Error("TESTBUG: Not server mode"); } Asserts.assertGTE(args.length, 1); ProfilingType profilingType = ProfilingType.valueOf(args[0]); if (runTests(profilingType)) { System.out.println("ALL TESTS PASSED"); } else { throw new RuntimeException("SOME TESTS FAILED"); } }
Example 8
Source File: TestRTMAbortRatio.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Usage: * Test <inflate monitor> */ public static void main(String args[]) throws Throwable { Asserts.assertGTE(args.length, 1, "One argument required."); Test t = new Test(); boolean shouldBeInflated = Boolean.valueOf(args[0]); if (shouldBeInflated) { AbortProvoker.inflateMonitor(t.monitor); } for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) { AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); t.lock(i >= Test.WARMUP_ITERATIONS); } }
Example 9
Source File: TestRTMLockingThreshold.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Usage: * Test <inflate monitor> */ public static void main(String args[]) throws Throwable { Asserts.assertGTE(args.length, 2, "Two arguments required."); Test t = new Test(); boolean shouldBeInflated = Boolean.valueOf(args[0]); int lockingThreshold = Integer.valueOf(args[1]); if (shouldBeInflated) { AbortProvoker.inflateMonitor(t.monitor); } for (int i = 0; i < Test.TOTAL_ITERATIONS; i++) { AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); t.lock(i >= lockingThreshold / 2); } }
Example 10
Source File: TestRTMDeoptOnLowAbortRatio.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Usage: * Test <inflate monitor> */ public static void main(String args[]) throws Throwable { Asserts.assertGTE(args.length, 1, "One argument required."); Test t = new Test(); boolean shouldBeInflated = Boolean.valueOf(args[0]); if (shouldBeInflated) { AbortProvoker.inflateMonitor(t.monitor); } for (int i = 0; i < AbortProvoker.DEFAULT_ITERATIONS; i++) { AbortProvoker.verifyMonitorState(t.monitor, shouldBeInflated); t.forceAbort(i >= TestRTMDeoptOnLowAbortRatio.ABORT_THRESHOLD); } }
Example 11
Source File: TestCodeCacheConfig.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Recording recording = new Recording(); recording.enable(EVENT_NAME); recording.start(); recording.stop(); List<RecordedEvent> events = Events.fromRecording(recording); Events.hasEvents(events); RecordedEvent event = events.get(0); long initialSize = (long) event.getValue("initialSize"); long reservedSize = (long) event.getValue("reservedSize"); long nonNMethodSize = (long) event.getValue("nonNMethodSize"); long profiledSize = (long) event.getValue("profiledSize"); long nonProfiledSize = (long) event.getValue("nonProfiledSize"); long expansionSize = (long) event.getValue("expansionSize"); long minBlockLength = (long) event.getValue("minBlockLength"); long startAddress = (long) event.getValue("startAddress"); long reservedTopAddress = (long) event.getValue("reservedTopAddress"); Asserts.assertGT(initialSize, 1024L, "initialSize less than 1024 byte, got " + initialSize); Asserts.assertEQ(reservedSize, CodeCacheExpectedSize, String.format("Unexpected reservedSize value. Expected %d but " + "got %d", CodeCacheExpectedSize, reservedSize)); Asserts.assertLTE(nonNMethodSize, CodeCacheExpectedSize, String.format("Unexpected nonNMethodSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonNMethodSize)); Asserts.assertLTE(profiledSize, CodeCacheExpectedSize, String.format("Unexpected profiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, profiledSize)); Asserts.assertLTE(nonProfiledSize, CodeCacheExpectedSize, String.format("Unexpected nonProfiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonProfiledSize)); Asserts.assertGTE(expansionSize, 1024L, "expansionSize less than 1024 " + "bytes, got " + expansionSize); Asserts.assertGTE(minBlockLength, 1L, "minBlockLength less than 1 byte, got " + minBlockLength); Asserts.assertNE(startAddress, 0L, "startAddress null"); Asserts.assertNE(reservedTopAddress, 0L, "codeCacheReservedTopAddr null"); }
Example 12
Source File: TestCodeCacheConfig.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws Exception { Recording recording = new Recording(); recording.enable(EVENT_NAME); recording.start(); recording.stop(); List<RecordedEvent> events = Events.fromRecording(recording); Events.hasEvents(events); RecordedEvent event = events.get(0); long initialSize = (long) event.getValue("initialSize"); long reservedSize = (long) event.getValue("reservedSize"); long nonNMethodSize = (long) event.getValue("nonNMethodSize"); long profiledSize = (long) event.getValue("profiledSize"); long nonProfiledSize = (long) event.getValue("nonProfiledSize"); long expansionSize = (long) event.getValue("expansionSize"); long minBlockLength = (long) event.getValue("minBlockLength"); long startAddress = (long) event.getValue("startAddress"); long reservedTopAddress = (long) event.getValue("reservedTopAddress"); Asserts.assertGT(initialSize, 1024L, "initialSize less than 1024 byte, got " + initialSize); Asserts.assertEQ(reservedSize, CodeCacheExpectedSize, String.format("Unexpected reservedSize value. Expected %d but " + "got %d", CodeCacheExpectedSize, reservedSize)); Asserts.assertLTE(nonNMethodSize, CodeCacheExpectedSize, String.format("Unexpected nonNMethodSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonNMethodSize)); Asserts.assertLTE(profiledSize, CodeCacheExpectedSize, String.format("Unexpected profiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, profiledSize)); Asserts.assertLTE(nonProfiledSize, CodeCacheExpectedSize, String.format("Unexpected nonProfiledSize value. Expected <= %d but " + "got %d", CodeCacheExpectedSize, nonProfiledSize)); Asserts.assertGTE(expansionSize, 1024L, "expansionSize less than 1024 " + "bytes, got " + expansionSize); Asserts.assertGTE(minBlockLength, 1L, "minBlockLength less than 1 byte, got " + minBlockLength); Asserts.assertNE(startAddress, 0L, "startAddress null"); Asserts.assertNE(reservedTopAddress, 0L, "codeCacheReservedTopAddr null"); }
Example 13
Source File: CodeCacheUtils.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * Verifies that 'newValue' is equal to 'oldValue' if usage of the * corresponding code heap is predictable. Checks the weaker condition * 'newValue >= oldValue' if usage is not predictable because intermediate * allocations may happen. * * @param btype BlobType of the code heap to be checked * @param newValue New value to be verified * @param oldValue Old value to be verified * @param msg Error message if verification fails */ public static void assertEQorGTE(BlobType btype, long newValue, long oldValue, String msg) { if (CodeCacheUtils.isCodeHeapPredictable(btype)) { // Usage is predictable, check strong == condition Asserts.assertEQ(newValue, oldValue, msg); } else { // Usage is not predictable, check weaker >= condition Asserts.assertGTE(newValue, oldValue, msg); } }