Skip to content

Commit 7317313

Browse files
committed
Add compiler tests for xray
1 parent a715655 commit 7317313

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed

tests/assembly/x86_64-xray.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//@ assembly-output: emit-asm
2+
//@ compile-flags: --crate-type lib -Zinstrument-xray=always -C llvm-args=-x86-asm-syntax=intel
3+
//@ only-x86_64
4+
//@ ignore-sgx
5+
6+
// CHECK-LABEL: xray_func:
7+
#[no_mangle]
8+
pub fn xray_func() {
9+
// CHECK: nop word ptr [rax + rax + 512]
10+
11+
std::hint::black_box(());
12+
13+
// CHECK: ret
14+
// CHECK-NEXT: nop word ptr cs:[rax + rax + 512]
15+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//@ only-nightly (flag is still unstable)
2+
//@ needs-xray
3+
4+
//@ revisions: unsupported
5+
//@[unsupported] compile-flags: -Z instrument-xray --target=x86_64-pc-windows-msvc
6+
7+
//@ revisions: x86_64-linux
8+
//@[x86_64-linux] needs-llvm-components: x86
9+
//@[x86_64-linux] compile-flags: -Z instrument-xray --target=x86_64-unknown-linux-gnu
10+
//@[x86_64-linux] check-pass
11+
12+
//@ revisions: x86_64-darwin
13+
//@[x86_64-darwin] needs-llvm-components: x86
14+
//@[x86_64-darwin] compile-flags: -Z instrument-xray --target=x86_64-apple-darwin
15+
//@[x86_64-darwin] check-pass
16+
17+
//@ revisions: aarch64-darwin
18+
//@[aarch64-darwin] needs-llvm-components: aarch64
19+
//@[aarch64-darwin] compile-flags: -Z instrument-xray --target=aarch64-apple-darwin
20+
//@[aarch64-darwin] check-pass
21+
22+
#![feature(no_core)]
23+
#![no_core]
24+
#![no_main]
25+
26+
//[unsupported]~? ERROR XRay instrumentation is not supported for this target

tests/ui/instrument-xray/target-not-supported.rs

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)