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:
Oleksii Lozovskyi
2022-10-02 10:25:49 +09:00
parent bac15db1d0
commit 0fef658ffe
3 changed files with 29 additions and 0 deletions
+8
View 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() {}
@@ -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() {}
@@ -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() {}