Skip to content

Commit 404d2c4

Browse files
committed
Set target to apple-darwin for macos to avoid cross-compile
1 parent fe92c3b commit 404d2c4

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

tests/support/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,11 @@ impl Test {
7676
let target = if self.msvc {
7777
"x86_64-pc-windows-msvc"
7878
} else {
79-
"x86_64-unknown-linux-gnu"
79+
if cfg!(target_os = "macos") {
80+
"x86_64-apple-darwin"
81+
} else {
82+
"x86_64-unknown-linux-gnu"
83+
}
8084
};
8185

8286
cfg.target(target)

tests/test.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ fn gnu_opt_level_s() {
5555
#[test]
5656
fn gnu_debug() {
5757
let test = Test::gnu();
58-
test.gcc().debug(true).file("foo.c").compile("foo");
58+
test.gcc()
59+
.target("x86_64-unknown-linux")
60+
.debug(true)
61+
.file("foo.c")
62+
.compile("foo");
5963
test.cmd(0).must_have("-gdwarf-4");
6064

6165
let test = Test::gnu();
@@ -70,15 +74,23 @@ fn gnu_debug() {
7074
#[test]
7175
fn gnu_debug_fp_auto() {
7276
let test = Test::gnu();
73-
test.gcc().debug(true).file("foo.c").compile("foo");
77+
test.gcc()
78+
.target("x86_64-unknown-linux")
79+
.debug(true)
80+
.file("foo.c")
81+
.compile("foo");
7482
test.cmd(0).must_have("-gdwarf-4");
7583
test.cmd(0).must_have("-fno-omit-frame-pointer");
7684
}
7785

7886
#[test]
7987
fn gnu_debug_fp() {
8088
let test = Test::gnu();
81-
test.gcc().debug(true).file("foo.c").compile("foo");
89+
test.gcc()
90+
.target("x86_64-unknown-linux")
91+
.debug(true)
92+
.file("foo.c")
93+
.compile("foo");
8294
test.cmd(0).must_have("-gdwarf-4");
8395
test.cmd(0).must_have("-fno-omit-frame-pointer");
8496
}
@@ -89,6 +101,7 @@ fn gnu_debug_nofp() {
89101

90102
let test = Test::gnu();
91103
test.gcc()
104+
.target("x86_64-unknown-linux")
92105
.debug(true)
93106
.force_frame_pointer(false)
94107
.file("foo.c")
@@ -98,6 +111,7 @@ fn gnu_debug_nofp() {
98111

99112
let test = Test::gnu();
100113
test.gcc()
114+
.target("x86_64-unknown-linux")
101115
.force_frame_pointer(false)
102116
.debug(true)
103117
.file("foo.c")

0 commit comments

Comments
 (0)