Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 026b144

Browse files
authored
Rollup merge of rust-lang#125383 - Oneirical:bundle-them-up, r=jieyouxu
Rewrite `emit`, `mixing-formats` and `bare-outfile` `run-make` tests in `rmake.rs` format Part of rust-lang#121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
2 parents ef035c1 + 4e37db5 commit 026b144

File tree

7 files changed

+127
-109
lines changed

7 files changed

+127
-109
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ run-make/allow-non-lint-warnings-cmdline/Makefile
33
run-make/allow-warnings-cmdline-stability/Makefile
44
run-make/archive-duplicate-names/Makefile
55
run-make/atomic-lock-free/Makefile
6-
run-make/bare-outfile/Makefile
76
run-make/branch-protection-check-IBT/Makefile
87
run-make/c-dynamic-dylib/Makefile
98
run-make/c-dynamic-rlib/Makefile
@@ -48,7 +47,6 @@ run-make/emit-path-unhashed/Makefile
4847
run-make/emit-shared-files/Makefile
4948
run-make/emit-stack-sizes/Makefile
5049
run-make/emit-to-stdout/Makefile
51-
run-make/emit/Makefile
5250
run-make/env-dep-info/Makefile
5351
run-make/error-found-staticlib-instead-crate/Makefile
5452
run-make/error-writing-dependencies/Makefile
@@ -163,7 +161,6 @@ run-make/mingw-export-call-convention/Makefile
163161
run-make/mismatching-target-triples/Makefile
164162
run-make/missing-crate-dependency/Makefile
165163
run-make/mixing-deps/Makefile
166-
run-make/mixing-formats/Makefile
167164
run-make/mixing-libs/Makefile
168165
run-make/msvc-opt-minsize/Makefile
169166
run-make/multiple-emits/Makefile

tests/run-make/bare-outfile/Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/run-make/bare-outfile/rmake.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// This test checks that manually setting the output file as a bare file with no file extension
2+
// still results in successful compilation.
3+
4+
//@ ignore-cross-compile
5+
6+
use run_make_support::{run, rustc, tmp_dir};
7+
use std::env;
8+
use std::fs;
9+
10+
fn main() {
11+
fs::copy("foo.rs", tmp_dir().join("foo.rs")).unwrap();
12+
env::set_current_dir(tmp_dir());
13+
rustc().output("foo").input("foo.rs").run();
14+
run("foo");
15+
}

tests/run-make/emit/Makefile

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/run-make/emit/rmake.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// A bug from 2015 would cause errors when emitting multiple types of files
2+
// in the same rustc call. A fix was created in #30452. This test checks that rustc still compiles
3+
// a source file successfully when emission of multiple output artifacts are requested.
4+
// See https://github.com/rust-lang/rust/pull/30452
5+
6+
//@ ignore-cross-compile
7+
8+
use run_make_support::{run, rustc};
9+
10+
fn main() {
11+
let opt_levels = ["0", "1", "2", "3", "s", "z"];
12+
for level in opt_levels {
13+
rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-24876.rs").run();
14+
}
15+
for level in opt_levels {
16+
rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-26235.rs").run();
17+
run("test-26235");
18+
}
19+
}

tests/run-make/mixing-formats/Makefile

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Testing various mixings of rlibs and dylibs. Makes sure that it's possible to
2+
// link an rlib to a dylib. The dependency tree among the file looks like:
3+
//
4+
// foo
5+
// / \
6+
// bar1 bar2
7+
// / \ /
8+
// baz baz2
9+
//
10+
// This is generally testing the permutations of the foo/bar1/bar2 layer against
11+
// the baz/baz2 layer
12+
13+
//@ ignore-cross-compile
14+
15+
use run_make_support::{rustc, tmp_dir};
16+
use std::fs;
17+
18+
fn test_with_teardown(rustc_calls: impl Fn()) {
19+
rustc_calls();
20+
fs::remove_dir_all(tmp_dir()).unwrap();
21+
fs::create_dir(tmp_dir()).unwrap();
22+
}
23+
24+
fn main() {
25+
test_with_teardown(|| {
26+
// Building just baz
27+
rustc().crate_type("rlib").input("foo.rs").run();
28+
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
29+
rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
30+
rustc().crate_type("bin").input("baz.rs").run();
31+
});
32+
test_with_teardown(|| {
33+
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
34+
rustc().crate_type("rlib").input("bar1.rs").run();
35+
rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
36+
rustc().crate_type("bin").input("baz.rs").run();
37+
});
38+
test_with_teardown(|| {
39+
// Building baz2
40+
rustc().crate_type("rlib").input("foo.rs").run();
41+
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
42+
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
43+
rustc().crate_type("dylib").input("baz2.rs").run_fail_assert_exit_code(1);
44+
rustc().crate_type("bin").input("baz2.rs").run_fail_assert_exit_code(1);
45+
});
46+
test_with_teardown(|| {
47+
rustc().crate_type("rlib").input("foo.rs").run();
48+
rustc().crate_type("rlib").input("bar1.rs").run();
49+
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
50+
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
51+
rustc().crate_type("bin").input("baz2.rs").run();
52+
});
53+
test_with_teardown(|| {
54+
rustc().crate_type("rlib").input("foo.rs").run();
55+
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
56+
rustc().crate_type("rlib").input("bar2.rs").run();
57+
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
58+
rustc().crate_type("bin").input("baz2.rs").run();
59+
});
60+
test_with_teardown(|| {
61+
rustc().crate_type("rlib").input("foo.rs").run();
62+
rustc().crate_type("rlib").input("bar1.rs").run();
63+
rustc().crate_type("rlib").input("bar2.rs").run();
64+
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
65+
rustc().crate_type("bin").input("baz2.rs").run();
66+
});
67+
test_with_teardown(|| {
68+
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
69+
rustc().crate_type("rlib").input("bar1.rs").run();
70+
rustc().crate_type("rlib").input("bar2.rs").run();
71+
rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
72+
rustc().crate_type("bin").input("baz2.rs").run();
73+
});
74+
test_with_teardown(|| {
75+
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
76+
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
77+
rustc().crate_type("rlib").input("bar2.rs").run();
78+
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
79+
rustc().crate_type("bin").input("baz2.rs").run();
80+
});
81+
test_with_teardown(|| {
82+
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
83+
rustc().crate_type("rlib").input("bar1.rs").run();
84+
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
85+
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
86+
rustc().crate_type("bin").input("baz2.rs").run();
87+
});
88+
rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
89+
rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
90+
rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
91+
rustc().crate_type("dylib,rlib").input("baz2.rs").run();
92+
rustc().crate_type("bin").input("baz2.rs").run();
93+
}

0 commit comments

Comments
 (0)