Skip to content

Fix some compiler conditional uses (SWT_NO_*). #782

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Testing/ABI/EntryPoints/EntryPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public func configurationForEntryPoint(from args: __CommandLineArguments_v0) thr
return configuration
}

#if canImport(Foundation) && !SWT_NO_FILE_IO
#if canImport(Foundation) && (!SWT_NO_FILE_IO || !SWT_NO_ABI_ENTRY_POINT)
/// Create an event handler that streams events to the given file using the
/// specified ABI version.
///
Expand Down
10 changes: 5 additions & 5 deletions Sources/Testing/ABI/v0/ABIv0.Record+Streaming.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ extension ABIv0.Record {
// We don't actually expect the JSON encoder to produce output containing
// newline characters, so in debug builds we'll log a diagnostic message.
if _slowPath(json.contains(where: \.isASCIINewline)) {
#if DEBUG
#if DEBUG && !SWT_NO_FILE_IO
let message = Event.ConsoleOutputRecorder.warning(
"JSON encoder produced one or more newline characters while encoding an event to JSON. Please file a bug report at https://github.com/swiftlang/swift-testing/issues/new",
options: .for(.stderr)
)
#if SWT_TARGET_OS_APPLE
#if SWT_TARGET_OS_APPLE
try? FileHandle.stderr.write(message)
#else
#else
print(message)
#endif
#endif
#endif
#endif

// Remove the newline characters to conform to JSON lines specification.
var json = Array(json)
Expand Down
3 changes: 3 additions & 0 deletions Sources/Testing/ExitTests/ExitTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
private import _TestingInternals

#if !SWT_NO_EXIT_TESTS
#if SWT_NO_FILE_IO
#error("Platform-specific misconfiguration: support for exit tests requires support for file I/O")
#endif
#if SWT_NO_PIPES
#error("Platform-specific misconfiguration: support for exit tests requires support for (anonymous) pipes")
#endif
Expand Down
4 changes: 4 additions & 0 deletions Sources/Testing/ExitTests/SpawnProcess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
internal import _TestingInternals

#if !SWT_NO_PROCESS_SPAWNING
#if SWT_NO_FILE_IO
#error("Platform-specific misconfiguration: support for process spawning requires support for file I/O")
#endif

/// A platform-specific value identifying a process running on the current
/// system.
#if SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD)
Expand Down