Skip to content

Commit

Permalink
rewrite mixing-formats test
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed May 21, 2024
1 parent 28894e9 commit f49ff94
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 75 deletions.
75 changes: 0 additions & 75 deletions tests/run-make/mixing-formats/Makefile

This file was deleted.

87 changes: 87 additions & 0 deletions tests/run-make/mixing-formats/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// 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

use run_make_support::{rustc, tmp_dir};
use std::fs;

fn main() {
// 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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
// 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();
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);
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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;
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
fs::remove_dir_all(tmp_dir()).unwrap();
fs::create_dir(tmp_dir()).unwrap();
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();
}

0 comments on commit f49ff94

Please sign in to comment.