-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #127825 - Oneirical:self-testeem, r=jieyouxu
Migrate `macos-fat-archive`, `manual-link` and `archive-duplicate-names` `run-make` tests to rmake Part of #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 try-job: aarch64-apple
- Loading branch information
Showing
7 changed files
with
73 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// When two object archives with the same filename are present, an iterator is supposed to | ||
// inspect each object, recognize the duplication and extract each one to a different directory. | ||
// This test checks that this duplicate handling behaviour has not been broken. | ||
// See https://github.com/rust-lang/rust/pull/24439 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{cc, is_msvc, llvm_ar, rfs, run, rustc}; | ||
|
||
fn main() { | ||
rfs::create_dir("a"); | ||
rfs::create_dir("b"); | ||
compile_obj_force_foo("a", "foo"); | ||
compile_obj_force_foo("b", "bar"); | ||
let mut ar = llvm_ar(); | ||
ar.obj_to_ar().arg("libfoo.a"); | ||
if is_msvc() { | ||
ar.arg("a/foo.obj").arg("b/foo.obj").run(); | ||
} else { | ||
ar.arg("a/foo.o").arg("b/foo.o").run(); | ||
} | ||
rustc().input("foo.rs").run(); | ||
rustc().input("bar.rs").run(); | ||
run("bar"); | ||
} | ||
|
||
#[track_caller] | ||
pub fn compile_obj_force_foo(dir: &str, lib_name: &str) { | ||
let obj_file = if is_msvc() { format!("{dir}/foo") } else { format!("{dir}/foo.o") }; | ||
let src = format!("{lib_name}.c"); | ||
if is_msvc() { | ||
cc().arg("-c").out_exe(&obj_file).input(src).run(); | ||
} else { | ||
cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run(); | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// macOS (and iOS) has a concept of universal (fat) binaries which contain code for multiple CPU | ||
// architectures in the same file. Apple is migrating from x86_64 to aarch64 CPUs, | ||
// so for the next few years it will be important for macOS developers to | ||
// build "fat" binaries (executables and cdylibs). | ||
|
||
// Rustc used to be unable to handle these special libraries, which was fixed in #98736. If | ||
// compilation in this test is successful, the native fat library was successfully linked to. | ||
// See https://github.com/rust-lang/rust/issues/55235 | ||
|
||
//@ only-apple | ||
|
||
use run_make_support::{cc, llvm_ar, rustc}; | ||
|
||
fn main() { | ||
cc().args(&["-arch", "arm64", "-arch", "x86_64", "native-library.c", "-c"]) | ||
.out_exe("native-library.o") | ||
.run(); | ||
llvm_ar().obj_to_ar().output_input("libnative-library.a", "native-library.o").run(); | ||
rustc().input("lib.rs").crate_type("lib").arg("-lstatic=native-library").run(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// A smoke test for the `-l` command line rustc flag, which manually links to the selected | ||
// library. Useful for native libraries, this is roughly equivalent to `#[link]` in Rust code. | ||
// If compilation succeeds, the flag successfully linked the native library. | ||
// See https://github.com/rust-lang/rust/pull/18470 | ||
|
||
//@ ignore-cross-compile | ||
// Reason: the compiled binary is executed | ||
|
||
use run_make_support::{build_native_static_lib, run, rustc}; | ||
|
||
fn main() { | ||
build_native_static_lib("bar"); | ||
rustc().input("foo.rs").arg("-lstatic=bar").run(); | ||
rustc().input("main.rs").run(); | ||
run("main"); | ||
} |