Skip to content

Commit 0fef658

Browse files
committed
Codegen tests for -Z instrument-xray
Let's add at least some tests to verify that this option is accepted and produces expected LLVM attributes. More tests can be added later with attribute support.
1 parent bac15db commit 0fef658

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Checks that `-Z instrument-xray` produces expected instrumentation.
2+
//
3+
// compile-flags: -Z instrument-xray=always
4+
5+
#![crate_type = "lib"]
6+
7+
// CHECK: attributes #{{.*}} "function-instrument"="xray-always"
8+
pub fn function() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Checks that `-Z instrument-xray` options can be specified multiple times.
2+
//
3+
// compile-flags: -Z instrument-xray=skip-exit
4+
// compile-flags: -Z instrument-xray=instruction-threshold=123
5+
// compile-flags: -Z instrument-xray=instruction-threshold=456
6+
7+
#![crate_type = "lib"]
8+
9+
// CHECK: attributes #{{.*}} "xray-instruction-threshold"="456" "xray-skip-exit"
10+
// CHECK-NOT: attributes #{{.*}} "xray-instruction-threshold"="123"
11+
pub fn function() {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Checks that the last `-Z instrument-xray` option wins.
2+
//
3+
// compile-flags: -Z instrument-xray=always
4+
// compile-flags: -Z instrument-xray=never
5+
6+
#![crate_type = "lib"]
7+
8+
// CHECK: attributes #{{.*}} "function-instrument"="xray-never"
9+
// CHECK-NOT: attributes #{{.*}} "function-instrument"="xray-always"
10+
pub fn function() {}

0 commit comments

Comments
 (0)