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

tests: Port extern-fn-reachable to rmake.rs #135458

Merged
merged 1 commit into from
Jan 16, 2025

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Jan 13, 2025

Part of #121876.

Summary

This PR ports tests/run-make/extern-fn-reachable to use rmake.rs. Notable changes:

  • We now use the object crate and look at the exported symbols specifically.
  • This test's coverage regressed against windows-msvc back in replace dynamic library module with libloading #90716, but since we use object now, we're able to claw the test coverage back.
  • The checks are now stricter:
    1. It no longer looks for substring symbol matches in nm textual outputs, it inspects the symbol names precisely.
    2. We now also explicitly check for the presence of leading underscore in exported symbol names on apple vs non-apple targets.
  • Added another case of #[no_mangle] fn fun6() {} (note the lack of pub) to check that Rust nameres visibility is orthogonal to symbol visibility in dylib.

History

Supersedes #128314.
Co-authored with @lolbinarycat.

try-job: x86_64-msvc
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-mingw-1
try-job: x86_64-apple-1
try-job: aarch64-apple
try-job: test-various

Footnotes

  1. no longer a thing nowadays

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs A-tidy Area: The tidy tool 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 13, 2025
@jieyouxu

This comment was marked as outdated.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 13, 2025
…, r=<try>

tests: Port `extern-fn-reachable` to rmake.rs

Part of rust-lang#121876.

## Summary

This PR ports `tests/run-make/extern-fn-reachable` to use `rmake.rs`. Notable changes:

- We now use the `object` crate and look at the exported symbols specifically.
- This test's coverage regressed against windows-msvc back in [replace dynamic library module with libloading rust-lang#90716](rust-lang#90716), but since we use `object` now, we're able to claw the test coverage back.
- The checks are now stricter:
    1. It no longer looks for substring symbol matches in `nm` textual outputs, it inspects the symbol names precisely.
    2. We now also explicitly check for the presence of leading underscore in exported symbol names on apple vs non-apple targets.

## History

- Test was initially introduced as a run-pass[^run-pass] test as part of [Don't mark reachable extern fns as internal rust-lang#10539](rust-lang#10539).
- Test re-introduced as a run-make test in rust-lang#13741.
- Later, the test coverage regressed in rust-lang#90716.

[^run-pass]: no longer a thing nowadays

Supersedes rust-lang#128314.
Co-authored with `@lolbinarycat.`

r? `@ghost`

try-job: x86_64-msvc
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-mingw-1
try-job: x86_64-apple-1
try-job: aarch64-apple
try-job: test-various
@bors

This comment was marked as outdated.

@jieyouxu jieyouxu 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 Jan 13, 2025
@rust-log-analyzer

This comment was marked as outdated.

@bors

This comment was marked as outdated.

@jieyouxu
Copy link
Member Author

@bors try

@bors
Copy link
Contributor

bors commented Jan 14, 2025

⌛ Trying commit 1332c85 with merge c0a7d85...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2025
…, r=<try>

tests: Port `extern-fn-reachable` to rmake.rs

Part of rust-lang#121876.

## Summary

This PR ports `tests/run-make/extern-fn-reachable` to use `rmake.rs`. Notable changes:

- We now use the `object` crate and look at the exported symbols specifically.
- This test's coverage regressed against windows-msvc back in [replace dynamic library module with libloading rust-lang#90716](rust-lang#90716), but since we use `object` now, we're able to claw the test coverage back.
- The checks are now stricter:
    1. It no longer looks for substring symbol matches in `nm` textual outputs, it inspects the symbol names precisely.
    2. We now also explicitly check for the presence of leading underscore in exported symbol names on apple vs non-apple targets.
- Added another case of `#[no_mangle] fn fun6() {}` (note the lack of `pub`) to check that Rust nameres visibility is orthogonal to symbol visiblity in dylib.

## History

- Test was initially introduced as a run-pass[^run-pass] test as part of [Don't mark reachable extern fns as internal rust-lang#10539](rust-lang#10539).
- Test re-introduced as a run-make test in rust-lang#13741.
- Later, the test coverage regressed in rust-lang#90716.

[^run-pass]: no longer a thing nowadays

Supersedes rust-lang#128314.
Co-authored with `@lolbinarycat.`

r? `@ghost`

try-job: x86_64-msvc
try-job: i686-msvc
try-job: i686-mingw
try-job: x86_64-mingw-1
try-job: x86_64-apple-1
try-job: aarch64-apple
try-job: test-various
@bors
Copy link
Contributor

bors commented Jan 14, 2025

☀️ Try build successful - checks-actions
Build commit: c0a7d85 (c0a7d85e66e544330818ab687d830297fb9d5883)

@jieyouxu jieyouxu marked this pull request as ready for review January 14, 2025 03:16
@jieyouxu
Copy link
Member Author

r? compiler
@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 Jan 14, 2025
@lqd
Copy link
Member

lqd commented Jan 14, 2025

I've already started looking at this. Might as well do it all, r? lqd

@rustbot rustbot assigned lqd and unassigned lcnr Jan 14, 2025
@jieyouxu jieyouxu force-pushed the migrate-extern-fn-reachable branch 2 times, most recently from 7887569 to 6d08192 Compare January 14, 2025 15:16
@jieyouxu
Copy link
Member Author

Changes since last review:

  • Removed the leftover dylib path gymnastics.
  • Changed symbol checks to be for existence and not for exact count.

Co-authored-by: binarycat <binarycat@envs.net>
@jieyouxu jieyouxu force-pushed the migrate-extern-fn-reachable branch from 6d08192 to 98f673e Compare January 14, 2025 17:05
@lqd
Copy link
Member

lqd commented Jan 14, 2025

r=me once you're happy with CI / try builds

@jieyouxu
Copy link
Member Author

The test hasn't changed functional-wise since last try job run, and it passes locally so,
@bors r=@lqd rollup=iffy (inspects symbol visiblity that has platform-conditional logic)

@bors
Copy link
Contributor

bors commented Jan 14, 2025

📌 Commit 98f673e has been approved by lqd

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 Jan 14, 2025
Comment on lines +38 to +45
println!("expected_symbols = {:?}", expected_symbols);
println!("found_symbols = {:?}", found_symbols);
if !found_symbols.is_superset(&expected_symbols) {
for diff in expected_symbols.difference(&found_symbols) {
eprintln!("missing symbol: {}", diff);
}
panic!("missing expected symbols");
}
Copy link
Member

Choose a reason for hiding this comment

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

❤️

@bors
Copy link
Contributor

bors commented Jan 16, 2025

⌛ Testing commit 98f673e with merge 5cd16b7...

@bors
Copy link
Contributor

bors commented Jan 16, 2025

☀️ Test successful - checks-actions
Approved by: lqd
Pushing 5cd16b7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 16, 2025
@bors bors merged commit 5cd16b7 into rust-lang:master Jan 16, 2025
7 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 16, 2025
@jieyouxu jieyouxu deleted the migrate-extern-fn-reachable branch January 16, 2025 05:25
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5cd16b7): 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 (secondary 1.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)
1.6% [1.0%, 2.1%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) - - 0

Cycles

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

Binary size

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

Bootstrap: 761.656s -> 762.718s (0.14%)
Artifact size: 326.09 MiB -> 326.06 MiB (-0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-run-make Area: port run-make Makefiles to rmake.rs A-tidy Area: The tidy tool 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants