From dbd9019078775ee64a30ebbf081553bd5c6b50c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kohlschu=CC=88tter?= Date: Wed, 14 Feb 2024 15:48:28 +0100 Subject: [PATCH] test: vsock: Suppress timeout exceptions seen on unconfigured systems Seen on S390x Linux emulation. --- .../net/unix/vsock/CancelAcceptTest.java | 18 +++++++++++ .../net/unix/vsock/TcpNoDelayTest.java | 31 +++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/CancelAcceptTest.java b/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/CancelAcceptTest.java index e925bea2d..3015cd081 100644 --- a/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/CancelAcceptTest.java +++ b/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/CancelAcceptTest.java @@ -17,11 +17,16 @@ */ package org.newsclub.net.unix.vsock; +import java.net.SocketTimeoutException; + +import org.junit.jupiter.api.Test; import org.newsclub.net.unix.AFSocketCapability; import org.newsclub.net.unix.AFSocketCapabilityRequirement; import org.newsclub.net.unix.AFVSOCKSocketAddress; import com.kohlschutter.annotations.compiletime.SuppressFBWarnings; +import com.kohlschutter.testutil.TestAbortedWithImportantMessageException; +import com.kohlschutter.testutil.TestAbortedWithImportantMessageException.MessageType; @AFSocketCapabilityRequirement(AFSocketCapability.CAPABILITY_VSOCK) @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS") @@ -31,4 +36,17 @@ public final class CancelAcceptTest extends public CancelAcceptTest() { super(AFVSOCKAddressSpecifics.INSTANCE); } + + @Test + @Override + public void issue6test1() throws Exception { + try { + super.issue6test1(); + } catch (SocketTimeoutException e) { + throw new TestAbortedWithImportantMessageException( + MessageType.TEST_ABORTED_SHORT_INFORMATIONAL, + "Environment may not be configured for VSOCK. More information at https://kohlschutter.github.io/junixsocket/junixsocket-vsock/", + e); + } + } } diff --git a/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/TcpNoDelayTest.java b/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/TcpNoDelayTest.java index 2a2f46297..116f1ab29 100644 --- a/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/TcpNoDelayTest.java +++ b/junixsocket-vsock/src/test/java/org/newsclub/net/unix/vsock/TcpNoDelayTest.java @@ -17,11 +17,16 @@ */ package org.newsclub.net.unix.vsock; +import java.net.SocketTimeoutException; + +import org.junit.jupiter.api.Test; import org.newsclub.net.unix.AFSocketCapability; import org.newsclub.net.unix.AFSocketCapabilityRequirement; import org.newsclub.net.unix.AFVSOCKSocketAddress; import com.kohlschutter.annotations.compiletime.SuppressFBWarnings; +import com.kohlschutter.testutil.TestAbortedWithImportantMessageException; +import com.kohlschutter.testutil.TestAbortedWithImportantMessageException.MessageType; @AFSocketCapabilityRequirement(AFSocketCapability.CAPABILITY_VSOCK) @SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_SUPERCLASS") @@ -31,4 +36,30 @@ public final class TcpNoDelayTest extends public TcpNoDelayTest() { super(AFVSOCKAddressSpecifics.INSTANCE); } + + @Test + @Override + public void testStrictImpl() throws Exception { + try { + super.testStrictImpl(); + } catch (SocketTimeoutException e) { + throw new TestAbortedWithImportantMessageException( + MessageType.TEST_ABORTED_SHORT_INFORMATIONAL, + "Environment may not be configured for VSOCK. More information at https://kohlschutter.github.io/junixsocket/junixsocket-vsock/", + e); + } + } + + @Test + @Override + public void testDefaultImpl() throws Exception { + try { + super.testDefaultImpl(); + } catch (SocketTimeoutException e) { + throw new TestAbortedWithImportantMessageException( + MessageType.TEST_ABORTED_SHORT_INFORMATIONAL, + "Environment may not be configured for VSOCK. More information at https://kohlschutter.github.io/junixsocket/junixsocket-vsock/", + e); + } + } }