Skip to content

Commit a86df23

Browse files
committed
tests: rework amdgpu-require-explicit-cpu.rs
- Reworked the test as a *centralized* version of checking that certain targets correctly require `-C target-cpu` being specified. - Document test intention. - Move `amdgpu-require-explicit-cpu.rs` under new dir `tests/ui/target-cpu/` - No other ui subdir really fits this "requires `-Ctarget-cpu`" check.
1 parent 191df20 commit a86df23

4 files changed

+41
-18
lines changed

Diff for: tests/ui/amdgpu-require-explicit-cpu.rs

-18
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
error: target requires explicitly specifying a cpu with `-C target-cpu`
2+
3+
error: aborting due to 1 previous error
4+

Diff for: tests/ui/target-cpu/explicit-target-cpu.rs

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//! Check that certain target *requires* the user to specify a target CPU via `-C target-cpu`.
2+
3+
//@ revisions: amdgcn_nocpu amdgcn_cpu
4+
5+
//@[amdgcn_nocpu] compile-flags: --target=amdgcn-amd-amdhsa
6+
//@[amdgcn_nocpu] needs-llvm-components: amdgpu
7+
//@[amdgcn_nocpu] build-fail
8+
9+
//@[amdgcn_cpu] compile-flags: --target=amdgcn-amd-amdhsa
10+
//@[amdgcn_cpu] needs-llvm-components: amdgpu
11+
//@[amdgcn_cpu] compile-flags: -Ctarget-cpu=gfx900
12+
//@[amdgcn_cpu] build-pass
13+
14+
//@ revisions: avr_nocpu avr_cpu
15+
16+
//@[avr_nocpu] compile-flags: --target=avr-none
17+
//@[avr_nocpu] needs-llvm-components: avr
18+
//@[avr_nocpu] build-fail
19+
20+
//@[avr_cpu] compile-flags: --target=avr-none
21+
//@[avr_cpu] needs-llvm-components: avr
22+
//@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p
23+
//@[avr_cpu] build-pass
24+
25+
#![crate_type = "rlib"]
26+
27+
// FIXME(#140038): this can't use `minicore` yet because `minicore` doesn't currently propagate the
28+
// `-C target-cpu` for targets that *require* a `target-cpu` being specified.
29+
#![feature(no_core, lang_items)]
30+
#![no_core]
31+
32+
#[lang="sized"]
33+
trait Sized {}
34+
35+
pub fn foo() {}
36+
37+
//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`

0 commit comments

Comments
 (0)