Skip to content

Commit 0d27f72

Browse files
authored
Add Amazon Linux 2 in PR testing (take 2) (#1326)
Restores the changes from #1322 that were reverted in #1324. Resolves #1325.
1 parent 41121f1 commit 0d27f72

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

.github/workflows/pull_request.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
1515
with:
1616
linux_swift_versions: '["nightly-main", "nightly-6.2"]'
17+
linux_os_versions: '["amazonlinux2", "jammy"]'
1718
windows_swift_versions: '["nightly-main", "nightly-6.2"]'
1819
enable_macos_checks: true
1920
macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.2\"}, {\"xcode_version\": \"16.3\"}]"

Sources/Testing/ExitTests/ExitTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,11 +525,11 @@ func callExitTest(
525525
}
526526

527527
// Plumb the exit test's result through the general expectation machinery.
528+
let expression = __Expression(String(describingForTest: expectedExitCondition))
528529
return __checkValue(
529530
expectedExitCondition.isApproximatelyEqual(to: result.exitStatus),
530531
expression: expression,
531532
expressionWithCapturedRuntimeValues: expression.capturingRuntimeValues(result.exitStatus),
532-
mismatchedExitConditionDescription: String(describingForTest: expectedExitCondition),
533533
comments: comments(),
534534
isRequired: isRequired,
535535
sourceLocation: sourceLocation

Sources/Testing/Support/FileHandle.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ func setFD_CLOEXEC(_ flag: Bool, onFileDescriptor fd: CInt) throws {
704704
throw CError(rawValue: swt_errno())
705705
case let oldValue:
706706
let newValue = if flag {
707-
oldValue & ~FD_CLOEXEC
708-
} else {
709707
oldValue | FD_CLOEXEC
708+
} else {
709+
oldValue & ~FD_CLOEXEC
710710
}
711711
if oldValue == newValue {
712712
// No need to make a second syscall as nothing has changed.

Tests/TestingTests/ExitTestTests.swift

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ private import _TestingInternals
1414
#if !SWT_NO_EXIT_TESTS
1515
@Suite("Exit test tests") struct ExitTestTests {
1616
@Test("Signal names are reported (where supported)") func signalName() {
17-
let exitStatus = ExitStatus.signal(SIGABRT)
18-
#if SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD) || os(OpenBSD) || os(Android)
19-
#expect(String(describing: exitStatus) == ".signal(SIGABRT → \(SIGABRT))")
20-
#else
21-
#expect(String(describing: exitStatus) == ".signal(\(SIGABRT))")
17+
var hasSignalNames = false
18+
#if SWT_TARGET_OS_APPLE || os(FreeBSD) || os(OpenBSD) || os(Android)
19+
hasSignalNames = true
20+
#elseif os(Linux) && !SWT_NO_DYNAMIC_LINKING
21+
hasSignalNames = (symbol(named: "sigabbrev_np") != nil)
2222
#endif
23+
24+
let exitStatus = ExitStatus.signal(SIGABRT)
25+
if Bool(hasSignalNames) {
26+
#expect(String(describing: exitStatus) == ".signal(SIGABRT → \(SIGABRT))")
27+
} else {
28+
#expect(String(describing: exitStatus) == ".signal(\(SIGABRT))")
29+
}
2330
}
2431

2532
@Test("Exit tests (passing)") func passing() async {

0 commit comments

Comments
 (0)