Skip to content

Commit ec2bbcb

Browse files
authored
Fix issues building for 32-bit Windows. (#595)
This PR fixes some integer type mismatches that cause build failures on 32-bit Windows. ### Checklist: - [x] Code and documentation should follow the style of the [Style Guide](https://github.com/apple/swift-testing/blob/main/Documentation/StyleGuide.md). - [x] If public symbols are renamed or modified, DocC references should be updated.
1 parent ff1b68f commit ec2bbcb

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Sources/Testing/ABI/EntryPoints/SwiftPMEntryPoint.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var EXIT_NO_TESTS_FOUND: CInt {
2727
#if SWT_TARGET_OS_APPLE || os(Linux) || os(WASI)
2828
EX_UNAVAILABLE
2929
#elseif os(Windows)
30-
ERROR_NOT_FOUND
30+
CInt(ERROR_NOT_FOUND)
3131
#else
3232
#warning("Platform-specific implementation missing: value for EXIT_NO_TESTS_FOUND unavailable")
3333
return 2 // We're assuming that EXIT_SUCCESS = 0 and EXIT_FAILURE = 1.

Sources/Testing/ExitTests/WaitFor.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func wait(for processHandle: HANDLE) async throws -> ExitCondition {
218218
}
219219

220220
// FIXME: handle SEH/VEH uncaught exceptions.
221-
return .exitCode(CInt(bitPattern: status))
221+
return .exitCode(CInt(bitPattern: .init(status)))
222222
}
223223
#endif
224224
#endif

Tests/TestingTests/Support/CErrorTests.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ struct CErrorTests {
2626
struct Win32ErrorTests {
2727
@Test("Win32Error.description property",
2828
arguments: [
29-
(ERROR_OUTOFMEMORY, "Not enough memory resources are available to complete this operation."),
30-
(ERROR_INVALID_ACCESS, "The access code is invalid."),
31-
(ERROR_ARITHMETIC_OVERFLOW, "Arithmetic result exceeded 32 bits."),
29+
(DWORD(ERROR_OUTOFMEMORY), "Not enough memory resources are available to complete this operation."),
30+
(DWORD(ERROR_INVALID_ACCESS), "The access code is invalid."),
31+
(DWORD(ERROR_ARITHMETIC_OVERFLOW), "Arithmetic result exceeded 32 bits."),
3232
(999_999_999, "An unknown error occurred (999999999)."),
3333
]
3434
)
35-
fileprivate func errorDescription(errorCode: CInt, expectedMessage: String) {
36-
let description = String(describing: Win32Error(rawValue: DWORD(errorCode)))
35+
fileprivate func errorDescription(errorCode: DWORD, expectedMessage: String) {
36+
let description = String(describing: Win32Error(rawValue: errorCode))
3737
#expect(!description.isEmpty)
3838
#expect(expectedMessage == description)
3939
}

0 commit comments

Comments
 (0)