Skip to content

Commit 6f6c350

Browse files
committed
Skipping the JVM tests on macOS terminal since unreliable (crashes in JVM create)
1 parent 38fdd9e commit 6f6c350

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

Tests/JExtractSwiftTests/VariableImportTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class VariableImportTests {
4141
)
4242
st.log.logLevel = .error
4343

44-
try await st.analyze(swiftInterfacePath: "/fake/Fake.swiftinterface", text: class_interfaceFile)
44+
try st.analyze(swiftInterfacePath: "/fake/Fake.swiftinterface", text: class_interfaceFile)
4545

4646
let identifier = "counterInt"
4747
let varDecl: ImportedVariable? =
@@ -59,7 +59,6 @@ final class VariableImportTests {
5959
}
6060

6161
assertOutput(
62-
dump: true,
6362
output,
6463
expected:
6564
"""

Tests/JavaKitTests/BasicRuntimeTests.swift

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,19 @@ import JavaKitNetwork
1717
import JavaKitVM
1818
import Testing
1919

20+
#if os(Linux)
21+
import Glibc
22+
#else
23+
import Darwin
24+
#endif
25+
2026
@MainActor
2127
let jvm = try! JavaVirtualMachine(vmOptions: [])
2228

2329
@Suite
2430
@MainActor
2531
struct BasicRuntimeTests {
26-
@Test("Object management", .disabled(if: isLinux, "Attempts to refcount a null pointer on Linux"))
32+
@Test("Object management", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux"))
2733
func javaObjectManagement() throws {
2834
let sneakyJavaThis: jobject
2935
do {
@@ -49,7 +55,7 @@ struct BasicRuntimeTests {
4955
#expect(url.javaHolder === urlAgain.javaHolder)
5056
}
5157

52-
@Test("Java exceptions", .disabled(if: isLinux, "Attempts to refcount a null pointer on Linux"))
58+
@Test("Java exceptions", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux"))
5359
func javaExceptionsInSwift() throws {
5460
do {
5561
_ = try URL("bad url", environment: jvm.environment)
@@ -58,13 +64,13 @@ struct BasicRuntimeTests {
5864
}
5965
}
6066

61-
@Test("Static methods", .disabled(if: isMacOS, "Fails on macOS command line"))
67+
@Test("Static methods", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux"))
6268
func staticMethods() throws {
6369
let urlConnectionClass = try JavaClass<URLConnection>(in: jvm.environment)
6470
#expect(urlConnectionClass.getDefaultAllowUserInteraction() == false)
6571
}
6672

67-
@Test("Class instance lookup")
73+
@Test("Class instance lookup", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux"))
6874
func classInstanceLookup() throws {
6975
do {
7076
_ = try JavaClass<Nonexistent>(in: jvm.environment)
@@ -86,6 +92,11 @@ var isLinux: Bool {
8692
#endif
8793
}
8894

95+
/// Whether we're running on MacOS in an interactive terminal session.
96+
var isMacOSTerminal: Bool {
97+
isMacOS && isatty(STDOUT_FILENO) == 1
98+
}
99+
89100
/// Whether we're running on MacOS.
90101
var isMacOS: Bool {
91102
#if os(macOS)

0 commit comments

Comments
 (0)