-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Batch mode] Restore -### functionality for batch-mode by extending OutputLevel. #14961
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
Conversation
@swift-ci please smoke test |
d60eb6e
to
524e59c
Compare
@swift-ci please smoke test |
At least one of these tests is failing because -### printing to stdout, but with these changes, it prints to stderr. I'm assuming that I need to fix this to preserve the old behavior. |
@swift-ci please smoke test |
@swift-ci please smoke test |
@swift-ci please smoke 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.
LGTM
@jrose-apple I’m assuming you want to look at this, let me know if not. |
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.
Nice, glad it worked out this easily. Can you add a test for it doing the right thing with batch mode?
lib/Driver/Compilation.cpp
Outdated
if (Level == OutputLevel::Verbose) | ||
Cmd->printCommandLine(llvm::errs()); | ||
switch (Level) { | ||
case OutputLevel::Normal: |
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.
Nitpick: accidentally-indented cases.
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.
Tx. I'm on it! And will do a test, too.
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.
Indentation fixed! On to the test.
@swift-ci please smoke test |
// | ||
// CHECK-COMBINED: -primary-file {{.*}}/file-01.swift -primary-file {{.*}}/file-02.swift {{.*}}/file-03.swift {{.*}}/main.swift | ||
// | ||
// CHECK-ANYTHING-NOT: {{.+}} |
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 like you're not using this anymore.
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 the catch. Removed.
// | ||
// RUN: %swiftc_driver -enable-batch-mode -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift -driver-print-jobs | %FileCheck %s -check-prefix=CHECK-COMBINED | ||
// RUN: %swiftc_driver -enable-batch-mode -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift -### | %FileCheck %s -check-prefix=CHECK-COMBINED | ||
// RUN: %swiftc_driver -enable-batch-mode -driver-print-jobs -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift 2>%t/shouldBeEmpty >/dev/null && test -z `cat %t/shouldBeEmpty` |
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.
Why is this empty?
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.
In the implementation, it is important to get -### to output on the expected file descriptor. Many existing tests depend on it. So I test for the right output on the right fd, and for no output on the wrong fd.
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.
Other output flags write on the other fd.
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.
Ahhh, I missed that. Maybe leave a comment? Or just do one invocation that writes both output streams to separate files, which makes it more obvious that they're being treated differently.
// RUN: %swiftc_driver -enable-batch-mode -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift -driver-print-jobs | %FileCheck %s -check-prefix=CHECK-COMBINED | ||
// RUN: %swiftc_driver -enable-batch-mode -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift -### | %FileCheck %s -check-prefix=CHECK-COMBINED | ||
// RUN: %swiftc_driver -enable-batch-mode -driver-print-jobs -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift 2>%t/shouldBeEmpty >/dev/null && test -z `cat %t/shouldBeEmpty` | ||
// RUN: %swiftc_driver -enable-batch-mode -c -emit-module -module-name main -j 2 %t/file-01.swift %t/file-02.swift %t/file-03.swift %t/main.swift -### 2>%t/shouldBeEmpty > /dev/null && test -z `cat %t/shouldBeEmpty` |
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.
Please put quotes around the sub-command, so that the argument doesn't get dropped entirely with a different shell.
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.
Done! Thanks.
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
@swift-ci please smoke test |
I've added a comment to explain the test better; it did need it, thanks. Also streamlined the test. |
@swift-ci please smoke test |
@jrose-apple Thanks! |
The current implementation of the -### does not produce the right results for batch mode. This PR reimplements that drive option by extended the OutputLevel enumeration in the driver. It reuses the machinery that is already there.