Skip to content

Commit a2ccd97

Browse files
committed
Add a run-make test for non-cross --print=target-cpus
1 parent 9fa9ef3 commit a2ccd97

File tree

1 file changed

+23
-0
lines changed
  • tests/run-make/print-target-cpus-native

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//@ ignore-cross-compile ("native" is only printed when host==target)
2+
3+
use run_make_support::{assert_contains_regex, rfs, rustc, target};
4+
5+
// Test that the first CPU printed by `--print=target-cpus` for the non-cross
6+
// target is "native", with a suitable remark.
7+
8+
fn main() {
9+
let expected = r"^Available CPUs for this target:
10+
native +- Select the CPU of the current host \(currently [^ )]+\)\.
11+
";
12+
13+
// Without an explicit target.
14+
rustc().print("target-cpus").run().assert_stdout_contains_regex(expected);
15+
16+
// With an explicit target that happens to be the host.
17+
let host = target(); // Because of ignore-cross-compile, assume host == target.
18+
rustc().print("target-cpus").target(host).run().assert_stdout_contains_regex(expected);
19+
20+
// With an explicit output path.
21+
rustc().print("target-cpus=./xyzzy.txt").run().assert_stdout_equals("");
22+
assert_contains_regex(rfs::read_to_string("./xyzzy.txt"), expected);
23+
}

0 commit comments

Comments
 (0)