From 2af0ce6ad7212ef2bec743c7467cc41ebbb83da3 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 13:42:09 -0400 Subject: [PATCH 1/5] Revert "Revert "[CI] Add Amazon Linux 2 in PR testing (#1322)"" --- .github/workflows/pull_request.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 8c8480260..288a012a1 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -14,6 +14,7 @@ jobs: uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main with: linux_swift_versions: '["nightly-main", "nightly-6.2"]' + linux_os_versions: '["amazonlinux2", "jammy"]' windows_swift_versions: '["nightly-main", "nightly-6.2"]' enable_macos_checks: true macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.2\"}, {\"xcode_version\": \"16.3\"}]" From e531e0d53b23594edf5fdac855365f4a1b0ca820 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 13:49:05 -0400 Subject: [PATCH 2/5] Fix one test that's failing --- Tests/TestingTests/ExitTestTests.swift | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Tests/TestingTests/ExitTestTests.swift b/Tests/TestingTests/ExitTestTests.swift index 1801a21b4..9b88a960a 100644 --- a/Tests/TestingTests/ExitTestTests.swift +++ b/Tests/TestingTests/ExitTestTests.swift @@ -14,12 +14,19 @@ private import _TestingInternals #if !SWT_NO_EXIT_TESTS @Suite("Exit test tests") struct ExitTestTests { @Test("Signal names are reported (where supported)") func signalName() { - let exitStatus = ExitStatus.signal(SIGABRT) -#if SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android) - #expect(String(describing: exitStatus) == ".signal(SIGABRT → \(SIGABRT))") -#else - #expect(String(describing: exitStatus) == ".signal(\(SIGABRT))") + var hasSignalNames = false +#if SWT_TARGET_OS_APPLE || os(FreeBSD) || os(OpenBSD) || os(Android) + hasSignalNames = true +#elseif os(Linux) && !SWT_NO_DYNAMIC_LINKING + hasSignalNames = (symbol(named: "sigabbrev_np") != nil) #endif + + let exitStatus = ExitStatus.signal(SIGABRT) + if hasSignalNames { + #expect(String(describing: exitStatus) == ".signal(SIGABRT → \(SIGABRT))") + } else { + #expect(String(describing: exitStatus) == ".signal(\(SIGABRT))") + } } @Test("Exit tests (passing)") func passing() async { From 5cf8c07416e5569688ef7b5542ead9b7d3c3e9fc Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 13:50:48 -0400 Subject: [PATCH 3/5] Improve diagnostic value of expectation failure message for an exit test --- Sources/Testing/ExitTests/ExitTest.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Testing/ExitTests/ExitTest.swift b/Sources/Testing/ExitTests/ExitTest.swift index 32e930e0d..b9ce39496 100644 --- a/Sources/Testing/ExitTests/ExitTest.swift +++ b/Sources/Testing/ExitTests/ExitTest.swift @@ -525,11 +525,11 @@ func callExitTest( } // Plumb the exit test's result through the general expectation machinery. + let expression = __Expression(String(describingForTest: expectedExitCondition)) return __checkValue( expectedExitCondition.isApproximatelyEqual(to: result.exitStatus), expression: expression, expressionWithCapturedRuntimeValues: expression.capturingRuntimeValues(result.exitStatus), - mismatchedExitConditionDescription: String(describingForTest: expectedExitCondition), comments: comments(), isRequired: isRequired, sourceLocation: sourceLocation From 8438eda9c0ed51a0b4d598e57382ce5be9443b45 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 14:41:09 -0400 Subject: [PATCH 4/5] oh my --- Sources/Testing/Support/FileHandle.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Testing/Support/FileHandle.swift b/Sources/Testing/Support/FileHandle.swift index 37774b91a..d038db101 100644 --- a/Sources/Testing/Support/FileHandle.swift +++ b/Sources/Testing/Support/FileHandle.swift @@ -704,9 +704,9 @@ func setFD_CLOEXEC(_ flag: Bool, onFileDescriptor fd: CInt) throws { throw CError(rawValue: swt_errno()) case let oldValue: let newValue = if flag { - oldValue & ~FD_CLOEXEC - } else { oldValue | FD_CLOEXEC + } else { + oldValue & ~FD_CLOEXEC } if oldValue == newValue { // No need to make a second syscall as nothing has changed. From ef4783331984434efea64448362e6962d901b120 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 17 Sep 2025 15:45:46 -0400 Subject: [PATCH 5/5] Silence spurious warnings --- Tests/TestingTests/ExitTestTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/TestingTests/ExitTestTests.swift b/Tests/TestingTests/ExitTestTests.swift index 9b88a960a..615ffcb74 100644 --- a/Tests/TestingTests/ExitTestTests.swift +++ b/Tests/TestingTests/ExitTestTests.swift @@ -22,7 +22,7 @@ private import _TestingInternals #endif let exitStatus = ExitStatus.signal(SIGABRT) - if hasSignalNames { + if Bool(hasSignalNames) { #expect(String(describing: exitStatus) == ".signal(SIGABRT → \(SIGABRT))") } else { #expect(String(describing: exitStatus) == ".signal(\(SIGABRT))")