Skip to content

Commit ac00d79

Browse files
committed
Add compiler tests for xray
1 parent 1758f07 commit ac00d79

File tree

4 files changed

+43
-10
lines changed

4 files changed

+43
-10
lines changed

tests/assembly/x86_64-xray.rs

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