Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 4927640
* @library /test/lib
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
Expand All @@ -48,18 +49,14 @@
import com.sun.nio.sctp.ShutdownNotification;
import static java.lang.System.out;

import jtreg.SkippedException;

/**
* Tests bind, bindAddress, unbindAddress, getLocalAddress, and
* getAllLocalAddresses.
*/
public class Bind {
void test(String[] args) {
if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

/* Simply bind tests */
testBind();

Expand Down Expand Up @@ -341,6 +338,10 @@ class UnsupportedSocketAddress extends SocketAddress { }
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
void debug(String message) {if(debug) { System.out.println(message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
6 changes: 4 additions & 2 deletions test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
import com.sun.nio.sctp.SctpChannel;
import com.sun.nio.sctp.SctpServerChannel;

import jtreg.SkippedException;

public class CloseDescriptors {
private static Selector selector;
private static final int LOOP = 10;
Expand All @@ -54,7 +56,7 @@ public class CloseDescriptors {

public static void main(String[] args) throws Exception {
if (!Util.isSCTPSupported()) {
throw new jtreg.SkippedException("SCTP protocol is not supported");
throw new SkippedException("SCTP protocol is not supported");
}

List<String> lsofDirs = List.of("/usr/bin", "/usr/sbin");
Expand All @@ -63,7 +65,7 @@ public static void main(String[] args) throws Exception {
.filter(f -> Files.isExecutable(f))
.findFirst();
if (!lsof.isPresent()) {
throw new jtreg.SkippedException("Cannot locate lsof in " + lsofDirs);
throw new SkippedException("Cannot locate lsof in " + lsofDirs);
}

try (ServerSocket ss = new ServerSocket(0)) {
Expand Down
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 6863110
* @library /test/lib
* @summary Newly connected/accepted SctpChannel should fire OP_READ if registered with a Selector
* @author chegar
*/
Expand All @@ -49,6 +50,8 @@
import static java.nio.channels.SelectionKey.OP_CONNECT;
import static java.nio.channels.SelectionKey.OP_READ;

import jtreg.SkippedException;

public class CommUp {
static CountDownLatch acceptLatch = new CountDownLatch(1);
static final int TIMEOUT = 10000;
Expand All @@ -61,12 +64,6 @@ public class CommUp {
void test(String[] args) {
SocketAddress address = null;

if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

if (args.length == 2) {
/* requested to connecct to a specific address */
try {
Expand Down Expand Up @@ -355,6 +352,10 @@ public HandlerResult handleNotification(
void sleep(long millis) { try { Thread.currentThread().sleep(millis); }
catch(InterruptedException ie) { unexpected(ie); }}
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 4927640
* @library /test/lib
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
Expand All @@ -43,19 +44,15 @@
import static java.lang.System.out;
import static java.lang.System.err;

import jtreg.SkippedException;

/**
* Tests connect, finishConnect, isConnectionPending,
* getRemoteAddresses and association.
*/
public class Connect {

void test(String[] args) {
if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

doTest();
}

Expand Down Expand Up @@ -235,6 +232,10 @@ void testCCE(Callable callable) {
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
void debug(String message) {if(debug) { System.out.println(message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
16 changes: 8 additions & 8 deletions test/jdk/com/sun/nio/sctp/SctpChannel/Receive.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 4927640
* @library /test/lib
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
Expand All @@ -48,6 +49,8 @@
import static java.lang.System.out;
import static java.lang.System.err;

import jtreg.SkippedException;

public class Receive {
/* Latches used to synchronize between the client and server so that
* connections without any IO may not be closed without being accepted */
Expand All @@ -61,13 +64,6 @@ void test(String[] args) {
SocketAddress address = null;
Server server;


if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

if (args.length == 2) {
/* requested to connecct to a specific address */
try {
Expand Down Expand Up @@ -349,6 +345,10 @@ public HandlerResult handleNotification(
void debug(String message) {if(debug) {
System.out.println(Thread.currentThread() + " " + message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/ReceiveIntoDirect.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 8034181
* @library /test/lib
* @summary SIGBUS in SctpChannelImpl receive
* @author chegar
*/
Expand All @@ -45,6 +46,8 @@
import static java.lang.System.err;
import static java.nio.charset.StandardCharsets.US_ASCII;

import jtreg.SkippedException;

public class ReceiveIntoDirect {
/* suitably small message to NOT overrun small buffers */
final byte[] msgBytes = "Hello".getBytes(US_ASCII);
Expand All @@ -56,12 +59,6 @@ void test(String[] args) throws IOException {
SocketAddress address = null;
Server server;

if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

if (args.length == 2) {
/* requested to connecct to a specific address */
try {
Expand Down Expand Up @@ -264,6 +261,10 @@ public HandlerResult handleNotification(
void debug(String message) {if(debug) {
System.out.println(Thread.currentThread() + " " + message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/Send.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 4927640
* @library /test/lib
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
Expand All @@ -48,6 +49,8 @@
import static java.lang.System.out;
import static java.lang.System.err;

import jtreg.SkippedException;

public class Send {
/* Latches used to synchronize between the client and server so that
* connections without any IO may not be closed without being accepted */
Expand All @@ -60,12 +63,6 @@ void test(String[] args) {
SocketAddress address = null;
Server server = null;

if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

if (args.length == 2) {
/* requested to connecct to a specific address */
try {
Expand Down Expand Up @@ -451,6 +448,10 @@ public HandlerResult handleNotification(
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
void debug(String message) {if(debug) { System.out.println(message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
15 changes: 8 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/Shutdown.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,6 +23,7 @@

/* @test
* @bug 4927640
* @library /test/lib
* @summary Tests the SCTP protocol implementation
* @author chegar
*/
Expand All @@ -43,6 +44,8 @@
import static java.lang.System.out;
import static java.lang.System.err;

import jtreg.SkippedException;

public class Shutdown {
static CountDownLatch finishedLatch = new CountDownLatch(1);
static CountDownLatch sentLatch = new CountDownLatch(1);
Expand All @@ -51,12 +54,6 @@ void test(String[] args) {
SocketAddress address = null;
ShutdownServer server = null;

if (!Util.isSCTPSupported()) {
out.println("SCTP protocol is not supported");
out.println("Test cannot be run");
return;
}

if (args.length == 2) {
/* requested to connecct to a specific address */
try {
Expand Down Expand Up @@ -272,6 +269,10 @@ public HandlerResult handleNotification(
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
void debug(String message) {if(debug) { System.out.println(message); } }
public static void main(String[] args) throws Throwable {
if (!Util.isSCTPSupported()) {
throw new SkippedException("SCTP protocol is not supported");
}

Class<?> k = new Object(){}.getClass().getEnclosingClass();
try {k.getMethod("instanceMain",String[].class)
.invoke( k.newInstance(), (Object) args);}
Expand Down
Loading