Add support for probing and so be able to detect if we can support (#10618)
io_uring on the running system. Motivation: We should make use of the provided support of probing in io_uring. This can help us to test if we can use the io_uring based transport on the running system or not. Beside this it also allows us to compile on linux systems which don't support all of the required io_uring ops. Modifications: - Add native call for probing - make use of probing when trying to init the native library and fail if probing fails Result: Better detection if the system supports all needed io_uring features or not
This commit is contained in:
parent
f6c84541be
commit
0c823e7527
@ -187,6 +187,34 @@ static void netty_io_uring_ring_buffer_exit(JNIEnv *env, jclass clazz,
|
||||
close(ringFd);
|
||||
}
|
||||
|
||||
static jboolean netty_io_uring_probe(JNIEnv *env, jclass clazz, jint ring_fd, jintArray ops) {
|
||||
jboolean supported = JNI_FALSE;
|
||||
struct io_uring_probe *probe;
|
||||
size_t mallocLen = sizeof(*probe) + 256 * sizeof(struct io_uring_probe_op);
|
||||
probe = malloc(mallocLen);
|
||||
memset(probe, 0, mallocLen);
|
||||
|
||||
if (sys_io_uring_register(ring_fd, IORING_REGISTER_PROBE, probe, 256) < 0) {
|
||||
netty_unix_errors_throwRuntimeExceptionErrorNo(env, "failed to probe via sys_io_uring_register(....) ", errno);
|
||||
goto done;
|
||||
}
|
||||
|
||||
jsize opsLen = (*env)->GetArrayLength(env, ops);
|
||||
jint *opsElements = (*env)->GetIntArrayElements(env, ops, 0);
|
||||
for (int i = 0; i < opsLen; i++) {
|
||||
int op = opsElements[i];
|
||||
if (op > probe->last_op || (probe->ops[op].flags & IO_URING_OP_SUPPORTED) == 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
// all supported
|
||||
supported = JNI_TRUE;
|
||||
done:
|
||||
free(probe);
|
||||
return supported;
|
||||
}
|
||||
|
||||
|
||||
static jobjectArray netty_io_uring_setup(JNIEnv *env, jclass clazz, jint entries) {
|
||||
struct io_uring_params p;
|
||||
memset(&p, 0, sizeof(p));
|
||||
@ -500,6 +528,7 @@ static const jint statically_referenced_fixed_method_table_size = sizeof(statica
|
||||
|
||||
static const JNINativeMethod method_table[] = {
|
||||
{"ioUringSetup", "(I)[[J", (void *) netty_io_uring_setup},
|
||||
{"ioUringProbe", "(I[I)Z", (void *) netty_io_uring_probe},
|
||||
{"ioUringExit", "(JIJIJII)V", (void *) netty_io_uring_ring_buffer_exit},
|
||||
{"createFile", "()I", (void *) netty_create_file},
|
||||
{"ioUringEnter", "(IIII)I", (void *) netty_io_uring_enter},
|
||||
|
@ -39,6 +39,7 @@ public final class IOUring {
|
||||
// Noop
|
||||
}
|
||||
});
|
||||
Native.checkAllIOSupported(ringBuffer.fd());
|
||||
} catch (Throwable t) {
|
||||
cause = t;
|
||||
} finally {
|
||||
|
@ -26,6 +26,7 @@ import io.netty.util.internal.logging.InternalLoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.Selector;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
|
||||
final class Native {
|
||||
@ -117,6 +118,20 @@ final class Native {
|
||||
static final int IORING_ENTER_GETEVENTS = NativeStaticallyReferencedJniMethods.ioringEnterGetevents();
|
||||
static final int IOSQE_ASYNC = NativeStaticallyReferencedJniMethods.iosqeAsync();
|
||||
|
||||
private static final int[] REQUIRED_IORING_OPS = {
|
||||
IORING_OP_POLL_ADD,
|
||||
IORING_OP_TIMEOUT,
|
||||
IORING_OP_ACCEPT,
|
||||
IORING_OP_READ,
|
||||
IORING_OP_WRITE,
|
||||
IORING_OP_POLL_REMOVE,
|
||||
IORING_OP_CONNECT,
|
||||
IORING_OP_CLOSE,
|
||||
IORING_OP_WRITEV,
|
||||
IORING_OP_SENDMSG,
|
||||
IORING_OP_RECVMSG
|
||||
};
|
||||
|
||||
static RingBuffer createRingBuffer(int ringSize) {
|
||||
return createRingBuffer(ringSize, DEFAULT_USE_IOSEQ_ASYNC, new Runnable() {
|
||||
@Override
|
||||
@ -164,6 +179,14 @@ final class Native {
|
||||
return createRingBuffer(DEFAULT_RING_SIZE, DEFAULT_USE_IOSEQ_ASYNC, submissionCallback);
|
||||
}
|
||||
|
||||
static void checkAllIOSupported(int ringFd) {
|
||||
if (!ioUringProbe(ringFd, REQUIRED_IORING_OPS)) {
|
||||
throw new UnsupportedOperationException("Not all operations are supported: "
|
||||
+ Arrays.toString(REQUIRED_IORING_OPS));
|
||||
}
|
||||
}
|
||||
|
||||
private static native boolean ioUringProbe(int ringFd, int[] ios);
|
||||
private static native long[][] ioUringSetup(int entries);
|
||||
|
||||
public static native int ioUringEnter(int ringFd, int toSubmit, int minComplete, int flags);
|
||||
|
@ -25,6 +25,10 @@ final class RingBuffer {
|
||||
this.ioUringCompletionQueue = ioUringCompletionQueue;
|
||||
}
|
||||
|
||||
int fd() {
|
||||
return ioUringCompletionQueue.ringFd;
|
||||
}
|
||||
|
||||
IOUringSubmissionQueue ioUringSubmissionQueue() {
|
||||
return this.ioUringSubmissionQueue;
|
||||
}
|
||||
|
@ -19,11 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.CompositeBufferGatheringWriteTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringCompositeBufferGatheringWriteTest extends CompositeBufferGatheringWriteTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -18,11 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.DatagramConnectNotExistsTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramConnectNotExistsTest extends DatagramConnectNotExistsTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagramSocket();
|
||||
|
@ -18,11 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.DatagramMulticastIPv6Test;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramMulticastIPv6Test extends DatagramMulticastIPv6Test {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagram(internetProtocolFamily());
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.DatagramMulticastTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramMulticastTest extends DatagramMulticastTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagram(internetProtocolFamily());
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation.BootstrapComboFactory;
|
||||
import io.netty.testsuite.transport.socket.DatagramUnicastIPv6MappedTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramUnicastIPv6MappedTest extends DatagramUnicastIPv6MappedTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagram(internetProtocolFamily());
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.DatagramUnicastIPv6Test;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramUnicastIPv6Test extends DatagramUnicastIPv6Test {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagram(internetProtocolFamily());
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.socket.InternetProtocolFamily;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.DatagramUnicastTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDatagramUnicastTest extends DatagramUnicastTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<Bootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.datagram(InternetProtocolFamily.IPv4);
|
||||
|
@ -19,8 +19,17 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.ServerChannel;
|
||||
import io.netty.channel.unix.tests.DetectPeerCloseWithoutReadTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringDetectPeerCloseWithReadTest extends DetectPeerCloseWithoutReadTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EventLoopGroup newGroup() {
|
||||
return new IOUringEventLoopGroup(2);
|
||||
|
@ -20,12 +20,20 @@ import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.ServerChannel;
|
||||
import io.netty.testsuite.transport.AbstractSingleThreadEventLoopTest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringEventLoopTest extends AbstractSingleThreadEventLoopTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected EventLoopGroup newEventLoopGroup() {
|
||||
return new IOUringEventLoopGroup(1);
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketAutoReadTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketAutoReadTest extends SocketAutoReadTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketChannelNotYetConnectedTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketChannelNotYetConnectedTest extends SocketChannelNotYetConnectedTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.clientSocket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketCloseForciblyTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketCloseForciblyTest extends SocketCloseForciblyTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketConditionalWritabilityTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketConditionalWritabilityTest extends SocketConditionalWritabilityTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketConnectTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketConnectTest extends SocketConnectTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketConnectionAttemptTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketConnectionAttemptTest extends SocketConnectionAttemptTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.clientSocket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketDataReadInitialStateTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketDataReadInitialStateTest extends SocketDataReadInitialStateTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,11 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation.BootstrapComboFactory;
|
||||
import io.netty.testsuite.transport.socket.SocketEchoTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketEchoTest extends SocketEchoTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketExceptionHandlingTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketExceptionHandlingTest extends SocketExceptionHandlingTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -27,6 +27,11 @@ import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketFixedLengthEchoTest extends SocketFixedLengthEchoTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,11 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketGatheringWriteTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketGatheringWriteTest extends SocketGatheringWriteTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -21,12 +21,21 @@ import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketHalfClosedTest;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketHalfClosedTest extends SocketHalfClosedTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -21,12 +21,20 @@ import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketMultipleConnectTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketMultipleConnectTest extends SocketMultipleConnectTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> factories
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketObjectEchoTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketObjectEchoTest extends SocketObjectEchoTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,10 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketReadPendingTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketReadPendingTest extends SocketReadPendingTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -21,14 +21,22 @@ import io.netty.channel.Channel;
|
||||
import io.netty.channel.unix.Errors;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketRstTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketRstTest extends SocketRstTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -18,10 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketShutdownOutputByPeerTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketShutdownOutputByPeerTest extends SocketShutdownOutputByPeerTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<ServerBootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.serverSocket();
|
||||
|
@ -18,11 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketShutdownOutputBySelfTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketShutdownOutputBySelfTest extends SocketShutdownOutputBySelfTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.clientSocket();
|
||||
|
@ -20,15 +20,23 @@ import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketSslClientRenegotiateTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketSslClientRenegotiateTest extends SocketSslClientRenegotiateTest {
|
||||
|
||||
public IOUringSocketSslClientRenegotiateTest(SslContext serverCtx, SslContext clientCtx, boolean delegate) {
|
||||
super(serverCtx, clientCtx, delegate);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -20,9 +20,12 @@ import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketSslEchoTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketSslEchoTest extends SocketSslEchoTest {
|
||||
public IOUringSocketSslEchoTest(
|
||||
SslContext serverCtx, SslContext clientCtx, Renegotiation renegotiation,
|
||||
@ -34,6 +37,11 @@ public class IOUringSocketSslEchoTest extends SocketSslEchoTest {
|
||||
autoRead, useChunkedWriteHandler, useCompositeByteBuf);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -20,15 +20,23 @@ import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketSslGreetingTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketSslGreetingTest extends SocketSslGreetingTest {
|
||||
|
||||
public IOUringSocketSslGreetingTest(SslContext serverCtx, SslContext clientCtx, boolean delegate) {
|
||||
super(serverCtx, clientCtx, delegate);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -20,15 +20,23 @@ import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketSslSessionReuseTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketSslSessionReuseTest extends SocketSslSessionReuseTest {
|
||||
|
||||
public IOUringSocketSslSessionReuseTest(SslContext serverCtx, SslContext clientCtx) {
|
||||
super(serverCtx, clientCtx);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -20,15 +20,23 @@ import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.handler.ssl.SslContext;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketStartTlsTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketStartTlsTest extends SocketStartTlsTest {
|
||||
|
||||
public IOUringSocketStartTlsTest(SslContext serverCtx, SslContext clientCtx) {
|
||||
super(serverCtx, clientCtx);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -19,11 +19,19 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.SocketStringEchoTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringSocketStringEchoTest extends SocketStringEchoTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapComboFactory<ServerBootstrap, Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.socket();
|
||||
|
@ -18,11 +18,19 @@ package io.netty.channel.uring;
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.testsuite.transport.TestsuitePermutation;
|
||||
import io.netty.testsuite.transport.socket.WriteBeforeRegisteredTest;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IOUringWriteBeforeRegisteredTest extends WriteBeforeRegisteredTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<TestsuitePermutation.BootstrapFactory<Bootstrap>> newFactories() {
|
||||
return IOUringSocketTestPermutation.INSTANCE.clientSocket();
|
||||
|
@ -18,18 +18,24 @@ package io.netty.channel.uring;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.unix.IovArray;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNotSame;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class IovArraysTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
IOUring.ensureAvailability();
|
||||
ByteBuf buf = Unpooled.directBuffer(1).writeZero(1);
|
||||
IovArrays arrays = new IovArrays(2);
|
||||
try {
|
||||
|
@ -19,6 +19,7 @@ import io.netty.channel.unix.Buffer;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Assume;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.net.Inet6Address;
|
||||
@ -26,12 +27,17 @@ import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static org.junit.Assume.assumeTrue;
|
||||
|
||||
public class SockaddrInTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void loadJNI() {
|
||||
assumeTrue(IOUring.isAvailable());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIp4() throws Exception {
|
||||
Assume.assumeTrue(IOUring.isAvailable());
|
||||
|
||||
ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(64);
|
||||
try {
|
||||
long memoryAddress = Buffer.memoryAddress(buffer);
|
||||
@ -49,8 +55,6 @@ public class SockaddrInTest {
|
||||
|
||||
@Test
|
||||
public void testIp6() throws Exception {
|
||||
Assume.assumeTrue(IOUring.isAvailable());
|
||||
|
||||
ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(64);
|
||||
try {
|
||||
long memoryAddress = Buffer.memoryAddress(buffer);
|
||||
@ -71,8 +75,6 @@ public class SockaddrInTest {
|
||||
|
||||
@Test
|
||||
public void testWriteIp4ReadIpv6Mapped() throws Exception {
|
||||
Assume.assumeTrue(IOUring.isAvailable());
|
||||
|
||||
ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(64);
|
||||
try {
|
||||
long memoryAddress = Buffer.memoryAddress(buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user