Skip to content

Commit bbadda8

Browse files
committed
tests: produce artifacts for target
1 parent dead8bf commit bbadda8

File tree

4 files changed

+40
-16
lines changed

4 files changed

+40
-16
lines changed
+27-5
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,43 @@
1-
use run_make_support::{bin_name, rust_lib_name, rustc};
1+
use run_make_support::{bin_name, rust_lib_name, rustc, target};
22

33
fn main() {
4-
rustc().print("crate-name").input("crate.rs").run().assert_stdout_equals("foo");
5-
rustc().print("file-names").input("crate.rs").run().assert_stdout_equals(bin_name("foo"));
64
rustc()
5+
.target(target())
6+
.print("crate-name")
7+
.input("crate.rs")
8+
.run()
9+
.assert_stdout_equals("foo");
10+
rustc()
11+
.target(target())
12+
.print("file-names")
13+
.input("crate.rs")
14+
.run()
15+
.assert_stdout_equals(bin_name("foo"));
16+
rustc()
17+
.target(target())
718
.print("file-names")
819
.crate_type("lib")
920
.arg("--test")
1021
.input("crate.rs")
1122
.run()
1223
.assert_stdout_equals(bin_name("foo"));
1324
rustc()
25+
.target(target())
1426
.print("file-names")
1527
.arg("--test")
1628
.input("lib.rs")
1729
.run()
1830
.assert_stdout_equals(bin_name("mylib"));
19-
rustc().print("file-names").input("lib.rs").run().assert_stdout_equals(rust_lib_name("mylib"));
20-
rustc().print("file-names").input("rlib.rs").run().assert_stdout_equals(rust_lib_name("mylib"));
31+
rustc()
32+
.target(target())
33+
.print("file-names")
34+
.input("lib.rs")
35+
.run()
36+
.assert_stdout_equals(rust_lib_name("mylib"));
37+
rustc()
38+
.target(target())
39+
.print("file-names")
40+
.input("rlib.rs")
41+
.run()
42+
.assert_stdout_equals(rust_lib_name("mylib"));
2143
}

tests/run-make/crate-name-priority/rmake.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
// and the compiler flags, and checks that the flag is favoured each time.
55
// See https://github.com/rust-lang/rust/pull/15518
66

7-
use run_make_support::{bin_name, rfs, rustc};
7+
use run_make_support::{bin_name, rfs, rustc, target};
88

99
fn main() {
10-
rustc().input("foo.rs").run();
10+
rustc().target(target()).input("foo.rs").run();
1111
rfs::remove_file(bin_name("foo"));
12-
rustc().input("foo.rs").crate_name("bar").run();
12+
rustc().target(target()).input("foo.rs").crate_name("bar").run();
1313
rfs::remove_file(bin_name("bar"));
14-
rustc().input("foo1.rs").run();
14+
rustc().target(target()).input("foo1.rs").run();
1515
rfs::remove_file(bin_name("foo"));
16-
rustc().input("foo1.rs").output(bin_name("bar1")).run();
16+
rustc().target(target()).input("foo1.rs").output(bin_name("bar1")).run();
1717
rfs::remove_file(bin_name("bar1"));
1818
}

tests/run-make/extra-filename-with-temp-outputs/rmake.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
// are named as expected.
77
// See https://github.com/rust-lang/rust/pull/15686
88

9-
use run_make_support::{bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files};
9+
use run_make_support::{
10+
bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files, target,
11+
};
1012

1113
fn main() {
12-
rustc().extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
14+
rustc().target(target()).extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
1315
let object_files = shallow_find_files(cwd(), |path| {
1416
has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o")
1517
});

tests/run-make/strip/rmake.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
// Test that -Cstrip correctly strips/preserves debuginfo and symbols.
44

5-
use run_make_support::{bin_name, is_darwin, llvm_dwarfdump, llvm_nm, rustc};
5+
use run_make_support::{bin_name, is_darwin, llvm_dwarfdump, llvm_nm, rustc, target};
66

77
fn main() {
88
// We use DW_ (the start of any DWARF name) to check that some debuginfo is present.
@@ -20,21 +20,21 @@ fn main() {
2020
// for std.
2121

2222
// -Cstrip=none should preserve symbols and debuginfo.
23-
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=none").run();
23+
rustc().target(target()).arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=none").run();
2424
llvm_nm().input(binary).run().assert_stdout_contains(test_symbol);
2525
if do_debuginfo_check {
2626
llvm_dwarfdump().input(binary).run().assert_stdout_contains(dwarf_indicator);
2727
}
2828

2929
// -Cstrip=debuginfo should preserve symbols and strip debuginfo.
30-
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=debuginfo").run();
30+
rustc().target(target()).arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=debuginfo").run();
3131
llvm_nm().input(binary).run().assert_stdout_contains(test_symbol);
3232
if do_debuginfo_check {
3333
llvm_dwarfdump().input(binary).run().assert_stdout_not_contains(dwarf_indicator);
3434
}
3535

3636
// -Cstrip=symbols should strip symbols and strip debuginfo.
37-
rustc().arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=symbols").run();
37+
rustc().target(target()).arg("hello.rs").arg("-Cdebuginfo=2").arg("-Cstrip=symbols").run();
3838
llvm_nm().input(binary).run().assert_stderr_not_contains(test_symbol);
3939
if do_debuginfo_check {
4040
llvm_dwarfdump().input(binary).run().assert_stdout_not_contains(dwarf_indicator);

0 commit comments

Comments
 (0)