Skip to content

Tests: Exercise output and diagnostic messages from command plugins #7254

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
Jan 15, 2024

Conversation

euanh
Copy link
Contributor

@euanh euanh commented Jan 15, 2024

This test exercises command plugin console output under different verbosity settings:

Motivation:

There doesn't seem to be a test which checks the handling of diagnostic messages from command plugins in a once place. This test will help to avoid regressions in this area.

Modifications:

  • A new stub plugin prints to standard output or sends diagnostic output, depending on its arguments
  • A new test uses the stub to generate outputs and checks what swift package prints to the console at different verbosity levels

Result:

This test verifies existing functionality. No change in Swift Package Manager.

…mand plugins

This test exercises command plugin console output under different verbosity settings:
* a stub plugin prints to standard output or sends diagnostic output
  depending on its arguments
* a test uses the stub to generate outputs and checks what `swift
  package` prints to the console at different verbosity levels
@MaxDesiatov MaxDesiatov added plugins test suite improvements to SwiftPM test suite no functional change No user-visible functional changes included labels Jan 15, 2024
Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MaxDesiatov
Copy link
Contributor

@swift-ci test

@MaxDesiatov MaxDesiatov self-assigned this Jan 15, 2024
@euanh euanh enabled auto-merge (squash) January 15, 2024 10:42
@euanh euanh merged commit 95397a9 into swiftlang:main Jan 15, 2024
@euanh euanh deleted the plugin-diagnostics-test branch January 15, 2024 13:14
MaxDesiatov pushed a commit that referenced this pull request Jan 26, 2024
…ild (#7255)

This commit adds the option for a build run on behalf of a command
plugin to echo logs to the console as they are produced, in addition to
the current behaviour of accumulating them in a buffer. Console echoing
is turned off by default.

### Motivation:

When a plugin asks for a target to be built by calling
`packageManager.build`, SwiftPM accumulates the build log in a buffer
and returns the whole log when the build completes. No feedback is
printed on the console while the build is running, so if the target is
large the user can't tell whether the build is making progress or is
stuck.

### Modifications:

* Added `TeeOutputByteStream`, an `OutputByteStream` which copies its
inputs to a set of output streams
* Added an `echoLogs` parameter to `packageManager.build`, defaulting to
`false` to match the current behaviour.
* Added a test to verify that logs are echoed and the existing log
accumulation continues to work.
 
### Result:

A command plugin can ask for build outputs to be echoed as they are
produced. The user will have some feedback that a build is happening,
rather than the long pause which can happen now.

This change depends on #7254.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no functional change No user-visible functional changes included plugins test suite improvements to SwiftPM test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants