Skip to content

XCTest: Stdio not output at correct point #422

@adam-fowler

Description

@adam-fowler

Describe the bug
Stdio output appears to be buffered and not outputting at correct time. The easiest way to reproduce this is create a test which outputs a lot of text. You'll find that the text output appears after the TestSuite passed message. This only happens when running swift from the command line.

Steps To Reproduce
Steps to reproduce the behavior:

  1. Create package which includes the following test
    func testPrint() {
        for i in 1..<100 {
            let string = (0..<i).map(\.description).joined()
            print(string)
        }
    }
}
  1. Run swift test

Expected behavior
Print out of numbers should appear before TestSuite passed message.

Environment (please fill out the following information)

  • OS: macOS 12.4
  • Xcode: 13.4
  • swift-driver version: 1.45.2 Apple Swift version 5.6.1 (swiftlang-5.6.0.323.66 clang-1316.0.20.12)
    Target: arm64-apple-macosx12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions