Skip to content

Commit 2283847

Browse files
committed
simplified tests
1 parent b70c63a commit 2283847

File tree

2 files changed

+36
-44
lines changed

2 files changed

+36
-44
lines changed

tests/run-make/hotpatch-unaffected/rmake.rs

+20-24
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,25 @@
88
use run_make_support::{assertion_helpers, llvm, rustc};
99

1010
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");
3430

3531
{
3632
let mut lines_regular = regular_dump.lines();
@@ -46,7 +42,7 @@ fn main() {
4642
assertion_helpers::assert_equals(&r, &h)
4743
}
4844
}
49-
_ => panic!("the files should have equal length"),
45+
_ => panic!("expected files to have equal number of lines"),
5046
}
5147
}
5248
}

tests/run-make/hotpatch/rmake.rs

+16-20
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,29 @@
1010
use run_make_support::{llvm, rustc};
1111

1212
fn main() {
13-
let disassemble_symbols_arg = "--disassemble-symbols=tailcall_fn,empty_fn";
14-
{
15-
rustc().input("lib.rs").crate_name("regular").crate_type("lib").opt_level("3").run();
13+
fn base_rustc() -> rustc::Rustc {
14+
let mut rustc = rustc();
15+
rustc.input("lib.rs").crate_type("lib").opt_level("3");
16+
rustc
17+
}
1618

17-
let regular_dump = llvm::llvm_objdump()
18-
.arg(disassemble_symbols_arg)
19-
.input("libregular.rlib")
19+
fn dump_lib(libname: &str) -> String {
20+
llvm::llvm_objdump()
21+
.arg("--disassemble-symbols=tailcall_fn,empty_fn")
22+
.input(libname)
2023
.run()
21-
.stdout_utf8();
24+
.stdout_utf8()
25+
}
2226

27+
{
28+
base_rustc().crate_name("regular").run();
29+
let regular_dump = dump_lib("libregular.rlib");
2330
llvm::llvm_filecheck().patterns("lib.rs").stdin_buf(regular_dump).run();
2431
}
2532

2633
{
27-
rustc()
28-
.input("lib.rs")
29-
.crate_name("hotpatch")
30-
.crate_type("lib")
31-
.opt_level("3")
32-
.arg("-Zhotpatch")
33-
.run();
34-
35-
let hotpatch_dump = llvm::llvm_objdump()
36-
.arg(disassemble_symbols_arg)
37-
.input("libhotpatch.rlib")
38-
.run()
39-
.stdout_utf8();
34+
base_rustc().crate_name("hotpatch").arg("-Zhotpatch").run();
35+
let hotpatch_dump = dump_lib("libhotpatch.rlib");
4036

4137
llvm::llvm_filecheck()
4238
.patterns("lib.rs")

0 commit comments

Comments
 (0)