Skip to content

Commit

Permalink
Fixed test compatibility issues
Browse files Browse the repository at this point in the history
  • Loading branch information
apangin committed Sep 29, 2024
1 parent f43a6f8 commit 9db2631
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
13 changes: 4 additions & 9 deletions test/one/profiler/test/Runner.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,11 @@ private static Jvm detectJvm() {
}

private static int detectJvmVersion() {
String prop = System.getProperty("java.vm.version");
if (prop.startsWith("25.") && prop.charAt(3) > '0') {
return 8;
} else if (prop.startsWith("24.") && prop.charAt(3) > '0') {
return 7;
} else if (prop.startsWith("20.") && prop.charAt(3) > '0') {
return 6;
} else {
return Integer.parseInt(prop.substring(0, prop.indexOf('.')));
String prop = System.getProperty("java.vm.specification.version");
if (prop.startsWith("1.")) {
prop = prop.substring(2);
}
return Integer.parseInt(prop);
}

public static boolean enabled(Test test) {
Expand Down
7 changes: 4 additions & 3 deletions test/test/jfr/JfrTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import jdk.jfr.consumer.RecordedEvent;
import jdk.jfr.consumer.RecordingFile;
import one.profiler.test.Assert;
import one.profiler.test.Output;
import one.profiler.test.Test;
import one.profiler.test.TestProcess;
Expand Down Expand Up @@ -69,8 +70,8 @@ public void parseMultiModeRecording(TestProcess p) throws Exception {
}
}

assert eventsCount.get("jdk.ExecutionSample") >= 50;
assert eventsCount.get("jdk.JavaMonitorEnter") >= 500;
assert eventsCount.get("jdk.ObjectAllocationInNewTLAB") >= 1000;
Assert.isGreater(eventsCount.get("jdk.ExecutionSample"), 50);
Assert.isGreater(eventsCount.get("jdk.JavaMonitorEnter"), 50);
Assert.isGreater(eventsCount.get("jdk.ObjectAllocationInNewTLAB"), 100);
}
}
3 changes: 2 additions & 1 deletion test/test/lock/DatagramTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package test.lock;

import java.net.InetSocketAddress;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.util.concurrent.Executor;
Expand All @@ -32,7 +33,7 @@ public static void sendLoop() {

try {
while (true) {
buf.clear();
((Buffer) buf).clear();
ch.send(buf, remoteAddr);
totalPackets.incrementAndGet();
}
Expand Down

0 comments on commit 9db2631

Please sign in to comment.