Skip to content
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

Print executable name on cargo test --no-run. #9959

Merged
merged 1 commit into from
Feb 20, 2022

Conversation

vrongmeal
Copy link
Contributor

Closes #9957

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Eh2406 (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 4, 2021
@vrongmeal vrongmeal force-pushed the no-run-test-executable-path branch 2 times, most recently from 1ae10a6 to fc44b2d Compare October 5, 2021 17:54
Closes rust-lang#9957

Signed-off-by: Vaibhav <vrongmeal@gmail.com>
@vrongmeal vrongmeal marked this pull request as ready for review October 6, 2021 20:06
@ehuss ehuss added the T-cargo Team: Cargo label Oct 7, 2021
@@ -1346,6 +1346,7 @@ fn test_no_run() {
"\
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[EXECUTABLE] [..] (target/debug/deps/foo-[..][EXE])
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a particular reason to use [..] here to ignore part of the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually looked at other tests such as test_run_simple where the [RUNNING] part was tested like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, yea I'm not sure why it does that since in that case it is just the word "unittests". I think it would be good to include the actual output here so that it is clearer what is being emitted and checked.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you have a chance, I would appreciate if you can remove the [..] here and the other tests just so that the tests are verifying the actual output.

@ehuss
Copy link
Contributor

ehuss commented Oct 7, 2021

Thanks, looks good. Since this is a somewhat prominent change in cargo's output, I just wanted to double check with the rest of the team:

@rfcbot fcp merge

Also, just a few minor observations. You don't have to make these changes if you don't want to, since the old output had the same issues, but it might be nice to fix it while we are changing it:

  • If you have a lib and bin, the output can be confusing:
   Compiling foo v0.1.0 (/Users/eric/Temp/foo)
    Finished test [unoptimized + debuginfo] target(s) in 0.41s
  Executable unittests (target/debug/deps/foo-4f58aab180f74d2e)
  Executable unittests (target/debug/deps/foo-688670071dc25e8f)

Which of those two executables is for the library and which is for the binary? I might suggest making the first term be a little more descriptive. Maybe something like Executable unittests src/lib.rs and Executable unittests src/main.rs.

  • cargo bench indicates unittests for everything, including things in the benches directory:
   Compiling foo v0.1.0 (/Users/eric/Temp/foo)
    Finished bench [optimized] target(s) in 0.28s
  Executable unittests (target/release/deps/foo-6302f637f80147b5)
  Executable unittests (target/release/deps/foo-17cf3e5ac006e4ef)
  Executable unittests (target/release/deps/b1-5d74936019546851)

I might suggest changing the first term to differentiate depending on if this is cargo bench or cargo test. Maybe something like Executable benches/b1.rs for things in benches, and then Executable bench src/lib.rs and Executable bench src/main.rs for example.

@rfcbot
Copy link
Collaborator

rfcbot commented Oct 7, 2021

Team member @ehuss has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Oct 7, 2021
@alexcrichton
Copy link
Member

I think @ehuss's suggestion for tweaking the output is pretty reasonable, but having this as a feature also seems good to me and doesn't necessarily need to be blocked on output changes.

@rfcbot rfcbot added the final-comment-period FCP — a period for last comments before action is taken label Oct 26, 2021
@rfcbot
Copy link
Collaborator

rfcbot commented Oct 26, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period An FCP proposal has started, but not yet signed off. label Oct 26, 2021
Comment on lines +25 to +48
let config = ws.config();
let cwd = config.cwd();
for UnitOutput {
unit,
path,
script_meta,
} in compilation.tests.iter()
{
let (exe_display, cmd) = cmd_builds(
config,
cwd,
unit,
path,
script_meta,
test_args,
&compilation,
)?;
config
.shell()
.concise(|shell| shell.status("Executable", &exe_display))?;
config
.shell()
.verbose(|shell| shell.status("Executable", &cmd))?;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is quite a lot of duplicated code with run_benches, can this be extracted out to a function to deduplicate it?

@@ -1346,6 +1346,7 @@ fn test_no_run() {
"\
[COMPILING] foo v0.0.1 ([CWD])
[FINISHED] test [unoptimized + debuginfo] target(s) in [..]
[EXECUTABLE] [..] (target/debug/deps/foo-[..][EXE])
Copy link
Contributor

Choose a reason for hiding this comment

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

If you have a chance, I would appreciate if you can remove the [..] here and the other tests just so that the tests are verifying the actual output.

@rfcbot rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels Nov 5, 2021
@rfcbot
Copy link
Collaborator

rfcbot commented Nov 5, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@bors
Copy link
Contributor

bors commented Nov 7, 2021

☔ The latest upstream changes (presumably #10051) made this pull request unmergeable. Please resolve the merge conflicts.

@ehuss ehuss added S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 12, 2021
@ehuss
Copy link
Contributor

ehuss commented Dec 14, 2021

Ping @vrongmeal Just checking in to see if you are still interested in working on this, or if you had any questions.

bors added a commit that referenced this pull request Feb 20, 2022
Print executable name on cargo test --no-run #2

Closes #9957

This is a continuation of #9959.
@bors bors merged commit eca63cf into rust-lang:master Feb 20, 2022
@ehuss ehuss added this to the 1.61.0 milestone Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-waiting-on-author Status: The marked PR is awaiting some action (such as code changes) from the PR author. T-cargo Team: Cargo to-announce
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo test --no-run should print the resulting binary name
7 participants