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

Use rmake for windows- run-make tests #125613

Merged
merged 6 commits into from
May 29, 2024
Merged

Conversation

ChrisDenton
Copy link
Member

@ChrisDenton ChrisDenton commented May 27, 2024

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: llvm-readobj seems to work for reading DLL imports so I've used that instead of objdump.

cc #121876

@rustbot
Copy link
Collaborator

rustbot commented May 27, 2024

r? @jieyouxu

rustbot has assigned @jieyouxu.
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 May 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 27, 2024

Some changes occurred in run-make tests.

cc @jieyouxu

@rust-log-analyzer

This comment has been minimized.

@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 May 27, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 27, 2024

The run-make-support library was changed

cc @jieyouxu

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.

Thanks for the test comments, they are very informative :3
I left two suggestions, r=me with or without addressing them.

tests/run-make/windows-safeseh/rmake.rs Outdated Show resolved Hide resolved
tests/run-make/windows-subsystem/rmake.rs Outdated Show resolved Hide resolved
rustc().input("empty.rs").run();
let empty = tmp_dir().join("empty.exe");
let output = llvm_readobj().input(empty).coff_imports().command_output();
assert!(output.status.success());
Copy link
Member

Choose a reason for hiding this comment

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

Reminder for myself: cc #125617 we should add run() that asserts success for llvm-readobj as well, so it's less of a footgun to forgor checking cmd status

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, wait there is a run I think. I missed that.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think we probably need to un-provide the command_output helper because it's probably almost never the right helper to use

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds helpful. I should probably also read the docs for the support lib.

Copy link
Member

Choose a reason for hiding this comment

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

I think it wasn't mentioned explicitly in command_output, I'll clean it up soon.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, that gives me a thought: it might be nice to make ./x doc run-make-support --open work.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that would indeed be very useful

@ChrisDenton
Copy link
Member Author

Ok, I'll stop fiddling now 😛There are maybe some more improvements to be made but I'll leave that to follow-ups. Like, maybe it would make sense to use the object crate for enumerating imports rather than llvm_readobj.

@bors r=jieyouxu

@bors
Copy link
Contributor

bors commented May 27, 2024

📌 Commit ad5dce5 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 May 27, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 27, 2024
…youxu

Use `rmake` for `windows-` run-make tests

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: `llvm-readobj` seems to work for reading DLL imports so I've used that instead of `objdump`.

cc rust-lang#121876
bors added a commit to rust-lang-ci/rust that referenced this pull request May 27, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#125339 (The number of tests does not depend on the architecture's pointer width)
 - rust-lang#125539 (crashes: increment the number of tracked ones)
 - rust-lang#125542 (Migrate rustdoc verify output files)
 - rust-lang#125613 (Use `rmake` for `windows-` run-make tests)
 - rust-lang#125616 (MIR validation: ensure that downcast projection is followed by field projection)

Failed merges:

 - rust-lang#125573 (Migrate `run-make/allow-warnings-cmdline-stability` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
jieyouxu added a commit to jieyouxu/rust that referenced this pull request May 28, 2024
…youxu

Use `rmake` for `windows-` run-make tests

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: `llvm-readobj` seems to work for reading DLL imports so I've used that instead of `objdump`.

cc rust-lang#121876
bors added a commit to rust-lang-ci/rust that referenced this pull request May 28, 2024
Rollup of 4 pull requests

Successful merges:

 - rust-lang#125411 (check host's libstdc++ version when using ci llvm)
 - rust-lang#125598 (Make `ProofTreeBuilder` actually generic over `Interner`)
 - rust-lang#125609 (Always use the general case char count with `optimize_for_size`)
 - rust-lang#125613 (Use `rmake` for `windows-` run-make tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@workingjubilee
Copy link
Member

i686-windows-gnu funtimes ahead?

@bors rollup=iffy

bors added a commit to rust-lang-ci/rust that referenced this pull request May 28, 2024
Use `rmake` for `windows-` run-make tests

Convert some Makefile tests to recipes.

I renamed "issue-85441" to "windows-ws2_32" as I think it's slightly more descriptive. EDIT: `llvm-readobj` seems to work for reading DLL imports so I've used that instead of `objdump`.

cc rust-lang#121876
@bors
Copy link
Contributor

bors commented May 28, 2024

⌛ Testing commit ad5dce5 with merge 4b42964...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 29, 2024

