Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit cbdcb85

Browse files
committed
tests: adjust embed-metadata for cross-compile
1 parent e95fdc0 commit cbdcb85

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/run-make/embed-metadata/rmake.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
// Tests the -Zembed-metadata compiler flag.
22
// Tracking issue: https://github.com/rust-lang/rust/issues/139165
33

4+
//@ needs-dynamic-linking
5+
//@ needs-crate-type: dylib
6+
47
use run_make_support::rfs::{create_dir, remove_file, rename};
5-
use run_make_support::{Rustc, dynamic_lib_name, path, run_in_tmpdir, rust_lib_name, rustc};
8+
use run_make_support::{
9+
Rustc, dynamic_lib_name, path, run_in_tmpdir, rust_lib_name, rustc, target,
10+
};
611

712
#[derive(Debug, Copy, Clone)]
813
enum LibraryKind {
@@ -42,7 +47,7 @@ fn main() {
4247
fn lookup_rmeta_in_lib_dir(kind: LibraryKind) {
4348
run_in_tmpdir(|| {
4449
build_dep_rustc(kind).run();
45-
rustc().input("foo.rs").run();
50+
rustc().target(target()).input("foo.rs").run();
4651
});
4752
}
4853

@@ -54,6 +59,7 @@ fn lookup_rmeta_through_extern(kind: LibraryKind) {
5459
build_dep_rustc(kind).out_dir("deps").run();
5560

5661
let mut rustc = rustc();
62+
rustc.target(target());
5763
kind.add_extern(&mut rustc, "dep1", "deps");
5864
rustc.extern_("dep1", path("deps").join("libdep1.rmeta"));
5965
rustc.input("foo.rs").run();
@@ -67,13 +73,15 @@ fn lookup_rmeta_missing(kind: LibraryKind) {
6773
build_dep_rustc(kind).out_dir("deps").run();
6874

6975
let mut rustc = rustc();
76+
rustc.target(target());
7077
kind.add_extern(&mut rustc, "dep1", "deps");
7178
rustc.input("foo.rs").run_fail().assert_stderr_contains("only metadata stub found");
7279
});
7380
}
7481

7582
fn build_dep_rustc(kind: LibraryKind) -> Rustc {
7683
let mut dep_rustc = rustc();
84+
dep_rustc.target(target());
7785
dep_rustc
7886
.arg("-Zembed-metadata=no")
7987
.crate_type(kind.crate_type())

0 commit comments

Comments
 (0)