Skip to content

Commit 1371773

Browse files
authored
Rollup merge of #114229 - workingjubilee:nest-sanitizer-dir, r=Mark-Simulacrum
Nest tests/codegen/sanitizer*.rs tests in sanitizer dir The sanitizer tests are the largest and most meticulously tested set of tests in tests/codegen. That's good! They all clearly belong to a subject and thus could go in a directory, but are not, instead being placed simply in tests/codegen. That's bad! Fix this by placing them in their own directory and renaming them to be less repetitive after that move. A few tests are brittle, and embed their filename in the test's checks. This is acceptable for the ones where it is used only two times, but one test embeds the test's mangled filename in the test *over 50 times*! This may have been one of the things discouraging anyone from moving it, and thus from moving the set. Fortunately, I have some knowledge of Itanium mangling (involuntarily), regex, and the FileCheck syntax. With a capturing variable, FileCheck allows us to now move this test around again without diffing it on ~50 lines, while still guaranteeing that the mangled substring is the same each time. This also clarifies why the substring is repeated a zillion times, instead of being cryptic. They don't call it mangling because the result is pretty and easy to understand, but now it is slightly easier! Yay descriptive variables!
2 parents 61c55e3 + 4d2957c commit 1371773

29 files changed

+54
-54
lines changed

tests/codegen/sanitizer-cfi-emit-type-checks-attr-no-sanitize.rs tests/codegen/sanitizer/cfi-emit-type-checks-attr-no-sanitize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#[no_sanitize(cfi)]
1010
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
11-
// CHECK-LABEL: sanitizer_cfi_emit_type_checks_attr_no_sanitize::foo
11+
// CHECK-LABEL: cfi_emit_type_checks_attr_no_sanitize::foo
1212
// CHECK: Function Attrs: {{.*}}
1313
// CHECK-LABEL: define{{.*}}foo{{.*}}!type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
1414
// CHECK: start:

tests/codegen/sanitizer-cfi-emit-type-metadata-id-itanium-cxx-abi.rs tests/codegen/sanitizer/cfi-emit-type-metadata-id-itanium-cxx-abi.rs

+48-48
Large diffs are not rendered by default.

tests/codegen/sanitizer-kasan-emits-instrumentation.rs tests/codegen/sanitizer/kasan-emits-instrumentation.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ trait Copy {}
2525

2626
impl Copy for u8 {}
2727

28-
// CHECK-LABEL: ; sanitizer_kasan_emits_instrumentation::unsanitized
28+
// CHECK-LABEL: ; kasan_emits_instrumentation::unsanitized
2929
// CHECK-NEXT: ; Function Attrs:
3030
// CHECK-NOT: sanitize_address
3131
// CHECK: start:
@@ -36,7 +36,7 @@ pub fn unsanitized(b: &mut u8) -> u8 {
3636
*b
3737
}
3838

39-
// CHECK-LABEL: ; sanitizer_kasan_emits_instrumentation::sanitized
39+
// CHECK-LABEL: ; kasan_emits_instrumentation::sanitized
4040
// CHECK-NEXT: ; Function Attrs:
4141
// CHECK: sanitize_address
4242
// CHECK: start:

tests/codegen/sanitizer-kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs tests/codegen/sanitizer/kcfi-emit-kcfi-operand-bundle-attr-no-sanitize.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Copy for i32 {}
2020

2121
#[no_sanitize(kcfi)]
2222
pub fn foo(f: fn(i32) -> i32, arg: i32) -> i32 {
23-
// CHECK-LABEL: sanitizer_kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo
23+
// CHECK-LABEL: kcfi_emit_kcfi_operand_bundle_attr_no_sanitize::foo
2424
// CHECK: Function Attrs: {{.*}}
2525
// CHECK-LABEL: define{{.*}}foo{{.*}}!{{<unknown kind #36>|kcfi_type}} !{{[0-9]+}}
2626
// CHECK: start:

tests/codegen/sanitizer-no-sanitize.rs tests/codegen/sanitizer/no-sanitize.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#![crate_type="lib"]
88
#![feature(no_sanitize)]
99

10-
// CHECK-LABEL: ; sanitizer_no_sanitize::unsanitized
10+
// CHECK-LABEL: ; no_sanitize::unsanitized
1111
// CHECK-NEXT: ; Function Attrs:
1212
// CHECK-NOT: sanitize_address
1313
// CHECK: start:
@@ -18,7 +18,7 @@ pub fn unsanitized(b: &mut u8) -> u8 {
1818
*b
1919
}
2020

21-
// CHECK-LABEL: ; sanitizer_no_sanitize::sanitized
21+
// CHECK-LABEL: ; no_sanitize::sanitized
2222
// CHECK-NEXT: ; Function Attrs:
2323
// CHECK: sanitize_address
2424
// CHECK: start:

0 commit comments

Comments
 (0)