Skip to content

Commit 427f2d6

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 427f2d6

4 files changed

+40
-18
lines changed

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+
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
//@[avr_nocpu] compile-flags: --target=avr-none
16+
//@[avr_nocpu] needs-llvm-components: avr
17+
//@[avr_nocpu] build-fail
18+
19+
//@[avr_cpu] compile-flags: --target=avr-none
20+
//@[avr_cpu] needs-llvm-components: avr
21+
//@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p
22+
//@[avr_cpu] build-pass
23+
24+
#![crate_type = "rlib"]
25+
26+
// FIXME(#140038): this can't use `minicore` yet because `minicore` doesn't currently propagate the
27+
// `-C target-cpu` for targets that *require* a `target-cpu` being specified.
28+
#![feature(no_core, lang_items)]
29+
#![no_core]
30+
31+
#[lang="sized"]
32+
trait Sized {}
33+
34+
pub fn foo() {}
35+
36+
//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`

0 commit comments

Comments
 (0)