File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
tests/run-make/print-target-cpus-native Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments