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

Test the cargo args generated by bootstrap.py #112281

Merged
merged 6 commits into from
Jun 25, 2023

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jun 4, 2023

I recommend reviewing this commit-by-commit using the instructions in https://rustc-dev-guide.rust-lang.org/git.html#moving-large-sections-of-code.

  • Test cargo arguments passed by bootstrap.py

    This moves a lot of code around, but the logic itself is not too terribly complicated.

    • Move almost all logic in def bootstrap to the RustBuild class, to avoid mixing setting configuration with running commands
    • Update various doctests to the new (more complete) RustBuild config. In particular, don't pretend that bin_root supports build being unset.
    • Change parse_args not to use a global, to allow testing it
    • Set BUILD_DIR appropriately so bootstrap.py doesn't panic because cargo isn't found
  • Allow passing arguments to bootstrap_test.py

    Previous, it used the built-in test runner, which doesn't support options unless they're manually passed in the script.

  • Fix progress messages for configure in bootstrap_test.py

    Before it would unconditionally print configure-args = [].

r? @albertlarsan68 cc #112089 #111979 (comment)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 4, 2023
@jyn514

This comment was marked as resolved.

Copy link
Member

@albertlarsan68 albertlarsan68 left a comment

Choose a reason for hiding this comment

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

Looks mostly good to me, r=me with questions answered.

src/bootstrap/bootstrap.py Outdated Show resolved Hide resolved
src/bootstrap/test.rs Outdated Show resolved Hide resolved
@jyn514 jyn514 force-pushed the test-bootstrap-py branch from f51995e to c2723c7 Compare June 6, 2023 14:04
@jyn514
Copy link
Member Author

jyn514 commented Jun 6, 2023

@bors r=albertlarsan68

@bors
Copy link
Contributor

bors commented Jun 6, 2023

📌 Commit c2723c70b1fd31de5a57558ad1e373d0e0f36052 has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 6, 2023
@bors
Copy link
Contributor

bors commented Jun 8, 2023

⌛ Testing commit c2723c70b1fd31de5a57558ad1e373d0e0f36052 with merge bdae42044ea1244db04c548301491ce5f1919556...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 8, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 8, 2023
@albertlarsan68
Copy link
Member

It seems like the hack to allow for two levels of defaults is not working anymore.

@jyn514
Copy link
Member Author

jyn514 commented Jun 8, 2023

lmao - ok what went wrong isn't that the hack broke, but that we started testing it at all 😂 before we didn't include the profile in the config the unit tests created, only the config from the main bootstrap.py process.

i think once i switch configure.py not to deserialize and reserialize the toml this problem will go away entirely, but in the meantime i'm going to change the hack back again so it's untested.

@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 8, 2023
@bors
Copy link
Contributor

bors commented Jun 24, 2023

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

jyn514 added 4 commits June 23, 2023 21:12
Before it would unconditionally print `configure-args = []`.
Previous, it used the built-in test runner, which doesn't support options unless they're manually passed in the script.
This moves a lot of code around, but the logic itself is not too terribly complicated.

- Move almost all logic in `def bootstrap` to the `RustBuild` class, to avoid mixing setting configuration with running commands
- Update various doctests to the new (more complete) RustBuild config. In particular, don't pretend that `bin_root` supports `build` being unset.
- Change `parse_args` not to use a global, to allow testing it
- Set BUILD_DIR appropriately so bootstrap.py doesn't panic because cargo isn't found
These weren't being passed in to bootstrap consistently before; in particular `serialize_and_parse` forgot to pass them in.
@jyn514 jyn514 force-pushed the test-bootstrap-py branch from 06dcbcd to db8f6a0 Compare June 24, 2023 02:18
It generates invalid TOML. I want to get rid of it eventually, but this avoids the issue in the meantime.
@jyn514 jyn514 force-pushed the test-bootstrap-py branch from db8f6a0 to 24e67d5 Compare June 24, 2023 14:40
@jyn514
Copy link
Member Author

jyn514 commented Jun 24, 2023

@bors r=albertlarsan68

@bors
Copy link
Contributor

bors commented Jun 24, 2023

📌 Commit 24e67d5 has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 24, 2023
@bors
Copy link
Contributor

bors commented Jun 25, 2023

⌛ Testing commit 24e67d5 with merge b716bc479aaeb4143d9f05a9390fb9d659d57525...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jun 25, 2023

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 25, 2023
- fix tests when `--build` is set
- don't leak `config.example.toml` fd
- don't crash if `config.toml` doesn't exist yet
@albertlarsan68
Copy link
Member

Thanks for the PR!
@bors r+

@bors
Copy link
Contributor

bors commented Jun 25, 2023

📌 Commit 1e7f037 has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 25, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 25, 2023
Rollup of 3 pull requests

Successful merges:

 - rust-lang#112281 (Test the cargo args generated by bootstrap.py)
 - rust-lang#113028 (rustdoc: handle assoc const equalities in cross-crate impl-Trait-in-arg-pos)
 - rust-lang#113029 (CI: do not run Bump dependencies workflow on forks)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 96ab7e6 into rust-lang:master Jun 25, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 25, 2023
@jyn514 jyn514 deleted the test-bootstrap-py branch June 26, 2023 06:09
.env("BUILD_DIR", &builder.out)
.env("BUILD_PLATFORM", &builder.build.build.triple)
.current_dir(builder.src.join("src/bootstrap/"))
.args(builder.config.test_args());
Copy link
Contributor

@clubby789 clubby789 Jul 1, 2023

Choose a reason for hiding this comment

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

This means that x test src/bootstrap -- <rust_test_name> no longer works, as unittest throws an exception when the test name doesn't exist as a module and stops the testing
We could maybe try and reproduce the logic pytest uses for finding modules, and remove arguments that aren't flags or valid modules but that seems a bit brittle 😕

Copy link
Member Author

Choose a reason for hiding this comment

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

i'm going to revert this for now - people can use python -m pytest manually if they want to pass test args.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 2, 2023
…clubby789

Don't pass --test-args to `python -m unitest`

The args for unittest and cargo test are mutually incompatible. Suggest that people use `python -m unittest ...` manually instead.

This also changes `bootstrap_test.py` to be easier to run standalone; see the commit for details.

r? `@clubby789` cc rust-lang#112281 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants