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.
This commit is contained in:
parent
bac15db1d0
commit
0fef658ffe
3 changed files with 29 additions and 0 deletions
8
tests/codegen/instrument-xray/basic.rs
Normal file
8
tests/codegen/instrument-xray/basic.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
// Checks that `-Z instrument-xray` produces expected instrumentation.
|
||||||
|
//
|
||||||
|
// compile-flags: -Z instrument-xray=always
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// CHECK: attributes #{{.*}} "function-instrument"="xray-always"
|
||||||
|
pub fn function() {}
|
11
tests/codegen/instrument-xray/options-combine.rs
Normal file
11
tests/codegen/instrument-xray/options-combine.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
// Checks that `-Z instrument-xray` options can be specified multiple times.
|
||||||
|
//
|
||||||
|
// compile-flags: -Z instrument-xray=skip-exit
|
||||||
|
// compile-flags: -Z instrument-xray=instruction-threshold=123
|
||||||
|
// compile-flags: -Z instrument-xray=instruction-threshold=456
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// CHECK: attributes #{{.*}} "xray-instruction-threshold"="456" "xray-skip-exit"
|
||||||
|
// CHECK-NOT: attributes #{{.*}} "xray-instruction-threshold"="123"
|
||||||
|
pub fn function() {}
|
10
tests/codegen/instrument-xray/options-override.rs
Normal file
10
tests/codegen/instrument-xray/options-override.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
// Checks that the last `-Z instrument-xray` option wins.
|
||||||
|
//
|
||||||
|
// compile-flags: -Z instrument-xray=always
|
||||||
|
// compile-flags: -Z instrument-xray=never
|
||||||
|
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
|
||||||
|
// CHECK: attributes #{{.*}} "function-instrument"="xray-never"
|
||||||
|
// CHECK-NOT: attributes #{{.*}} "function-instrument"="xray-always"
|
||||||
|
pub fn function() {}
|
Loading…
Add table
Add a link
Reference in a new issue