Skip to content

Commit

Permalink
[GR-54177] Disable TestSocketEvents and TestSocketChannelEvents. Fix …
Browse files Browse the repository at this point in the history
…a problem with TestContainerEvent.

PullRequest: graal/17831
  • Loading branch information
jovanstevanovic committed May 29, 2024
2 parents bd21cc7 + deda8f5 commit 8f0d1e6
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import java.util.List;

import com.oracle.svm.core.heap.PhysicalMemory;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.ProcessProperties;

import com.oracle.svm.core.Containers;
Expand Down Expand Up @@ -361,7 +363,8 @@ public boolean isContainerized() {

@Substitute
public long hostTotalMemory() {
/* Not implemented at the moment. */
return 0;
// This is intentionally using PhysicalMemorySupport since we are
// interested in the host values (and not the containerized values).
return ImageSingletons.lookup(PhysicalMemory.PhysicalMemorySupport.class).size().rawValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import java.util.List;

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import org.junit.Assume;
import org.junit.Test;

Expand Down Expand Up @@ -66,7 +67,9 @@ private static void validateEvents(List<RecordedEvent> events) {
long hostTotalMem = re.getValue("hostTotalMemory");
assertTrue(hostTotalMem > 0);

long hostTotalSwap = re.getValue("hostTotalSwapMemory");
assertTrue("Host swap not implemented", hostTotalSwap < 0);
if (JavaVersionUtil.JAVA_SPEC >= 23) {
long hostTotalSwap = re.getValue("hostTotalSwapMemory");
assertTrue("Host swap not implemented", hostTotalSwap < 0);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
package com.oracle.svm.test.jfr;

import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand All @@ -35,8 +36,10 @@
import java.nio.channels.SocketChannel;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import jdk.jfr.Recording;
import jdk.jfr.consumer.RecordedEvent;

Expand All @@ -46,6 +49,11 @@ public class TestSocketChannelEvents extends JfrRecordingTest {
public static int PORT = 9876;
public static String HOST = "127.0.0.1";

@BeforeClass
public static void checkJavaVersion() {
assumeTrue("skipping JFR socket channel test", JavaVersionUtil.JAVA_SPEC >= 22);
}

@Test
public void test() throws Throwable {
String[] events = new String[]{"jdk.SocketRead", "jdk.SocketWrite"};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
package com.oracle.svm.test.jfr;

import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -36,8 +37,10 @@
import java.net.Socket;
import java.util.List;

import org.junit.BeforeClass;
import org.junit.Test;

import jdk.graal.compiler.serviceprovider.JavaVersionUtil;
import jdk.jfr.Recording;
import jdk.jfr.consumer.RecordedEvent;

Expand All @@ -46,6 +49,11 @@ public class TestSocketEvents extends JfrRecordingTest {
public static int PORT = 9876;
public static String HOST = "127.0.0.1";

@BeforeClass
public static void checkJavaVersion() {
assumeTrue("skipping JFR socket test", JavaVersionUtil.JAVA_SPEC >= 22);
}

@Test
public void test() throws Throwable {
String[] events = new String[]{"jdk.SocketRead", "jdk.SocketWrite"};
Expand Down

0 comments on commit 8f0d1e6

Please sign in to comment.