Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add needs-unwind compiletest directive to libtest-thread-limit and replace some Path with path in run-make #129690

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions tests/run-make/dos-device-input/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
//@ only-windows
// Reason: dos devices are a Windows thing

use std::path::Path;

use run_make_support::{rustc, static_lib_name};
use run_make_support::{path, rustc, static_lib_name};

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

assert!(Path::new(&static_lib_name("rust_out")).exists());
assert!(path(&static_lib_name("rust_out")).exists());
}
44 changes: 21 additions & 23 deletions tests/run-make/emit-shared-files/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
// `all-shared` should only emit files that can be shared between crates.
// See https://github.com/rust-lang/rust/pull/83478

use std::path::Path;

use run_make_support::{has_extension, has_prefix, rustdoc, shallow_find_files};
use run_make_support::{has_extension, has_prefix, path, rustdoc, shallow_find_files};

fn main() {
rustdoc()
Expand All @@ -19,18 +17,18 @@ fn main() {
.args(&["--extend-css", "z.css"])
.input("x.rs")
.run();
assert!(Path::new("invocation-only/search-index-xxx.js").exists());
assert!(Path::new("invocation-only/crates-xxx.js").exists());
assert!(Path::new("invocation-only/settings.html").exists());
assert!(Path::new("invocation-only/x/all.html").exists());
assert!(Path::new("invocation-only/x/index.html").exists());
assert!(Path::new("invocation-only/theme-xxx.css").exists()); // generated from z.css
assert!(!Path::new("invocation-only/storage-xxx.js").exists());
assert!(!Path::new("invocation-only/SourceSerif4-It.ttf.woff2").exists());
assert!(path("invocation-only/search-index-xxx.js").exists());
assert!(path("invocation-only/crates-xxx.js").exists());
assert!(path("invocation-only/settings.html").exists());
assert!(path("invocation-only/x/all.html").exists());
assert!(path("invocation-only/x/index.html").exists());
assert!(path("invocation-only/theme-xxx.css").exists()); // generated from z.css
assert!(!path("invocation-only/storage-xxx.js").exists());
assert!(!path("invocation-only/SourceSerif4-It.ttf.woff2").exists());
// FIXME: this probably shouldn't have a suffix
assert!(Path::new("invocation-only/y-xxx.css").exists());
assert!(path("invocation-only/y-xxx.css").exists());
// FIXME: this is technically incorrect (see `write_shared`)
assert!(!Path::new("invocation-only/main-xxx.js").exists());
assert!(!path("invocation-only/main-xxx.js").exists());

rustdoc()
.arg("-Zunstable-options")
Expand Down Expand Up @@ -61,10 +59,10 @@ fn main() {
.len(),
1
);
assert!(!Path::new("toolchain-only/search-index-xxx.js").exists());
assert!(!Path::new("toolchain-only/x/index.html").exists());
assert!(!Path::new("toolchain-only/theme.css").exists());
assert!(!Path::new("toolchain-only/y-xxx.css").exists());
assert!(!path("toolchain-only/search-index-xxx.js").exists());
assert!(!path("toolchain-only/x/index.html").exists());
assert!(!path("toolchain-only/theme.css").exists());
assert!(!path("toolchain-only/y-xxx.css").exists());

rustdoc()
.arg("-Zunstable-options")
Expand All @@ -88,17 +86,17 @@ fn main() {
.len(),
1
);
assert!(!Path::new("all-shared/search-index-xxx.js").exists());
assert!(!Path::new("all-shared/settings.html").exists());
assert!(!Path::new("all-shared/x").exists());
assert!(!Path::new("all-shared/src").exists());
assert!(!Path::new("all-shared/theme.css").exists());
assert!(!path("all-shared/search-index-xxx.js").exists());
assert!(!path("all-shared/settings.html").exists());
assert!(!path("all-shared/x").exists());
assert!(!path("all-shared/src").exists());
assert!(!path("all-shared/theme.css").exists());
assert_eq!(
shallow_find_files("all-shared/static.files", |path| {
has_prefix(path, "main-") && has_extension(path, "js")
})
.len(),
1
);
assert!(!Path::new("all-shared/y-xxx.css").exists());
assert!(!path("all-shared/y-xxx.css").exists());
}
3 changes: 3 additions & 0 deletions tests/run-make/libtest-thread-limit/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// Reason: thread limit modification
//@ ignore-cross-compile
// Reason: this test fails armhf-gnu, reasons unknown
//@ needs-unwind
// Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere
// else that uses panic=abort.

use std::ffi::{self, CStr, CString};
use std::path::PathBuf;
Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/manual-crate-name/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
use std::path::Path;

use run_make_support::rustc;
use run_make_support::{path, rustc};

fn main() {
rustc().input("bar.rs").crate_name("foo").run();
assert!(Path::new("libfoo.rlib").is_file());
assert!(path("libfoo.rlib").is_file());
}
6 changes: 2 additions & 4 deletions tests/run-make/pretty-print-with-dep-file/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
// does not get an unexpected dep-info file.
// See https://github.com/rust-lang/rust/issues/112898

use std::path::Path;

use run_make_support::{invalid_utf8_contains, rfs, rustc};
use run_make_support::{invalid_utf8_contains, path, rfs, rustc};

fn main() {
rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
invalid_utf8_contains("with-dep.d", "with-dep.rs");
rfs::remove_file("with-dep.d");
rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
assert!(!Path::new("with-dep.d").exists());
assert!(!path("with-dep.d").exists());
}
10 changes: 4 additions & 6 deletions tests/run-make/profile/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@
//@ ignore-cross-compile
//@ needs-profiler-support

use std::path::Path;

use run_make_support::{run, rustc};
use run_make_support::{path, run, rustc};

fn main() {
rustc().arg("-g").arg("-Zprofile").input("test.rs").run();
run("test");
assert!(Path::new("test.gcno").exists(), "no .gcno file");
assert!(Path::new("test.gcda").exists(), "no .gcda file");
assert!(path("test.gcno").exists(), "no .gcno file");
assert!(path("test.gcda").exists(), "no .gcda file");
rustc().arg("-g").arg("-Zprofile").arg("-Zprofile-emit=abc/abc.gcda").input("test.rs").run();
run("test");
assert!(Path::new("abc/abc.gcda").exists(), "gcda file not emitted to defined path");
assert!(path("abc/abc.gcda").exists(), "gcda file not emitted to defined path");
}
10 changes: 4 additions & 6 deletions tests/run-make/reset-codegen-1/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@

//@ ignore-cross-compile

use std::path::Path;

use run_make_support::{bin_name, rustc};
use run_make_support::{bin_name, path, rustc};

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

compile("multi-output", Some("asm,obj"));
assert!(Path::new("multi-output.s").is_file());
assert!(Path::new("multi-output.o").is_file());
assert!(path("multi-output.s").is_file());
assert!(path("multi-output.o").is_file());
}
8 changes: 3 additions & 5 deletions tests/run-make/rustdoc-determinism/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Assert that the search index is generated deterministically, regardless of the
// order that crates are documented in.

use std::path::Path;

use run_make_support::{diff, rustdoc};
use run_make_support::{diff, path, rustdoc};

fn main() {
let foo_first = Path::new("foo_first");
let foo_first = path("foo_first");
rustdoc().input("foo.rs").out_dir(&foo_first).run();
rustdoc().input("bar.rs").out_dir(&foo_first).run();

let bar_first = Path::new("bar_first");
let bar_first = path("bar_first");
rustdoc().input("bar.rs").out_dir(&bar_first).run();
rustdoc().input("foo.rs").out_dir(&bar_first).run();

Expand Down
6 changes: 2 additions & 4 deletions tests/run-make/rustdoc-output-path/rmake.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// Checks that if the output folder doesn't exist, rustdoc will create it.

use std::path::Path;

use run_make_support::rustdoc;
use run_make_support::{path, rustdoc};

fn main() {
let out_dir = Path::new("foo/bar/doc");
let out_dir = path("foo/bar/doc");
rustdoc().input("foo.rs").out_dir(&out_dir).run();
assert!(out_dir.exists());
}
Loading