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

Port exit-code run-make test to use rust #121884

Merged
merged 2 commits into from
Apr 10, 2024
Merged

Conversation

5225225
Copy link
Contributor

@5225225 5225225 commented Mar 2, 2024

As part of #121876

As draft because formatting will fail because x fmt isn't working for me for some reason, I'll debug that later, just opening this now for review, will mark as ready when formatting is fixed (misleading message from x fmt)

cc @jieyouxu

@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 2, 2024
@rust-log-analyzer

This comment has been minimized.

Comment on lines 16 to 32
fn new() -> Self {
let cmd = setup_common_build_cmd();
Self { cmd }
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe missing a -L $TARGET_RPATH_ENV?

see

RUSTDOC := $(BARE_RUSTDOC) -L $(TARGET_RPATH_DIR)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. It also seems to set up $(HOST_RPATH_ENV) but I don't see that done in the rustc setup, so I assume it's not needed here?

Copy link
Member

@jieyouxu jieyouxu Mar 9, 2024

Choose a reason for hiding this comment

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

Done. It also seems to set up $(HOST_RPATH_ENV) but I don't see that done in the rustc setup, so I assume it's not needed here?

I think it might be required if host/target differs, so it's safer if we make sure HOST_RPATH_ENV is available to RUSTDOC here.

HOST_RPATH_ENV = \
    $(LD_LIB_PATH_ENVVAR)="$(TMPDIR):$(HOST_RPATH_DIR):$($(LD_LIB_PATH_ENVVAR))"

rustc setup not having that is an oversight. If you add a common HOST_RPATH_ENV fn to set up the env var for rustdoc, can you also add it for rustc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, done, added add_host_rpath_env which i think does what that line of code does?

TARGET_RPATH_ENV isn't implemented but as far as i can see that's not needed yet(?)

@workingjubilee
Copy link
Member

?
@bors ping

@bors
Copy link
Contributor

bors commented Mar 2, 2024

😪 I'm awake I'm awake

@workingjubilee
Copy link
Member

@bors delegate=@jieyouxu

@bors
Copy link
Contributor

bors commented Mar 2, 2024

✌️ @jieyouxu, you can now approve this pull request!

If @workingjubilee told you to "r=me" after making some further change, please make that change, then do @bors r=@workingjubilee

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Mar 9, 2024
@5225225 5225225 marked this pull request as ready for review March 9, 2024 14:18
@5225225
Copy link
Contributor Author

5225225 commented Mar 9, 2024

@rustbot label -A-testsuite -T-infra

(was added when i modified the CI yaml to test test-various and x86_64-msvc in 0e8bd06)

@rustbot rustbot removed A-testsuite Area: The testsuite used to check the correctness of rustc T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. labels Mar 9, 2024
@bors
Copy link
Contributor

bors commented Mar 12, 2024

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

@jieyouxu
Copy link
Member

Also while we're at it, could you please add a comment documenting the intent of the test?

let temp = env::var("TMPDIR").unwrap();
let host_rpath_dir = env::var("HOST_RPATH_DIR").unwrap();

cmd.env(ld_lib_path_envvar, format!("{temp}:{host_rpath_dir}:{ld_lib_path_value}"));
Copy link
Member

Choose a reason for hiding this comment

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

Should probably be using std::env::join_paths here.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, "{temp}:{host_rpath_dir}:{ld_lib_path_value}" won't work on Windows where it uses ; for path separators.

let ld_lib_path_value = env::var(&ld_lib_path_envvar).unwrap();

let temp = env::var("TMPDIR").unwrap();
let host_rpath_dir = env::var("HOST_RPATH_DIR").unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

These should all probably use var_os, in combination with join_paths that shouldn't be too hard.

src/tools/run-make-support/src/lib.rs Outdated Show resolved Hide resolved
let temp = env::var("TMPDIR").unwrap();
let host_rpath_dir = env::var("HOST_RPATH_DIR").unwrap();

cmd.env(ld_lib_path_envvar, format!("{temp}:{host_rpath_dir}:{ld_lib_path_value}"));
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, including publicly-writable directories (like /tmp) into PATH-like environment variables can be dangerous. I think for test purposes it's probably not too bad, but do we actually need to do that? Can we avoid putting things into /tmp?

(Perhaps TMPDIR here is set by bootstrap in a way that isn't /tmp?)

Copy link
Member

Choose a reason for hiding this comment

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

$TMPDIR isn't set by run-make (it's set in bootstrap, I need to go back to check where it's being set and what it's being set to), so this seems to just preserve whatever tools.mk was doing.

Copy link
Member

@jieyouxu jieyouxu Mar 16, 2024

Choose a reason for hiding this comment

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

Yeah, $TMPDIR here isn't /tmp, it's a build output directory

let tmpdir = cwd.join(self.output_base_name());
if tmpdir.exists() {
self.aggressive_rm_rf(&tmpdir).unwrap();
}
create_dir_all(&tmpdir).unwrap();

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 16, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 20, 2024

The run-make-support library was changed

cc @jieyouxu

Some changes occurred in run-make tests.

cc @jieyouxu

@5225225
Copy link
Contributor Author

5225225 commented Mar 20, 2024

... was that meant to ping? I rebased to keep up to date with master.

Anyways, did the changes now (just var_os and path changes, also made the RUSTC read in setup_common_rustc_build_cmd use var_os (but tbh i doubt anyone's going to be running this test suite with non-utf8 paths for RUSTC))

The tempdir stuff doesn't seem like it needs any changes, as far as I can see, it's indeed not /tmp.

@jieyouxu
Copy link
Member

... was that meant to ping? I rebased to keep up to date with master.

(Yes, I added myself to be mentioned when someone changes run-make/support lib.)

@bors
Copy link
Contributor

bors commented Mar 22, 2024

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

@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 Mar 23, 2024
@bors
Copy link
Contributor

bors commented Mar 24, 2024

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

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 24, 2024
@bors
Copy link
Contributor

bors commented Mar 27, 2024

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout rmake-exit-code (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self rmake-exit-code --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Removing tests/run-make/exit-code/Makefile
Auto-merging src/tools/run-make-support/src/lib.rs
CONFLICT (content): Merge conflict in src/tools/run-make-support/src/lib.rs
Automatic merge failed; fix conflicts and then commit the result.

@5225225
Copy link
Contributor Author

5225225 commented Mar 27, 2024

rebased - I don't know if you were planning to make significant changes to the test harness (making it more of a pain to merge a "don't set out_dir" for rustdoc, so I went with the less invasive change of just deleting the file as needed in the test.

@jieyouxu
Copy link
Member

rebased - I don't know if you were planning to make significant changes to the test harness (making it more of a pain to merge a "don't set out_dir" for rustdoc, so I went with the less invasive change of just deleting the file as needed in the test.

#122460 (comment) (the rework PR hasn't merged yet, but in that PR I removed setting --out-dir on Rustdoc, and instead let the other rustdoc test set out-dir in its recipe)

@bors
Copy link
Contributor

bors commented Mar 27, 2024

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

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 8, 2024
@5225225
Copy link
Contributor Author

5225225 commented Apr 9, 2024

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 9, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

One minor nit for Rustdoc's API, then r=me after CI is green

src/tools/run-make-support/src/rustdoc.rs Outdated Show resolved Hide resolved
tests/run-make/exit-code/rmake.rs Outdated Show resolved Hide resolved
@jieyouxu
Copy link
Member

jieyouxu commented Apr 9, 2024

Thanks for the PR!
@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 9, 2024

📌 Commit de79a6c has been approved by jieyouxu

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 Apr 9, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121884 (Port exit-code run-make test to use rust)
 - rust-lang#122200 (Unconditionally show update nightly hint on ICE)
 - rust-lang#123568 (Clean up tests/ui by removing `does-nothing.rs`)
 - rust-lang#123609 (Don't use bytepos offsets when computing semicolon span for removal)
 - rust-lang#123612 (Set target-abi module flag for RISC-V targets)
 - rust-lang#123633 (Store all args in the unsupported Command implementation)
 - rust-lang#123668 (async closure coroutine by move body MirPass refactoring)

Failed merges:

 - rust-lang#123701 (Only assert for child/parent projection compatibility AFTER checking that theyre coming from the same place)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit a79b243 into rust-lang:master Apr 10, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Apr 10, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2024
Rollup merge of rust-lang#121884 - 5225225:rmake-exit-code, r=jieyouxu

Port exit-code run-make test to use rust

As part of rust-lang#121876

~~As draft because formatting will fail because `x fmt` isn't working for me for some reason, I'll debug that later, just opening this now for review, will mark as ready when formatting is fixed~~ (misleading message from x fmt)

cc `@jieyouxu`
@5225225 5225225 deleted the rmake-exit-code branch April 10, 2024 08:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc 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.

7 participants