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

Migrate min-global-align and no-alloc-shim run-make tests to rmake #128407

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

Oneirical
Copy link
Contributor

@Oneirical Oneirical commented Jul 30, 2024

Part of #121876 and the associated Google Summer of Code project.

Please try:

try-job: aarch64-apple
try-job: test-various
try-job: armhf-gnu
try-job: aarch64-gnu
try-job: aarch64-gnu

@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 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 A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc 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 Jul 30, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jul 30, 2024

This PR modifies tests/run-make/. If this PR is trying to port a Makefile
run-make test to use rmake.rs, please update the
run-make port tracking issue
so we can track our progress. You can either modify the tracking issue
directly, or you can comment on the tracking issue and link this PR.

cc @jieyouxu

The run-make-support library was changed

cc @jieyouxu

@Kobzol
Copy link
Contributor

Kobzol commented Jul 30, 2024

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 30, 2024
Migrate `min-global-align` and `no-alloc-shim` `run-make` tests to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: x86_64-msvc
@bors
Copy link
Contributor

bors commented Jul 30, 2024

⌛ Trying commit 4c26950 with merge 8e53144...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Jul 31, 2024

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

//@ ignore-cross-compile
// Reason: the compiled binary is executed

//FIXME(Oneirical): ignore-msvc FIXME(bjorn3) can't figure out how to link with the MSVC toolchain
Copy link
Member

@jieyouxu jieyouxu Aug 3, 2024

Choose a reason for hiding this comment

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

Discussion: I'm fine with ignoring msvc for now and leaving this FIXME in, unless you want to investigate how to make msvc linking succeeds here.

The error message suggests we might be missing a -lstdc++ or something?

I can try to take a look at the msvc stuff.

Copy link
Member

Choose a reason for hiding this comment

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

I suspect that the C runtime library isn't being passed to the linker because the compiler isn't being given any source code to compile, only object files. Adding libcmt.lib to the args (if msvc) would fix this but maybe there should be some more principled way of doing this. Maybe a link() alternative to cc that only does linking? Not sure.

One odd thing I noticed is __udivti3. That suggests to me that compiler-builtins is also needed.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, actually we already have extra_c_flags. Instead of using a hard coded list, maybe we could just use --print native-static-libs to grab all the necessary ones. That should also include the CRT. But that's probably a big enough job to do separately.

Copy link
Member

Choose a reason for hiding this comment

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

I was able to get this test to pass on msvc by adding libcmt.lib as Chris mentioned, but also had to pass compiler-builtins:

use run_make_support::{
    cc, cwd, extra_c_flags, has_extension, has_prefix, run, rustc, shallow_find_files,
};

fn main() {
    rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run();
    let libdir = rustc().print("target-libdir").run().stdout_utf8();
    let libdir = libdir.trim();
    let alloc_libs = shallow_find_files(&libdir, |path| {
        has_prefix(path, "liballoc-") && has_extension(path, "rlib")
    });
    let core_libs = shallow_find_files(libdir, |path| {
        has_prefix(path, "libcore-") && has_extension(path, "rlib")
    });
    let compiler_builtins_libs = shallow_find_files(libdir, |path| {
        has_prefix(path, "libcompiler_builtins") && has_extension(path, "rlib")
    });

    cc().args(extra_c_flags())
        .input("foo.o")
        .out_exe("foo")
        .arg("/link")
        .args(&alloc_libs)
        .args(&core_libs)
        .args(&compiler_builtins_libs)
        .arg("libcmt.lib")
        .run();
    run("foo");

    // Check that linking without __rust_no_alloc_shim_is_unstable defined fails
    rustc()
        .input("foo.rs")
        .crate_type("bin")
        .emit("obj")
        .panic("abort")
        .cfg("check_feature_gate")
        .run();
    cc().args(extra_c_flags())
        .input("foo.o")
        .out_exe("foo")
        .arg("/link")
        .args(&alloc_libs)
        .args(&core_libs)
        .args(&compiler_builtins_libs)
        .arg("libcmt.lib")
        .run_fail();
}

Not super sure about what's the best thing to do w.r.t. having to pass libcmt.lib.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's better to accept this PR with ignore-msvc and then later figure the thing to do?

Copy link
Member

Choose a reason for hiding this comment

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

Instead of using a hard coded list, maybe we could just use --print native-static-libs to grab all the necessary ones. That should also include the CRT. But that's probably a big enough job to do separately.

I briefly looked at this and I don't think this is possible (currently), because its docs say:

This may be used when creating a staticlib crate type. If this is the only flag, it will perform a full compilation and include a diagnostic note that indicates the linker flags to use when linking the resulting static library.

Unfortunately, we're building a bin here, and I tried this locally, --print native-static-libs did not emit anything (just a newline).

Copy link
Member

@jieyouxu jieyouxu Aug 5, 2024

Choose a reason for hiding this comment

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