💔 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 May 29, 2024
@bors
Copy link
Contributor

bors commented May 29, 2024

⌛ Testing commit ad5dce5 with merge fb51598...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 29, 2024

💔 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 May 29, 2024
@ChrisDenton
Copy link
Member Author

Ok so the no external deps test is failing on mingw due to a missing dll (but it succeeds for msvc). The weird thing is it was obviously succeeding in the Makefile version. Which perhaps suggest make or mingw bash is doing something behind our backs so we weren't testing what we thought we were testing. Either that or I missed something else.

I'll investigate tomorrow.

@jieyouxu
Copy link
Member

Ok so the no external deps test is failing on mingw due to a missing dll (but it succeeds for msvc). The weird thing is it was obviously succeeding in the Makefile version. Which perhaps suggest make or mingw bash is doing something behind our backs so we weren't testing what we thought we were testing. Either that or I missed something else.

I'll investigate tomorrow.

run() sets extra env vars for the executable, e.g.

if is_windows() {
let mut paths = vec![];
for p in env::split_paths(&std::env::var("PATH").unwrap_or(String::new())) {
paths.push(p.to_path_buf());
}
paths.push(Path::new(&std::env::var("TARGET_RPATH_DIR").unwrap()).to_path_buf());
cmd.env("PATH", env::join_paths(paths.iter()).unwrap());
}

maybe that is why in the original Makefile they used

$(TMPDIR)/hello.exe

instead of

$(call RUN,hello)

Not entirely sure.

@bors
Copy link
Contributor

bors commented May 29, 2024

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

@ChrisDenton
Copy link
Member Author

I had a look at the original issue that provoked adding this test. It seems we only need to be testing the final binary, not rustc itself. That does make things easier.

I still need to rebase and squish. And while I'm at it, I might rewrite the windows-ws2_32 test to use object. I think it'll be easy enough.

@ChrisDenton
Copy link
Member Author

ChrisDenton commented May 29, 2024

I've rebased and made the commits easier to navigate. There are two changed tests.

5ec0c00 fixes the failure as discussed above by only setting PATH when running the final binary

For f08e00f I switched to using object rather than depending on llvm-readobj and searching the command output. I also added an extra test case to make sure the actual test works. The problem with depending on the absence of something (in this case WS2_32.dll) is that it could be absent for a number of reasons (e.g. the test is buggy or the standard library switches to another DLL) so testing the test still works is useful, I think. Therefore the new test confirms that TcpListener::bind causes WS2_32.dll to be linked.

Comment on lines +18 to +20
if !status.success() {
panic!("Command failed!\noutput status: `{status}`");
}
Copy link
Member

Choose a reason for hiding this comment

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

Remark (to myself): we should probably expose the handle_failed_output helper to make this less repetitive.

let binary_data = fs::read(path).unwrap();
let file = object::File::parse(&*binary_data).unwrap();
for import in file.imports().unwrap() {
if import.library().eq_ignore_ascii_case(b"WS2_32.dll") {
Copy link
Member

Choose a reason for hiding this comment

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

I like how this test reads :3

@jieyouxu
Copy link
Member

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented May 29, 2024

📌 Commit f34bbde 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 May 29, 2024
@bors
Copy link
Contributor

bors commented May 29, 2024

⌛ Testing commit f34bbde with merge e9b7aa0...

@bors
Copy link
Contributor

bors commented May 29, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing e9b7aa0 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 29, 2024
@bors bors merged commit e9b7aa0 into rust-lang:master May 29, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 29, 2024
@ChrisDenton ChrisDenton deleted the windows-recipie branch May 29, 2024 20:11
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e9b7aa0): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results (primary -0.8%, secondary -3.6%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.2% [3.2%, 3.2%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.1% [-2.6%, -1.5%] 3
Improvements ✅
(secondary)
-3.6% [-4.3%, -3.1%] 3
All ❌✅ (primary) -0.8% [-2.6%, 3.2%] 4

Cycles

Results (primary -2.5%, secondary -3.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.5% [-3.1%, -1.9%] 6
Improvements ✅
(secondary)
-3.0% [-3.9%, -2.4%] 14
All ❌✅ (primary) -2.5% [-3.1%, -1.9%] 6

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 667.715s -> 667.139s (-0.09%)
Artifact size: 318.83 MiB -> 318.84 MiB (0.00%)

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 merged-by-bors This PR was explicitly merged by bors. 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