-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix --quiet option not working with swift run #8844 #8858
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks for this! A few little nits, but nothing major.
@@ -242,6 +242,7 @@ final class LLBuildProgressTracker: LLBuildBuildSystemDelegate, SwiftCompilerOut | |||
|
|||
func commandStatusChanged(_ command: SPMLLBuild.Command, kind: CommandStatusKind) { | |||
guard !self.logLevel.isVerbose else { return } | |||
guard !self.logLevel.isQuiet else { return } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: roll this up into the guard above
Sources/Basics/Observability.swift
Outdated
} | ||
|
||
public var isQuiet: Bool { | ||
self == .error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: just for symmetry with isVerbose
self == .error | |
self >= .error |
34eac3f
to
2e3b66a
Compare
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. However, to ensure we do not regress, could I ask that you add a test for the for each SwiftPM executable, where appropriate?
Take a look in Tests/CommandsTests/*CommandTests.swift
.
Yes, sure! Thanks for the hint. I think I have an idea on how to do that properly. |
2e3b66a
to
65918df
Compare
@bkhouri I don't know how we should use fixtures folders. Should we have a unique folder per test or is it ok to reuse them ? Since test suites are serialized I went for the second option, there shouldn't be any concurrent access to fixtures folders causing flaky tests. |
@MaelRB : You can re-use fixtures were necessary :). When using the |
f08fc37
to
a023d6a
Compare
I've noticed an inconsistency on which output stream is used by a build system to raise the error when the build failed with the From the if buildSystem == .swiftbuild {
// THEN we should see output in stderr
#expect(stderr.isEmpty == false)
// AND no content in stdout
#expect(stdout.isEmpty)
} else {
// THEN we should see content in stdout
#expect(stdout.isEmpty == false)
// AND no output in stderr
#expect(stderr.isEmpty)
} The |
a023d6a
to
fe3573d
Compare
@swift-ci please test |
@MaelRB Please file an issue and we can looking into it :). Feel free to reference the test (and PR). |
fe3573d
to
9115c35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you for adding tests and working through the comments. it's really appreciated
@swift-ci test |
@MaelRB: You |
9115c35
to
0eeed67
Compare
@swift-ci please test |
@bkhouri @plemarquand Should I wrap test cases within a |
@MaelRB : if they are related to SwiftBuild, I would say you can mark them |
Use the log level to determine whether a message should be log or not. If log level is error, log only error messages and ignore all other messages. This fixes the issue for swift run command, and it benefits the swift build command as well. Add a small refactoring to remove duplicated decleration of the isVerbose property from different targets.
0eeed67
to
87cbdb8
Compare
I marked two of the tests |
Fixes an issue where the
--quiet
option had no effect when used withswift run
andswift build
command.Motivation:
When using the
--quiet
option withswift run
only error messages should be logged.Modifications:
isQuiet
property to filter out messages based on the log level during build phases of thenative
,xcode
andswiftbuild
build system.Result:
When the
--quiet
option is used with theswift run
andswift build
command only error messages are logged.