Skip to content

Commit 7dc2cab

Browse files
Rollup merge of #129690 - Oneirical:run-make-tidbits, r=jieyouxu
Add `needs-unwind` compiletest directive to `libtest-thread-limit` and replace some `Path` with `path` in `run-make` Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html). This PR does two things: 1. Add this to `libtest-thread-limit` ([Why?](#128507 (comment))) ``` //@ needs-unwind // Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere // else that uses panic=abort. ``` 2. Use `path` instead of `Path` to simplify multiple run-make tests.
2 parents a65404a + 65cb5de commit 7dc2cab

File tree

9 files changed

+43
-56
lines changed

9 files changed

+43
-56
lines changed
+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
//@ only-windows
22
// Reason: dos devices are a Windows thing
33

4-
use std::path::Path;
5-
6-
use run_make_support::{rustc, static_lib_name};
4+
use run_make_support::{path, rustc, static_lib_name};
75

86
fn main() {
97
rustc().input(r"\\.\NUL").crate_type("staticlib").run();
108
rustc().input(r"\\?\NUL").crate_type("staticlib").run();
119

12-
assert!(Path::new(&static_lib_name("rust_out")).exists());
10+
assert!(path(&static_lib_name("rust_out")).exists());
1311
}

tests/run-make/emit-shared-files/rmake.rs

+21-23
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
// `all-shared` should only emit files that can be shared between crates.
66
// See https://github.com/rust-lang/rust/pull/83478
77

8-
use std::path::Path;
9-
10-
use run_make_support::{has_extension, has_prefix, rustdoc, shallow_find_files};
8+
use run_make_support::{has_extension, has_prefix, path, rustdoc, shallow_find_files};
119

1210
fn main() {
1311
rustdoc()
@@ -19,18 +17,18 @@ fn main() {
1917
.args(&["--extend-css", "z.css"])
2018
.input("x.rs")
2119
.run();
22-
assert!(Path::new("invocation-only/search-index-xxx.js").exists());
23-
assert!(Path::new("invocation-only/crates-xxx.js").exists());
24-
assert!(Path::new("invocation-only/settings.html").exists());
25-
assert!(Path::new("invocation-only/x/all.html").exists());
26-
assert!(Path::new("invocation-only/x/index.html").exists());
27-
assert!(Path::new("invocation-only/theme-xxx.css").exists()); // generated from z.css
28-
assert!(!Path::new("invocation-only/storage-xxx.js").exists());
29-
assert!(!Path::new("invocation-only/SourceSerif4-It.ttf.woff2").exists());
20+
assert!(path("invocation-only/search-index-xxx.js").exists());
21+
assert!(path("invocation-only/crates-xxx.js").exists());
22+
assert!(path("invocation-only/settings.html").exists());
23+
assert!(path("invocation-only/x/all.html").exists());
24+
assert!(path("invocation-only/x/index.html").exists());
25+
assert!(path("invocation-only/theme-xxx.css").exists()); // generated from z.css
26+
assert!(!path("invocation-only/storage-xxx.js").exists());
27+
assert!(!path("invocation-only/SourceSerif4-It.ttf.woff2").exists());
3028
// FIXME: this probably shouldn't have a suffix
31-
assert!(Path::new("invocation-only/y-xxx.css").exists());
29+
assert!(path("invocation-only/y-xxx.css").exists());
3230
// FIXME: this is technically incorrect (see `write_shared`)
33-
assert!(!Path::new("invocation-only/main-xxx.js").exists());
31+
assert!(!path("invocation-only/main-xxx.js").exists());
3432

3533
rustdoc()
3634
.arg("-Zunstable-options")
@@ -61,10 +59,10 @@ fn main() {
6159
.len(),
6260
1
6361
);
64-
assert!(!Path::new("toolchain-only/search-index-xxx.js").exists());
65-
assert!(!Path::new("toolchain-only/x/index.html").exists());
66-
assert!(!Path::new("toolchain-only/theme.css").exists());
67-
assert!(!Path::new("toolchain-only/y-xxx.css").exists());
62+
assert!(!path("toolchain-only/search-index-xxx.js").exists());
63+
assert!(!path("toolchain-only/x/index.html").exists());
64+
assert!(!path("toolchain-only/theme.css").exists());
65+
assert!(!path("toolchain-only/y-xxx.css").exists());
6866

6967
rustdoc()
7068
.arg("-Zunstable-options")
@@ -88,17 +86,17 @@ fn main() {
8886
.len(),
8987
1
9088
);
91-
assert!(!Path::new("all-shared/search-index-xxx.js").exists());
92-
assert!(!Path::new("all-shared/settings.html").exists());
93-
assert!(!Path::new("all-shared/x").exists());
94-
assert!(!Path::new("all-shared/src").exists());
95-
assert!(!Path::new("all-shared/theme.css").exists());
89+
assert!(!path("all-shared/search-index-xxx.js").exists());
90+
assert!(!path("all-shared/settings.html").exists());
91+
assert!(!path("all-shared/x").exists());
92+
assert!(!path("all-shared/src").exists());
93+
assert!(!path("all-shared/theme.css").exists());
9694
assert_eq!(
9795
shallow_find_files("all-shared/static.files", |path| {
9896
has_prefix(path, "main-") && has_extension(path, "js")
9997
})
10098
.len(),
10199
1
102100
);
103-
assert!(!Path::new("all-shared/y-xxx.css").exists());
101+
assert!(!path("all-shared/y-xxx.css").exists());
104102
}

tests/run-make/libtest-thread-limit/rmake.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
// Reason: thread limit modification
1212
//@ ignore-cross-compile
1313
// Reason: this test fails armhf-gnu, reasons unknown
14+
//@ needs-unwind
15+
// Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere
16+
// else that uses panic=abort.
1417

1518
use std::ffi::{self, CStr, CString};
1619
use std::path::PathBuf;
+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use std::path::Path;
2-
3-
use run_make_support::rustc;
1+
use run_make_support::{path, rustc};
42

53
fn main() {
64
rustc().input("bar.rs").crate_name("foo").run();
7-
assert!(Path::new("libfoo.rlib").is_file());
5+
assert!(path("libfoo.rlib").is_file());
86
}

tests/run-make/pretty-print-with-dep-file/rmake.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
// does not get an unexpected dep-info file.
66
// See https://github.com/rust-lang/rust/issues/112898
77

8-
use std::path::Path;
9-
10-
use run_make_support::{invalid_utf8_contains, rfs, rustc};
8+
use run_make_support::{invalid_utf8_contains, path, rfs, rustc};
119

1210
fn main() {
1311
rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
1412
invalid_utf8_contains("with-dep.d", "with-dep.rs");
1513
rfs::remove_file("with-dep.d");
1614
rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
17-
assert!(!Path::new("with-dep.d").exists());
15+
assert!(!path("with-dep.d").exists());
1816
}

tests/run-make/profile/rmake.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,14 @@
88
//@ ignore-cross-compile
99
//@ needs-profiler-support
1010

11-
use std::path::Path;
12-
13-
use run_make_support::{run, rustc};
11+
use run_make_support::{path, run, rustc};
1412

1513
fn main() {
1614
rustc().arg("-g").arg("-Zprofile").input("test.rs").run();
1715
run("test");
18-
assert!(Path::new("test.gcno").exists(), "no .gcno file");
19-
assert!(Path::new("test.gcda").exists(), "no .gcda file");
16+
assert!(path("test.gcno").exists(), "no .gcno file");
17+
assert!(path("test.gcda").exists(), "no .gcda file");
2018
rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run();
2119
run("test");
22-
assert!(Path::new("abc/abc.gcda").exists(), "gcda file not emitted to defined path");
20+
assert!(path("abc/abc.gcda").exists(), "gcda file not emitted to defined path");
2321
}

tests/run-make/reset-codegen-1/rmake.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
//@ ignore-cross-compile
99

10-
use std::path::Path;
11-
12-
use run_make_support::{bin_name, rustc};
10+
use run_make_support::{bin_name, path, rustc};
1311

1412
fn compile(output_file: &str, emit: Option<&str>) {
1513
let mut rustc = rustc();
@@ -34,10 +32,10 @@ fn main() {
3432
// In the None case, bin_name is required for successful Windows compilation.
3533
let output_file = &bin_name(output_file);
3634
compile(output_file, emit);
37-
assert!(Path::new(output_file).is_file());
35+
assert!(path(output_file).is_file());
3836
}
3937

4038
compile("multi-output", Some("asm,obj"));
41-
assert!(Path::new("multi-output.s").is_file());
42-
assert!(Path::new("multi-output.o").is_file());
39+
assert!(path("multi-output.s").is_file());
40+
assert!(path("multi-output.o").is_file());
4341
}

tests/run-make/rustdoc-determinism/rmake.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// Assert that the search index is generated deterministically, regardless of the
22
// order that crates are documented in.
33

4-
use std::path::Path;
5-
6-
use run_make_support::{diff, rustdoc};
4+
use run_make_support::{diff, path, rustdoc};
75

86
fn main() {
9-
let foo_first = Path::new("foo_first");
7+
let foo_first = path("foo_first");
108
rustdoc().input("foo.rs").out_dir(&foo_first).run();
119
rustdoc().input("bar.rs").out_dir(&foo_first).run();
1210

13-
let bar_first = Path::new("bar_first");
11+
let bar_first = path("bar_first");
1412
rustdoc().input("bar.rs").out_dir(&bar_first).run();
1513
rustdoc().input("foo.rs").out_dir(&bar_first).run();
1614

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
// Checks that if the output folder doesn't exist, rustdoc will create it.
22

3-
use std::path::Path;
4-
5-
use run_make_support::rustdoc;
3+
use run_make_support::{path, rustdoc};
64

75
fn main() {
8-
let out_dir = Path::new("foo/bar/doc");
6+
let out_dir = path("foo/bar/doc");
97
rustdoc().input("foo.rs").out_dir(&out_dir).run();
108
assert!(out_dir.exists());
119
}

0 commit comments

Comments
 (0)