Skip to content

Commit ccd52f1

Browse files
author
duke
committed
Backport a029245a4e1f04052fa0f0a5af16ae0e770bd822
1 parent 747ad8b commit ccd52f1

File tree

16 files changed

+120
-106
lines changed

16 files changed

+120
-106
lines changed

test/jdk/com/sun/nio/sctp/SctpChannel/Bind.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 4927640
26+
* @library /test/lib
2627
* @summary Tests the SCTP protocol implementation
2728
* @author chegar
2829
*/
@@ -48,18 +49,14 @@
4849
import com.sun.nio.sctp.ShutdownNotification;
4950
import static java.lang.System.out;
5051

52+
import jtreg.SkippedException;
53+
5154
/**
5255
* Tests bind, bindAddress, unbindAddress, getLocalAddress, and
5356
* getAllLocalAddresses.
5457
*/
5558
public class Bind {
5659
void test(String[] args) {
57-
if (!Util.isSCTPSupported()) {
58-
out.println("SCTP protocol is not supported");
59-
out.println("Test cannot be run");
60-
return;
61-
}
62-
6360
/* Simply bind tests */
6461
testBind();
6562

@@ -341,6 +338,10 @@ class UnsupportedSocketAddress extends SocketAddress { }
341338
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
342339
void debug(String message) {if(debug) { System.out.println(message); } }
343340
public static void main(String[] args) throws Throwable {
341+
if (!Util.isSCTPSupported()) {
342+
throw new SkippedException("SCTP protocol is not supported");
343+
}
344+
344345
Class<?> k = new Object(){}.getClass().getEnclosingClass();
345346
try {k.getMethod("instanceMain",String[].class)
346347
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
import com.sun.nio.sctp.SctpChannel;
4646
import com.sun.nio.sctp.SctpServerChannel;
4747

48+
import jtreg.SkippedException;
49+
4850
public class CloseDescriptors {
4951
private static Selector selector;
5052
private static final int LOOP = 10;
@@ -54,7 +56,7 @@ public class CloseDescriptors {
5456

5557
public static void main(String[] args) throws Exception {
5658
if (!Util.isSCTPSupported()) {
57-
throw new jtreg.SkippedException("SCTP protocol is not supported");
59+
throw new SkippedException("SCTP protocol is not supported");
5860
}
5961

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

6971
try (ServerSocket ss = new ServerSocket(0)) {

test/jdk/com/sun/nio/sctp/SctpChannel/CommUp.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 6863110
26+
* @library /test/lib
2627
* @summary Newly connected/accepted SctpChannel should fire OP_READ if registered with a Selector
2728
* @author chegar
2829
*/
@@ -49,6 +50,8 @@
4950
import static java.nio.channels.SelectionKey.OP_CONNECT;
5051
import static java.nio.channels.SelectionKey.OP_READ;
5152

53+
import jtreg.SkippedException;
54+
5255
public class CommUp {
5356
static CountDownLatch acceptLatch = new CountDownLatch(1);
5457
static final int TIMEOUT = 10000;
@@ -61,12 +64,6 @@ public class CommUp {
6164
void test(String[] args) {
6265
SocketAddress address = null;
6366

64-
if (!Util.isSCTPSupported()) {
65-
out.println("SCTP protocol is not supported");
66-
out.println("Test cannot be run");
67-
return;
68-
}
69-
7067
if (args.length == 2) {
7168
/* requested to connecct to a specific address */
7269
try {
@@ -355,6 +352,10 @@ public HandlerResult handleNotification(
355352
void sleep(long millis) { try { Thread.currentThread().sleep(millis); }
356353
catch(InterruptedException ie) { unexpected(ie); }}
357354
public static void main(String[] args) throws Throwable {
355+
if (!Util.isSCTPSupported()) {
356+
throw new SkippedException("SCTP protocol is not supported");
357+
}
358+
358359
Class<?> k = new Object(){}.getClass().getEnclosingClass();
359360
try {k.getMethod("instanceMain",String[].class)
360361
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/Connect.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 4927640
26+
* @library /test/lib
2627
* @summary Tests the SCTP protocol implementation
2728
* @author chegar
2829
*/
@@ -43,19 +44,15 @@
4344
import static java.lang.System.out;
4445
import static java.lang.System.err;
4546

47+
import jtreg.SkippedException;
48+
4649
/**
4750
* Tests connect, finishConnect, isConnectionPending,
4851
* getRemoteAddresses and association.
4952
*/
5053
public class Connect {
5154

5255
void test(String[] args) {
53-
if (!Util.isSCTPSupported()) {
54-
out.println("SCTP protocol is not supported");
55-
out.println("Test cannot be run");
56-
return;
57-
}
58-
5956
doTest();
6057
}
6158

@@ -235,6 +232,10 @@ void testCCE(Callable callable) {
235232
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
236233
void debug(String message) {if(debug) { System.out.println(message); } }
237234
public static void main(String[] args) throws Throwable {
235+
if (!Util.isSCTPSupported()) {
236+
throw new SkippedException("SCTP protocol is not supported");
237+
}
238+
238239
Class<?> k = new Object(){}.getClass().getEnclosingClass();
239240
try {k.getMethod("instanceMain",String[].class)
240241
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/Receive.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 4927640
26+
* @library /test/lib
2627
* @summary Tests the SCTP protocol implementation
2728
* @author chegar
2829
*/
@@ -48,6 +49,8 @@
4849
import static java.lang.System.out;
4950
import static java.lang.System.err;
5051

52+
import jtreg.SkippedException;
53+
5154
public class Receive {
5255
/* Latches used to synchronize between the client and server so that
5356
* connections without any IO may not be closed without being accepted */
@@ -61,13 +64,6 @@ void test(String[] args) {
6164
SocketAddress address = null;
6265
Server server;
6366

64-
65-
if (!Util.isSCTPSupported()) {
66-
out.println("SCTP protocol is not supported");
67-
out.println("Test cannot be run");
68-
return;
69-
}
70-
7167
if (args.length == 2) {
7268
/* requested to connecct to a specific address */
7369
try {
@@ -349,6 +345,10 @@ public HandlerResult handleNotification(
349345
void debug(String message) {if(debug) {
350346
System.out.println(Thread.currentThread() + " " + message); } }
351347
public static void main(String[] args) throws Throwable {
348+
if (!Util.isSCTPSupported()) {
349+
throw new SkippedException("SCTP protocol is not supported");
350+
}
351+
352352
Class<?> k = new Object(){}.getClass().getEnclosingClass();
353353
try {k.getMethod("instanceMain",String[].class)
354354
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/ReceiveIntoDirect.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 8034181
26+
* @library /test/lib
2627
* @summary SIGBUS in SctpChannelImpl receive
2728
* @author chegar
2829
*/
@@ -45,6 +46,8 @@
4546
import static java.lang.System.err;
4647
import static java.nio.charset.StandardCharsets.US_ASCII;
4748

49+
import jtreg.SkippedException;
50+
4851
public class ReceiveIntoDirect {
4952
/* suitably small message to NOT overrun small buffers */
5053
final byte[] msgBytes = "Hello".getBytes(US_ASCII);
@@ -56,12 +59,6 @@ void test(String[] args) throws IOException {
5659
SocketAddress address = null;
5760
Server server;
5861

59-
if (!Util.isSCTPSupported()) {
60-
out.println("SCTP protocol is not supported");
61-
out.println("Test cannot be run");
62-
return;
63-
}
64-
6562
if (args.length == 2) {
6663
/* requested to connecct to a specific address */
6764
try {
@@ -264,6 +261,10 @@ public HandlerResult handleNotification(
264261
void debug(String message) {if(debug) {
265262
System.out.println(Thread.currentThread() + " " + message); } }
266263
public static void main(String[] args) throws Throwable {
264+
if (!Util.isSCTPSupported()) {
265+
throw new SkippedException("SCTP protocol is not supported");
266+
}
267+
267268
Class<?> k = new Object(){}.getClass().getEnclosingClass();
268269
try {k.getMethod("instanceMain",String[].class)
269270
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/Send.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 4927640
26+
* @library /test/lib
2627
* @summary Tests the SCTP protocol implementation
2728
* @author chegar
2829
*/
@@ -48,6 +49,8 @@
4849
import static java.lang.System.out;
4950
import static java.lang.System.err;
5051

52+
import jtreg.SkippedException;
53+
5154
public class Send {
5255
/* Latches used to synchronize between the client and server so that
5356
* connections without any IO may not be closed without being accepted */
@@ -60,12 +63,6 @@ void test(String[] args) {
6063
SocketAddress address = null;
6164
Server server = null;
6265

63-
if (!Util.isSCTPSupported()) {
64-
out.println("SCTP protocol is not supported");
65-
out.println("Test cannot be run");
66-
return;
67-
}
68-
6966
if (args.length == 2) {
7067
/* requested to connecct to a specific address */
7168
try {
@@ -451,6 +448,10 @@ public HandlerResult handleNotification(
451448
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
452449
void debug(String message) {if(debug) { System.out.println(message); } }
453450
public static void main(String[] args) throws Throwable {
451+
if (!Util.isSCTPSupported()) {
452+
throw new SkippedException("SCTP protocol is not supported");
453+
}
454+
454455
Class<?> k = new Object(){}.getClass().getEnclosingClass();
455456
try {k.getMethod("instanceMain",String[].class)
456457
.invoke( k.newInstance(), (Object) args);}

test/jdk/com/sun/nio/sctp/SctpChannel/Shutdown.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
2323

2424
/* @test
2525
* @bug 4927640
26+
* @library /test/lib
2627
* @summary Tests the SCTP protocol implementation
2728
* @author chegar
2829
*/
@@ -43,6 +44,8 @@
4344
import static java.lang.System.out;
4445
import static java.lang.System.err;
4546

47+
import jtreg.SkippedException;
48+
4649
public class Shutdown {
4750
static CountDownLatch finishedLatch = new CountDownLatch(1);
4851
static CountDownLatch sentLatch = new CountDownLatch(1);
@@ -51,12 +54,6 @@ void test(String[] args) {
5154
SocketAddress address = null;
5255
ShutdownServer server = null;
5356

54-
if (!Util.isSCTPSupported()) {
55-
out.println("SCTP protocol is not supported");
56-
out.println("Test cannot be run");
57-
return;
58-
}
59-
6057
if (args.length == 2) {
6158
/* requested to connecct to a specific address */
6259
try {
@@ -272,6 +269,10 @@ public HandlerResult handleNotification(
272269
void check(boolean cond, String failMessage) {if (cond) pass(); else fail(failMessage);}
273270
void debug(String message) {if(debug) { System.out.println(message); } }
274271
public static void main(String[] args) throws Throwable {
272+
if (!Util.isSCTPSupported()) {
273+
throw new SkippedException("SCTP protocol is not supported");
274+
}
275+
275276
Class<?> k = new Object(){}.getClass().getEnclosingClass();
276277
try {k.getMethod("instanceMain",String[].class)
277278
.invoke( k.newInstance(), (Object) args);}

0 commit comments

Comments
 (0)