Skip to content

8359402: Test CloseDescriptors.java should throw SkippedException when there is no lsof/sctp #25843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: jdk25
Choose a base branch
from
Open
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
12 changes: 5 additions & 7 deletions test/jdk/com/sun/nio/sctp/SctpChannel/CloseDescriptors.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 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 @@ -26,6 +26,8 @@
* @bug 8238274
* @summary Potential leak file descriptor for SCTP
* @requires (os.family == "linux")
* @library /test/lib
* @build jtreg.SkippedException
* @run main/othervm/timeout=250 CloseDescriptors
*/

Expand All @@ -52,9 +54,7 @@ public class CloseDescriptors {

public static void main(String[] args) throws Exception {
if (!Util.isSCTPSupported()) {
System.out.println("SCTP protocol is not supported");
System.out.println("Test cannot be run");
return;
throw new jtreg.SkippedException("SCTP protocol is not supported");
}

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

try (ServerSocket ss = new ServerSocket(0)) {
Expand Down