Skip to content

Commit fb6fbf0

Browse files
Use FileCheck to parameterize codegen tests over hashes
When things like our internal hashing or representations change, it is inappropriate for these tests to suddenly fail for no reason. The chance of error is reduced if we instead pattern-match.
1 parent 27529d5 commit fb6fbf0

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tests/assembly/asm/global_asm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
2525
global_asm!("call {}", sym my_func);
2626
// CHECK: lea rax, [rip + MY_STATIC]
2727
global_asm!("lea rax, [rip + {}]", sym MY_STATIC);
28-
// CHECK: call _RNvCsddMtV7nAi4C_10global_asm6foobar
28+
// CHECK: call _RNvC[[CRATE_IDENT:[a-zA-Z0-9]{12}]]_10global_asm6foobar
2929
global_asm!("call {}", sym foobar);
30-
// CHECK: _RNvCsddMtV7nAi4C_10global_asm6foobar:
30+
// CHECK: _RNvC[[CRATE_IDENT]]_10global_asm6foobar:
3131
fn foobar() {
3232
loop {}
3333
}

tests/codegen/consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
// CHECK: @STATIC = {{.*}}, align 4
1010

1111
// This checks the constants from inline_enum_const
12-
// CHECK: @alloc_af1f8e8e6f4b341431a1d405e652df2d = {{.*}}, align 2
12+
// CHECK: @alloc_[[INLINE_ENUM_HASH:[a-f0-9]{32}]] = {{.*}}, align 2
1313

1414
// This checks the constants from {low,high}_align_const, they share the same
1515
// constant, but the alignment differs, so the higher one should be used
16-
// CHECK: [[LOW_HIGH:@alloc_[a-f0-9]+]] = {{.*}}, align 4
16+
// CHECK: [[LOW_HIGH:@alloc_[a-f0-9]{32}]] = {{.*}}, align 4
1717

1818
#[derive(Copy, Clone)]
1919
// repr(i16) is required for the {low,high}_align_const test

tests/codegen/pattern_type_symbols.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ fn foo<T>() {}
1515

1616
pub fn bar() {
1717
// CHECK: call pattern_type_symbols::foo::<u32>
18-
// CHECK: call void @_RINvCs3QvG2ESzx2Q_20pattern_type_symbols3foomEB2_
18+
// CHECK: call void @_RINvC[[CRATE_IDENT:[a-zA-Z0-9]{12}]]_20pattern_type_symbols3foomEB2_
1919
foo::<u32>();
2020
// CHECK: call pattern_type_symbols::foo::<(u32, [(); 0], [(); 999999999], [(); true])>
21-
// CHECK: call void @_RINvCs3QvG2ESzx2Q_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_Aub1_EEB2_
21+
// CHECK: call void @_RINvC[[CRATE_IDENT]]_20pattern_type_symbols3fooTmAum0_Aum3b9ac9ff_Aub1_EEB2_
2222
foo::<NanoU32>();
2323
}

tests/codegen/virtual-function-elimination.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn taking_u(u: &dyn U) -> i32 {
8181
}
8282

8383
pub fn taking_v(v: &dyn V) -> i32 {
84-
// CHECK: @llvm.type.checked.load({{.*}}, i32 24, metadata !"NtCs64ITQYi9761_28virtual_function_elimination1V")
84+
// CHECK: @llvm.type.checked.load({{.*}}, i32 24, metadata !"NtC[[CRATE_IDENT:[a-zA-Z0-9]{12}]]_28virtual_function_elimination1V")
8585
v.public_function()
8686
}
8787

@@ -96,5 +96,5 @@ pub fn main() {
9696
// CHECK: ![[TYPE0]] = !{i64 0, !"[[MANGLED_TYPE0]]"}
9797
// CHECK: ![[VCALL_VIS0]] = !{i64 2}
9898
// CHECK: ![[TYPE1]] = !{i64 0, !"[[MANGLED_TYPE1]]"}
99-
// CHECK: ![[TYPE2]] = !{i64 0, !"NtCs64ITQYi9761_28virtual_function_elimination1V"}
99+
// CHECK: ![[TYPE2]] = !{i64 0, !"NtC[[CRATE_IDENT]]_28virtual_function_elimination1V"}
100100
// CHECK: ![[VCALL_VIS2]] = !{i64 1}

0 commit comments

Comments
 (0)