8
8
use run_make_support:: { assertion_helpers, llvm, rustc} ;
9
9
10
10
fn main ( ) {
11
- let disassemble_symbols_arg = "--disassemble-symbols=return_42,tailcall" ;
12
-
13
- rustc ( ) . input ( "lib.rs" ) . crate_name ( "regular" ) . crate_type ( "lib" ) . opt_level ( "3" ) . run ( ) ;
14
-
15
- let regular_dump = llvm:: llvm_objdump ( )
16
- . arg ( disassemble_symbols_arg)
17
- . input ( "libregular.rlib" )
18
- . run ( )
19
- . stdout_utf8 ( ) ;
20
-
21
- rustc ( )
22
- . input ( "lib.rs" )
23
- . crate_name ( "hotpatch" )
24
- . crate_type ( "lib" )
25
- . opt_level ( "3" )
26
- . arg ( "-Zhotpatch" )
27
- . run ( ) ;
28
-
29
- let hotpatch_dump = llvm:: llvm_objdump ( )
30
- . arg ( disassemble_symbols_arg)
31
- . input ( "libhotpatch.rlib" )
32
- . run ( )
33
- . stdout_utf8 ( ) ;
11
+ fn base_rustc ( ) -> rustc:: Rustc {
12
+ let mut rustc = rustc ( ) ;
13
+ rustc. input ( "lib.rs" ) . crate_type ( "lib" ) . opt_level ( "3" ) ;
14
+ rustc
15
+ }
16
+
17
+ fn dump_lib ( libname : & str ) -> String {
18
+ llvm:: llvm_objdump ( )
19
+ . arg ( "--disassemble-symbols=return_42,tailcall" )
20
+ . input ( libname)
21
+ . run ( )
22
+ . stdout_utf8 ( )
23
+ }
24
+
25
+ base_rustc ( ) . crate_name ( "regular" ) . run ( ) ;
26
+ let regular_dump = dump_lib ( "libregular.rlib" ) ;
27
+
28
+ base_rustc ( ) . crate_name ( "hotpatch" ) . arg ( "-Zhotpatch" ) . run ( ) ;
29
+ let hotpatch_dump = dump_lib ( "libhotpatch.rlib" ) ;
34
30
35
31
{
36
32
let mut lines_regular = regular_dump. lines ( ) ;
@@ -46,7 +42,7 @@ fn main() {
46
42
assertion_helpers:: assert_equals ( & r, & h)
47
43
}
48
44
}
49
- _ => panic ! ( "the files should have equal length " ) ,
45
+ _ => panic ! ( "expected files to have equal number of lines " ) ,
50
46
}
51
47
}
52
48
}
0 commit comments