Maybe it's better to accept this PR with ignore-msvc and then later figure the thing to do?

Yeah, this was what I had in mind in #128407 (comment), and I don't want to block this PR on trying to unignore it on msvc -- I can try to investigate that separately.

Copy link
Member

Choose a reason for hiding this comment

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

@Oneirical let's add a ignore-msvc for this with a FIXME linking to #128602 and call it a day for now 😆 I'll investigate separately.

@rustbot author

Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately, we're building a bin here, and I tried this locally, --print native-static-libs did not emit anything (just a newline).

You'd need to build a fake staticlib then parse stdout. I think this could be done once in the extra_c_flags function and cached instead of hard coding a list of libraries to link, Or maybe it could be something compiletest does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very well. I have restored the ignore:

//@ ignore-msvc
//FIXME(Oneirical): Getting this to work on MSVC requires passing libcmt.lib to CC,
// which is not trivial to do.
// Tracking issue: https://github.com/rust-lang/rust/issues/128602
// Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172

@rustbot review

@rustbot rustbot 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 Aug 5, 2024
@Oneirical Oneirical force-pushed the feline-dotestication branch 2 times, most recently from 59abb8e to 2064a76 Compare August 5, 2024 15:04
@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 Aug 5, 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.

Thanks, LGTM overall, running few more try jobs to be safe.

@jieyouxu
Copy link
Member

jieyouxu commented Aug 5, 2024

@bors try

@jieyouxu
Copy link
Member

jieyouxu commented Aug 5, 2024

r=me if the try jobs pass
@bors delegate+

@bors
Copy link
Contributor

bors commented Aug 5, 2024

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

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

@jieyouxu
Copy link
Member

jieyouxu commented Aug 5, 2024

@bors rollup=iffy (symbol checks)

@bors

This comment was marked as resolved.

bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 5, 2024
Migrate `min-global-align` and `no-alloc-shim` `run-make` tests to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: aarch64-linux
try-job: test-various
try-job: armhf-gnu
try-job: x86_64-gnu-llvm-17
@rust-log-analyzer

This comment was marked as resolved.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 8, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Aug 8, 2024
…eyouxu

Migrate `min-global-align` and `no-alloc-shim` `run-make` tests to rmake

Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Please try:

try-job: aarch64-apple
try-job: test-various
try-job: armhf-gnu
try-job: x86_64-gnu-llvm-17
@bors
Copy link
Contributor

bors commented Aug 8, 2024

⌛ Testing commit e1c1ac1 with merge 2d57c94...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Aug 8, 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 Aug 8, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Aug 8, 2024

Wow. I'll take a look at this tomorrow.

@ChrisDenton
Copy link
Member

__muloti4 seems like another instance of missing compiler-builtins lib.

tests/run-make/min-global-align/rmake.rs Outdated Show resolved Hide resolved
Comment on lines +14 to +17
if llvm_components_contain("x86") {
rustc().target("i686-unknown-linux-gnu").emit("llvm-ir").input("min_global_align.rs").run();
assert_count_is(3, rfs::read_to_string("min_global_align.ll"), "align 1");
}
Copy link
Member

@jieyouxu jieyouxu Aug 14, 2024

Choose a reason for hiding this comment

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

Remark (for myself): I wonder if we could try to support revisions in rmake.rs. In ui tests and codegen tests revisions also define corresponding cfgs, maybe we could use them here as well (this remark is for myself).

Something like

//@ revisions: i686 systemz
//@[i686] needs-llvm-components: x86
//@[systemz] needs-llvm-components: systemz

fn main() {
    #[cfg(i686)]
    {
        // i686 specific assertions
    }
    #[cfg(systemz)]
    {
        // systemz specific assertions
    }
}

Just a thought. But handling blessing / properly quarantining revisions would be a pain.

tests/run-make/no-alloc-shim/rmake.rs Outdated Show resolved Hide resolved
@rustbot rustbot 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 Aug 14, 2024
@bors
Copy link
Contributor

bors commented Aug 14, 2024

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

@Oneirical
Copy link
Contributor Author

@bors r=@jieyouxu

@bors
Copy link
Contributor

bors commented Aug 14, 2024

📌 Commit b85bedc 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 14, 2024
@bors
Copy link
Contributor

bors commented Aug 14, 2024

⌛ Testing commit b85bedc with merge 13a5289...

@bors
Copy link
Contributor

bors commented Aug 14, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 14, 2024
@bors bors merged commit 13a5289 into rust-lang:master Aug 14, 2024
7 checks passed
@rustbot rustbot added this to the 1.82.0 milestone Aug 14, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (13a5289): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.2% [-0.2%, -0.2%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary 2.9%)

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)
2.9% [2.3%, 3.4%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
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: 753.65s -> 752.809s (-0.11%)
Artifact size: 341.43 MiB -> 341.47 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-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
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants