2024-05-21 19:50:57 +00:00
|
|
|
// Testing various mixings of rlibs and dylibs. Makes sure that it's possible to
|
|
|
|
// link an rlib to a dylib. The dependency tree among the file looks like:
|
|
|
|
//
|
|
|
|
// foo
|
|
|
|
// / \
|
|
|
|
// bar1 bar2
|
|
|
|
// / \ /
|
|
|
|
// baz baz2
|
|
|
|
//
|
|
|
|
// This is generally testing the permutations of the foo/bar1/bar2 layer against
|
|
|
|
// the baz/baz2 layer
|
|
|
|
|
|
|
|
//@ ignore-cross-compile
|
|
|
|
|
2024-06-06 19:34:34 +00:00
|
|
|
use run_make_support::{run_in_tmpdir, rustc};
|
2024-05-21 19:50:57 +00:00
|
|
|
|
2024-05-21 19:52:00 +00:00
|
|
|
fn main() {
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
// Building just baz
|
|
|
|
rustc().crate_type("rlib").input("foo.rs").run();
|
|
|
|
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("bin").input("baz.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("rlib").input("bar1.rs").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("bin").input("baz.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
// Building baz2
|
|
|
|
rustc().crate_type("rlib").input("foo.rs").run();
|
|
|
|
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
|
2024-06-07 13:23:10 +00:00
|
|
|
rustc().crate_type("dylib").input("baz2.rs").run_fail().assert_exit_code(1);
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run_fail().assert_exit_code(1);
|
2024-05-21 19:52:00 +00:00
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("rlib").input("foo.rs").run();
|
|
|
|
rustc().crate_type("rlib").input("bar1.rs").run();
|
|
|
|
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("rlib").input("foo.rs").run();
|
|
|
|
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("rlib").input("bar2.rs").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("rlib").input("foo.rs").run();
|
|
|
|
rustc().crate_type("rlib").input("bar1.rs").run();
|
|
|
|
rustc().crate_type("rlib").input("bar2.rs").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("rlib").input("bar1.rs").run();
|
|
|
|
rustc().crate_type("rlib").input("bar2.rs").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("rlib").input("bar2.rs").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-06-06 16:59:43 +00:00
|
|
|
run_in_tmpdir(|| {
|
2024-05-21 19:52:00 +00:00
|
|
|
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("rlib").input("bar1.rs").run();
|
|
|
|
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
});
|
2024-05-21 19:50:57 +00:00
|
|
|
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
|
|
|
|
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
|
|
|
|
rustc().crate_type("bin").input("baz2.rs").run();
|
|
|
|
}
|