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.
This commit is contained in:
parent
191df20fca
commit
a86df238d3
4 changed files with 41 additions and 18 deletions
|
@ -1,18 +0,0 @@
|
||||||
//@ revisions: nocpu cpu
|
|
||||||
//@ no-prefer-dynamic
|
|
||||||
//@ compile-flags: --crate-type=cdylib --target=amdgcn-amd-amdhsa
|
|
||||||
//@ needs-llvm-components: amdgpu
|
|
||||||
//@ needs-rust-lld
|
|
||||||
//@[nocpu] build-fail
|
|
||||||
//@[cpu] compile-flags: -Ctarget-cpu=gfx900
|
|
||||||
//@[cpu] build-pass
|
|
||||||
|
|
||||||
#![feature(no_core, lang_items)]
|
|
||||||
#![no_core]
|
|
||||||
|
|
||||||
#[lang="sized"]
|
|
||||||
trait Sized {}
|
|
||||||
|
|
||||||
pub fn foo() {}
|
|
||||||
|
|
||||||
//[nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`
|
|
4
tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr
Normal file
4
tests/ui/target-cpu/explicit-target-cpu.avr_nocpu.stderr
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
error: target requires explicitly specifying a cpu with `-C target-cpu`
|
||||||
|
|
||||||
|
error: aborting due to 1 previous error
|
||||||
|
|
37
tests/ui/target-cpu/explicit-target-cpu.rs
Normal file
37
tests/ui/target-cpu/explicit-target-cpu.rs
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//! Check that certain target *requires* the user to specify a target CPU via `-C target-cpu`.
|
||||||
|
|
||||||
|
//@ revisions: amdgcn_nocpu amdgcn_cpu
|
||||||
|
|
||||||
|
//@[amdgcn_nocpu] compile-flags: --target=amdgcn-amd-amdhsa
|
||||||
|
//@[amdgcn_nocpu] needs-llvm-components: amdgpu
|
||||||
|
//@[amdgcn_nocpu] build-fail
|
||||||
|
|
||||||
|
//@[amdgcn_cpu] compile-flags: --target=amdgcn-amd-amdhsa
|
||||||
|
//@[amdgcn_cpu] needs-llvm-components: amdgpu
|
||||||
|
//@[amdgcn_cpu] compile-flags: -Ctarget-cpu=gfx900
|
||||||
|
//@[amdgcn_cpu] build-pass
|
||||||
|
|
||||||
|
//@ revisions: avr_nocpu avr_cpu
|
||||||
|
|
||||||
|
//@[avr_nocpu] compile-flags: --target=avr-none
|
||||||
|
//@[avr_nocpu] needs-llvm-components: avr
|
||||||
|
//@[avr_nocpu] build-fail
|
||||||
|
|
||||||
|
//@[avr_cpu] compile-flags: --target=avr-none
|
||||||
|
//@[avr_cpu] needs-llvm-components: avr
|
||||||
|
//@[avr_cpu] compile-flags: -Ctarget-cpu=atmega328p
|
||||||
|
//@[avr_cpu] build-pass
|
||||||
|
|
||||||
|
#![crate_type = "rlib"]
|
||||||
|
|
||||||
|
// FIXME(#140038): this can't use `minicore` yet because `minicore` doesn't currently propagate the
|
||||||
|
// `-C target-cpu` for targets that *require* a `target-cpu` being specified.
|
||||||
|
#![feature(no_core, lang_items)]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[lang="sized"]
|
||||||
|
trait Sized {}
|
||||||
|
|
||||||
|
pub fn foo() {}
|
||||||
|
|
||||||
|
//[amdgcn_nocpu,avr_nocpu]~? ERROR target requires explicitly specifying a cpu with `-C target-cpu`
|
Loading…
Add table
Add a link
Reference in a new issue