Skip to content

Commit 9380af8

Browse files
committed
Don't set attachments path if no file I/O
1 parent 7da28f0 commit 9380af8

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

Sources/Testing/ABI/EntryPoints/EntryPoint.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ public func configurationForEntryPoint(from args: __CommandLineArguments_v0) thr
553553
return configuration
554554
}
555555

556-
#if canImport(Foundation) && !SWT_NO_FILE_IO
556+
#if canImport(Foundation) && (!SWT_NO_FILE_IO || !SWT_NO_ABI_ENTRY_POINT)
557557
/// Create an event handler that streams events to the given file using the
558558
/// specified ABI version.
559559
///

Sources/Testing/ABI/v0/ABIv0.Record+Streaming.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ extension ABIv0.Record {
2121
// We don't actually expect the JSON encoder to produce output containing
2222
// newline characters, so in debug builds we'll log a diagnostic message.
2323
if _slowPath(json.contains(where: \.isASCIINewline)) {
24-
#if DEBUG
24+
#if DEBUG && !SWT_NO_FILE_IO
2525
let message = Event.ConsoleOutputRecorder.warning(
2626
"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",
2727
options: .for(.stderr)
2828
)
29-
#if SWT_TARGET_OS_APPLE
29+
#if SWT_TARGET_OS_APPLE
3030
try? FileHandle.stderr.write(message)
31-
#else
31+
#else
3232
print(message)
33-
#endif
34-
#endif
33+
#endif
34+
#endif
3535

3636
// Remove the newline characters to conform to JSON lines specification.
3737
var json = Array(json)

Sources/Testing/ExitTests/ExitTest.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
private import _TestingInternals
1212

1313
#if !SWT_NO_EXIT_TESTS
14+
#if SWT_NO_FILE_IO
15+
#error("Platform-specific misconfiguration: support for exit tests requires support for file I/O")
16+
#endif
1417
#if SWT_NO_PIPES
1518
#error("Platform-specific misconfiguration: support for exit tests requires support for (anonymous) pipes")
1619
#endif

Sources/Testing/ExitTests/SpawnProcess.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
internal import _TestingInternals
1212

1313
#if !SWT_NO_PROCESS_SPAWNING
14+
#if SWT_NO_FILE_IO
15+
#error("Platform-specific misconfiguration: support for process spawning requires support for file I/O")
16+
#endif
17+
1418
/// A platform-specific value identifying a process running on the current
1519
/// system.
1620
#if SWT_TARGET_OS_APPLE || os(Linux) || os(FreeBSD)

Sources/Testing/Running/Runner.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,9 +369,11 @@ extension Runner {
369369
private static func _run(_ runner: Self) async {
370370
var runner = runner
371371
runner.configureEventHandlerRuntimeState()
372+
#if !SWT_NO_FILE_IO
372373
if let attachmentDirectoryPath = runner.configuration.attachmentDirectoryPath {
373374
runner.configureToWriteAttachments(toDirectoryAtPath: attachmentDirectoryPath)
374375
}
376+
#endif
375377

376378
// Track whether or not any issues were recorded across the entire run.
377379
let issueRecorded = Locked(rawValue: false)

0 commit comments

Comments
 (0)