diff --git a/Tests/JExtractSwiftTests/VariableImportTests.swift b/Tests/JExtractSwiftTests/VariableImportTests.swift index f59b8ff4..2f58c5c8 100644 --- a/Tests/JExtractSwiftTests/VariableImportTests.swift +++ b/Tests/JExtractSwiftTests/VariableImportTests.swift @@ -41,7 +41,7 @@ final class VariableImportTests { ) st.log.logLevel = .error - try await st.analyze(swiftInterfacePath: "/fake/Fake.swiftinterface", text: class_interfaceFile) + try st.analyze(swiftInterfacePath: "/fake/Fake.swiftinterface", text: class_interfaceFile) let identifier = "counterInt" let varDecl: ImportedVariable? = @@ -59,7 +59,6 @@ final class VariableImportTests { } assertOutput( - dump: true, output, expected: """ diff --git a/Tests/JavaKitTests/BasicRuntimeTests.swift b/Tests/JavaKitTests/BasicRuntimeTests.swift index 2e47b84f..e8e9ac82 100644 --- a/Tests/JavaKitTests/BasicRuntimeTests.swift +++ b/Tests/JavaKitTests/BasicRuntimeTests.swift @@ -16,6 +16,13 @@ import JavaKit import JavaKitNetwork import JavaKitVM import Testing +import Foundation + +#if os(Linux) +import Glibc +#else +import Darwin +#endif @MainActor let jvm = try! JavaVirtualMachine(vmOptions: []) @@ -23,7 +30,7 @@ let jvm = try! JavaVirtualMachine(vmOptions: []) @Suite @MainActor struct BasicRuntimeTests { - @Test("Object management", .disabled(if: isLinux, "Attempts to refcount a null pointer on Linux")) + @Test("Object management", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux")) func javaObjectManagement() throws { let sneakyJavaThis: jobject do { @@ -49,7 +56,7 @@ struct BasicRuntimeTests { #expect(url.javaHolder === urlAgain.javaHolder) } - @Test("Java exceptions", .disabled(if: isLinux, "Attempts to refcount a null pointer on Linux")) + @Test("Java exceptions", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux")) func javaExceptionsInSwift() throws { do { _ = try URL("bad url", environment: jvm.environment) @@ -58,13 +65,13 @@ struct BasicRuntimeTests { } } - @Test("Static methods", .disabled(if: isMacOS, "Fails on macOS command line")) + @Test("Static methods", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux")) func staticMethods() throws { let urlConnectionClass = try JavaClass(in: jvm.environment) #expect(urlConnectionClass.getDefaultAllowUserInteraction() == false) } - @Test("Class instance lookup") + @Test("Class instance lookup", .disabled(if: isMacOSTerminal || isLinux, "JVM creation fails occasionally in terminal on macOS, and some issues on Linux")) func classInstanceLookup() throws { do { _ = try JavaClass(in: jvm.environment) @@ -86,6 +93,14 @@ var isLinux: Bool { #endif } +/// Whether we're running on MacOS in an interactive terminal session. +var isMacOSTerminal: Bool { + isMacOS && ( + isatty(STDOUT_FILENO) == 1 || + ProcessInfo.processInfo.environment["IS_TTY"] != nil // since 'swift test' still sometimes hides the fact we're in tty + ) +} + /// Whether we're running on MacOS. var isMacOS: Bool { #if os(macOS)