Skip to content

Commit

Permalink
Rollup merge of rust-lang#125104 - Oneirical:test6, r=jieyouxu
Browse files Browse the repository at this point in the history
Migrate `run-make/no-cdylib-as-rdylib` 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).

> "the test will fail if the cdylib is picked, because it doesn't export any rust symbols"

Is that true? Is there a way to verify?

I suggest maybe extending the test with: (after cleaning the directory)

```rust
    rustc()
        .input("bar.rs")
        .crate_type("cdylib")
        .run();
    rustc()
        .input("foo.rs")
        .prefer_dynamic()
        .run();
    fail();
```

to make sure we're actually testing something here.
  • Loading branch information
jieyouxu committed May 14, 2024
2 parents e789b8b + 1f61cc3 commit 49d9c1e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ run-make/native-link-modifier-whole-archive/Makefile
run-make/no-alloc-shim/Makefile
run-make/no-builtins-attribute/Makefile
run-make/no-builtins-lto/Makefile
run-make/no-cdylib-as-rdylib/Makefile
run-make/no-duplicate-libs/Makefile
run-make/no-intermediate-extras/Makefile
run-make/obey-crate-type-flag/Makefile
Expand Down
16 changes: 0 additions & 16 deletions tests/run-make/no-cdylib-as-rdylib/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions tests/run-make/no-cdylib-as-rdylib/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This test produces an rlib and a cdylib from bar.rs.
// Then, foo.rs attempts to link to the bar library.
// If the test passes, that means rustc favored the rlib and ignored the cdylib.
// If the test fails, that is because the cdylib was picked, which does not export
// any Rust symbols.
// See https://github.com/rust-lang/rust/pull/113695

//@ ignore-cross-compile

use run_make_support::{run, rustc};

fn main() {
rustc().input("bar.rs").crate_type("rlib").crate_type("cdylib").run();
rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
run("foo");
}

0 comments on commit 49d9c1e

Please sign in to comment.