tests: update for renamed `fs` module in run_make_support

This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-07-17 12:42:06 +00:00
parent e1569fde3e
commit 636be91cc0
80 changed files with 225 additions and 239 deletions

View File

@ -5,14 +5,14 @@
use std::path::PathBuf; use std::path::PathBuf;
use run_make_support::{aux_build, fs_wrapper, rustc, source_root}; use run_make_support::{aux_build, fs as rfs, rustc, source_root};
fn main() { fn main() {
aux_build().input("stable.rs").emit("metadata").run(); aux_build().input("stable.rs").emit("metadata").run();
let output = let output =
rustc().input("main.rs").emit("metadata").extern_("stable", "libstable.rmeta").run(); rustc().input("main.rs").emit("metadata").extern_("stable", "libstable.rmeta").run();
let version = fs_wrapper::read_to_string(source_root().join("src/version")); let version = rfs::read_to_string(source_root().join("src/version"));
let expected_string = format!("stable since {}", version.trim()); let expected_string = format!("stable since {}", version.trim());
output.assert_stderr_contains(expected_string); output.assert_stderr_contains(expected_string);
} }

View File

@ -3,9 +3,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{ use run_make_support::{cc, cwd, dynamic_lib_extension, fs as rfs, is_msvc, run, run_fail, rustc};
cc, cwd, dynamic_lib_extension, fs_wrapper, is_msvc, read_dir, run, run_fail, rustc,
};
fn main() { fn main() {
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
@ -21,14 +19,14 @@ fn main() {
run("bar"); run("bar");
let expected_extension = dynamic_lib_extension(); let expected_extension = dynamic_lib_extension();
read_dir(cwd(), |path| { rfs::read_dir_entries(cwd(), |path| {
if path.is_file() if path.is_file()
&& path.extension().is_some_and(|ext| ext == expected_extension) && path.extension().is_some_and(|ext| ext == expected_extension)
&& path.file_name().and_then(|name| name.to_str()).is_some_and(|name| { && path.file_name().and_then(|name| name.to_str()).is_some_and(|name| {
name.ends_with(".so") || name.ends_with(".dll") || name.ends_with(".dylib") name.ends_with(".so") || name.ends_with(".dll") || name.ends_with(".dylib")
}) })
{ {
fs_wrapper::remove_file(path); rfs::remove_file(path);
} }
}); });
run_fail("bar"); run_fail("bar");

View File

@ -3,7 +3,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::fs_wrapper::remove_file; use run_make_support::fs::remove_file;
use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name}; use run_make_support::{cc, extra_c_flags, run, rustc, static_lib_name};
use std::fs; use std::fs;

View File

@ -10,7 +10,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{cc, cwd, dynamic_lib_name, fs_wrapper, is_msvc, run, rustc}; use run_make_support::{cc, cwd, dynamic_lib_name, fs as rfs, is_msvc, run, rustc};
fn main() { fn main() {
rustc().input("bar.rs").run(); rustc().input("bar.rs").run();
@ -23,7 +23,7 @@ fn main() {
} }
run("foo"); run("foo");
fs_wrapper::remove_file(dynamic_lib_name("foo")); rfs::remove_file(dynamic_lib_name("foo"));
rustc().input("foo.rs").arg("-Clto").run(); rustc().input("foo.rs").arg("-Clto").run();
run("foo"); run("foo");

View File

@ -9,9 +9,10 @@
use std::path::PathBuf; use std::path::PathBuf;
use run_make_support::fs as rfs;
use run_make_support::llvm_readobj; use run_make_support::llvm_readobj;
use run_make_support::rustc; use run_make_support::rustc;
use run_make_support::{cwd, env_var, read_dir, run_in_tmpdir}; use run_make_support::{cwd, env_var, run_in_tmpdir};
fn main() { fn main() {
let target = env_var("TARGET"); let target = env_var("TARGET");
@ -33,7 +34,7 @@ fn main() {
// Check all object files (including temporary outputs) have a `.comment` // Check all object files (including temporary outputs) have a `.comment`
// section with the expected content. // section with the expected content.
read_dir(cwd(), |f| { rfs::read_dir_entries(cwd(), |f| {
if !f.extension().is_some_and(|ext| ext == "o") { if !f.extension().is_some_and(|ext| ext == "o") {
return; return;
} }

View File

@ -14,7 +14,7 @@
#![deny(warnings)] #![deny(warnings)]
use run_make_support::fs_wrapper::{read, read_dir}; use run_make_support::fs::{read, read_dir};
use run_make_support::object::read::archive::ArchiveFile; use run_make_support::object::read::archive::ArchiveFile;
use run_make_support::object::read::Object; use run_make_support::object::read::Object;
use run_make_support::object::ObjectSection; use run_make_support::object::ObjectSection;

View File

@ -9,16 +9,16 @@
//@ ignore-wasm64 //@ ignore-wasm64
// Reason: a C compiler is required for build_native_static_lib // Reason: a C compiler is required for build_native_static_lib
use run_make_support::{build_native_static_lib, fs_wrapper, rustc, static_lib_name}; use run_make_support::{build_native_static_lib, fs as rfs, rustc, static_lib_name};
fn main() { fn main() {
build_native_static_lib("native"); build_native_static_lib("native");
let lib_native = static_lib_name("native"); let lib_native = static_lib_name("native");
fs_wrapper::create_dir_all("crate"); rfs::create_dir_all("crate");
fs_wrapper::create_dir_all("native"); rfs::create_dir_all("native");
fs_wrapper::rename(&lib_native, format!("native/{}", &lib_native)); rfs::rename(&lib_native, format!("native/{}", &lib_native));
rustc().input("a.rs").run(); rustc().input("a.rs").run();
fs_wrapper::rename("liba.rlib", "crate/liba.rlib"); rfs::rename("liba.rlib", "crate/liba.rlib");
rustc().input("b.rs").specific_library_search_path("native", "crate").run_fail(); rustc().input("b.rs").specific_library_search_path("native", "crate").run_fail();
rustc().input("b.rs").specific_library_search_path("dependency", "crate").run_fail(); rustc().input("b.rs").specific_library_search_path("dependency", "crate").run_fail();
rustc().input("b.rs").specific_library_search_path("crate", "crate").run(); rustc().input("b.rs").specific_library_search_path("crate", "crate").run();
@ -35,8 +35,8 @@ fn main() {
rustc().input("d.rs").specific_library_search_path("all", "native").run(); rustc().input("d.rs").specific_library_search_path("all", "native").run();
// Deduplication tests. // Deduplication tests.
fs_wrapper::create_dir_all("e1"); rfs::create_dir_all("e1");
fs_wrapper::create_dir_all("e2"); rfs::create_dir_all("e2");
rustc().input("e.rs").output("e1/libe.rlib").run(); rustc().input("e.rs").output("e1/libe.rlib").run();
rustc().input("e.rs").output("e2/libe.rlib").run(); rustc().input("e.rs").output("e2/libe.rlib").run();

View File

@ -1,11 +1,11 @@
// Tests that const prop lints interrupting codegen don't leave `.o` files around. // Tests that const prop lints interrupting codegen don't leave `.o` files around.
use run_make_support::{cwd, fs_wrapper, rustc}; use run_make_support::{cwd, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("input.rs").run_fail().assert_exit_code(1); rustc().input("input.rs").run_fail().assert_exit_code(1);
for entry in fs_wrapper::read_dir(cwd()) { for entry in rfs::read_dir(cwd()) {
let entry = entry.unwrap(); let entry = entry.unwrap();
let path = entry.path(); let path = entry.path();

View File

@ -4,15 +4,15 @@
// and the compiler flags, and checks that the flag is favoured each time. // and the compiler flags, and checks that the flag is favoured each time.
// See https://github.com/rust-lang/rust/pull/15518 // See https://github.com/rust-lang/rust/pull/15518
use run_make_support::{bin_name, fs_wrapper, rustc}; use run_make_support::{bin_name, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
fs_wrapper::remove_file(bin_name("foo")); rfs::remove_file(bin_name("foo"));
rustc().input("foo.rs").crate_name("bar").run(); rustc().input("foo.rs").crate_name("bar").run();
fs_wrapper::remove_file(bin_name("bar")); rfs::remove_file(bin_name("bar"));
rustc().input("foo1.rs").run(); rustc().input("foo1.rs").run();
fs_wrapper::remove_file(bin_name("foo")); rfs::remove_file(bin_name("foo"));
rustc().input("foo1.rs").output(bin_name("bar1")).run(); rustc().input("foo1.rs").output(bin_name("bar1")).run();
fs_wrapper::remove_file(bin_name("bar1")); rfs::remove_file(bin_name("bar1"));
} }

View File

@ -1,7 +1,7 @@
// Check that valid binaries are persisted by running them, regardless of whether the // Check that valid binaries are persisted by running them, regardless of whether the
// --run or --no-run option is used. // --run or --no-run option is used.
use run_make_support::fs_wrapper::{create_dir, remove_dir_all}; use run_make_support::fs::{create_dir, remove_dir_all};
use run_make_support::{run, rustc, rustdoc}; use run_make_support::{run, rustc, rustdoc};
use std::path::Path; use std::path::Path;

View File

@ -1,6 +1,6 @@
// Tests behavior of rustdoc `--runtool`. // Tests behavior of rustdoc `--runtool`.
use run_make_support::fs_wrapper::{create_dir, remove_dir_all}; use run_make_support::fs::{create_dir, remove_dir_all};
use run_make_support::{rustc, rustdoc}; use run_make_support::{rustc, rustdoc};
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -4,7 +4,7 @@
// a specific expected string. // a specific expected string.
// See https://github.com/rust-lang/rust/pull/105481 // See https://github.com/rust-lang/rust/pull/105481
use run_make_support::{cwd, fs_wrapper, rustc}; use run_make_support::{cwd, fs as rfs, rustc};
fn main() { fn main() {
rustc() rustc()
@ -13,5 +13,5 @@ fn main() {
.arg(format!("-Zdump-mono-stats={}", cwd().display())) .arg(format!("-Zdump-mono-stats={}", cwd().display()))
.arg("-Zdump-mono-stats-format=json") .arg("-Zdump-mono-stats-format=json")
.run(); .run();
assert!(fs_wrapper::read_to_string("foo.mono_items.json").contains(r#""name":"bar""#)); assert!(rfs::read_to_string("foo.mono_items.json").contains(r#""name":"bar""#));
} }

View File

@ -8,7 +8,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
// Reason: the compiled binary is executed // Reason: the compiled binary is executed
use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, run, run_fail, rustc};
fn main() { fn main() {
rustc().input("m1.rs").arg("-Cprefer-dynamic").run(); rustc().input("m1.rs").arg("-Cprefer-dynamic").run();
@ -16,8 +16,8 @@ fn main() {
rustc().input("m3.rs").arg("-Cprefer-dynamic").run(); rustc().input("m3.rs").arg("-Cprefer-dynamic").run();
rustc().input("m4.rs").run(); rustc().input("m4.rs").run();
run("m4"); run("m4");
fs_wrapper::remove_file(dynamic_lib_name("m1")); rfs::remove_file(dynamic_lib_name("m1"));
fs_wrapper::remove_file(dynamic_lib_name("m2")); rfs::remove_file(dynamic_lib_name("m2"));
fs_wrapper::remove_file(dynamic_lib_name("m3")); rfs::remove_file(dynamic_lib_name("m3"));
run_fail("m4"); run_fail("m4");
} }

View File

@ -1,6 +1,6 @@
use std::path::Path; use std::path::Path;
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn emit_and_check(out_dir: &Path, out_file: &str, format: &str) { fn emit_and_check(out_dir: &Path, out_file: &str, format: &str) {
let out_file = out_dir.join(out_file); let out_file = out_dir.join(out_file);
@ -11,7 +11,7 @@ fn emit_and_check(out_dir: &Path, out_file: &str, format: &str) {
fn main() { fn main() {
let out_dir = Path::new("emit"); let out_dir = Path::new("emit");
fs_wrapper::create_dir(&out_dir); rfs::create_dir(&out_dir);
emit_and_check(&out_dir, "libfoo.s", "asm"); emit_and_check(&out_dir, "libfoo.s", "asm");
emit_and_check(&out_dir, "libfoo.bc", "llvm-bc"); emit_and_check(&out_dir, "libfoo.bc", "llvm-bc");

View File

@ -6,13 +6,13 @@
// adding a new output type (in this test, metadata). // adding a new output type (in this test, metadata).
// See https://github.com/rust-lang/rust/issues/86044 // See https://github.com/rust-lang/rust/issues/86044
use run_make_support::{diff, fs_wrapper, rustc}; use run_make_support::{diff, fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::create_dir("emit"); rfs::create_dir("emit");
fs_wrapper::create_dir("emit/a"); rfs::create_dir("emit/a");
fs_wrapper::create_dir("emit/b"); rfs::create_dir("emit/b");
fs_wrapper::create_dir("emit/c"); rfs::create_dir("emit/c");
// The default output name. // The default output name.
rustc().emit("link").input("foo.rs").run(); rustc().emit("link").input("foo.rs").run();
// The output is named with the output flag. // The output is named with the output flag.

View File

@ -8,21 +8,21 @@
//@ ignore-cross-compile //@ ignore-cross-compile
// Reason: the compiled binary is executed // Reason: the compiled binary is executed
use run_make_support::{dynamic_lib_name, fs_wrapper, run, run_fail, rust_lib_name, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, run, run_fail, rust_lib_name, rustc};
fn main() { fn main() {
rustc().input("bar.rs").crate_type("rlib").crate_type("dylib").arg("-Cprefer-dynamic").run(); rustc().input("bar.rs").crate_type("rlib").crate_type("dylib").arg("-Cprefer-dynamic").run();
// By default, the rlib has priority over the dylib. // By default, the rlib has priority over the dylib.
rustc().input("foo.rs").arg("--extern").arg("bar").run(); rustc().input("foo.rs").arg("--extern").arg("bar").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp"); rfs::rename(dynamic_lib_name("bar"), "bar.tmp");
run("foo"); run("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar")); rfs::rename("bar.tmp", dynamic_lib_name("bar"));
rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).arg("--extern").arg("bar").run(); rustc().input("foo.rs").extern_("bar", rust_lib_name("bar")).arg("--extern").arg("bar").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp"); rfs::rename(dynamic_lib_name("bar"), "bar.tmp");
run("foo"); run("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar")); rfs::rename("bar.tmp", dynamic_lib_name("bar"));
// The first explicit usage of extern overrides the second pathless --extern bar. // The first explicit usage of extern overrides the second pathless --extern bar.
rustc() rustc()
@ -31,13 +31,13 @@ fn main() {
.arg("--extern") .arg("--extern")
.arg("bar") .arg("bar")
.run(); .run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp"); rfs::rename(dynamic_lib_name("bar"), "bar.tmp");
run_fail("foo"); run_fail("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar")); rfs::rename("bar.tmp", dynamic_lib_name("bar"));
// With prefer-dynamic, execution fails as it refuses to use the rlib. // With prefer-dynamic, execution fails as it refuses to use the rlib.
rustc().input("foo.rs").arg("--extern").arg("bar").arg("-Cprefer-dynamic").run(); rustc().input("foo.rs").arg("--extern").arg("bar").arg("-Cprefer-dynamic").run();
fs_wrapper::rename(dynamic_lib_name("bar"), "bar.tmp"); rfs::rename(dynamic_lib_name("bar"), "bar.tmp");
run_fail("foo"); run_fail("foo");
fs_wrapper::rename("bar.tmp", dynamic_lib_name("bar")); rfs::rename("bar.tmp", dynamic_lib_name("bar"));
} }

View File

@ -7,7 +7,7 @@
// See https://github.com/rust-lang/rust/pull/15686 // See https://github.com/rust-lang/rust/pull/15686
use run_make_support::{ use run_make_support::{
bin_name, cwd, fs_wrapper, has_prefix, has_suffix, rustc, shallow_find_files, bin_name, cwd, fs as rfs, has_prefix, has_suffix, rustc, shallow_find_files,
}; };
fn main() { fn main() {
@ -16,6 +16,6 @@ fn main() {
has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o") has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o")
}); });
let object_file = object_files.get(0).unwrap(); let object_file = object_files.get(0).unwrap();
fs_wrapper::remove_file(object_file); rfs::remove_file(object_file);
fs_wrapper::remove_file(bin_name("foobar")); rfs::remove_file(bin_name("foobar"));
} }

View File

@ -16,7 +16,7 @@
// If we used `rustc` the additional '-L rmake_out' option would allow rustc to // If we used `rustc` the additional '-L rmake_out' option would allow rustc to
// actually find the crate. // actually find the crate.
use run_make_support::{bare_rustc, fs_wrapper, rust_lib_name, rustc}; use run_make_support::{bare_rustc, fs as rfs, rust_lib_name, rustc};
fn main() { fn main() {
rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run(); rustc().crate_name("a").crate_type("rlib").input("a.rs").arg("--verbose").run();

View File

@ -24,11 +24,11 @@
// Reason: `set_readonly` has no effect on directories // Reason: `set_readonly` has no effect on directories
// and does not prevent modification. // and does not prevent modification.
use run_make_support::{fs_wrapper, rustc, test_while_readonly}; use run_make_support::{fs as rfs, rustc, test_while_readonly};
fn main() { fn main() {
// Create an inaccessible directory. // Create an inaccessible directory.
fs_wrapper::create_dir("inaccessible"); rfs::create_dir("inaccessible");
test_while_readonly("inaccessible", || { test_while_readonly("inaccessible", || {
// Run rustc with `-Z temps-dir` set to a directory *inside* the inaccessible one, // Run rustc with `-Z temps-dir` set to a directory *inside* the inaccessible one,
// so that it can't create `tmp`. // so that it can't create `tmp`.

View File

@ -13,14 +13,14 @@
//@ ignore-nvptx64-nvidia-cuda //@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for `std` // FIXME: can't find crate for `std`
use run_make_support::fs_wrapper as fs; use run_make_support::fs as rfs;
use run_make_support::rustc; use run_make_support::rustc;
fn main() { fn main() {
fs::create_dir("src"); rfs::create_dir("src");
fs::create_dir("incr"); rfs::create_dir("incr");
fs::copy("a.rs", "src/main.rs"); rfs::copy("a.rs", "src/main.rs");
rustc().incremental("incr").input("src/main.rs").run(); rustc().incremental("incr").input("src/main.rs").run();
fs::copy("b.rs", "src/main.rs"); rfs::copy("b.rs", "src/main.rs");
rustc().incremental("incr").input("src/main.rs").run(); rustc().incremental("incr").input("src/main.rs").run();
} }

View File

@ -14,14 +14,14 @@
//@ ignore-nvptx64-nvidia-cuda //@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for 'std' // FIXME: can't find crate for 'std'
use run_make_support::{fs_wrapper, rust_lib_name, rustc}; use run_make_support::{fs as rfs, rust_lib_name, rustc};
fn main() { fn main() {
fs_wrapper::create_dir("incr"); rfs::create_dir("incr");
fs_wrapper::create_dir("src"); rfs::create_dir("src");
fs_wrapper::create_dir("src/mydir"); rfs::create_dir("src/mydir");
fs_wrapper::copy("main.rs", "src/main.rs"); rfs::copy("main.rs", "src/main.rs");
rustc().input("src/main.rs").incremental("incr").arg("--test").run(); rustc().input("src/main.rs").incremental("incr").arg("--test").run();
fs_wrapper::rename("src/main.rs", "src/mydir/main.rs"); rfs::rename("src/main.rs", "src/mydir/main.rs");
rustc().input("src/mydir/main.rs").incremental("incr").arg("--test").run(); rustc().input("src/mydir/main.rs").incremental("incr").arg("--test").run();
} }

View File

@ -2,14 +2,14 @@
// (in this case, foo.py and foo.natvis) are picked up when compiling incrementally. // (in this case, foo.py and foo.natvis) are picked up when compiling incrementally.
// See https://github.com/rust-lang/rust/pull/111641 // See https://github.com/rust-lang/rust/pull/111641
use run_make_support::{fs_wrapper, invalid_utf8_contains, invalid_utf8_not_contains, rustc}; use run_make_support::{fs as rfs, invalid_utf8_contains, invalid_utf8_not_contains, rustc};
use std::io::Read; use std::io::Read;
fn main() { fn main() {
fs_wrapper::create_file("foo.py"); rfs::create_file("foo.py");
fs_wrapper::write("foo.py", "GDB script v1"); rfs::write("foo.py", "GDB script v1");
fs_wrapper::create_file("foo.natvis"); rfs::create_file("foo.natvis");
fs_wrapper::write("foo.natvis", "Natvis v1"); rfs::write("foo.natvis", "Natvis v1");
rustc() rustc()
.input("foo.rs") .input("foo.rs")
.crate_type("rlib") .crate_type("rlib")
@ -22,9 +22,9 @@ fn main() {
invalid_utf8_contains("libfoo.rmeta", "Natvis v1"); invalid_utf8_contains("libfoo.rmeta", "Natvis v1");
// Change only the GDB script and check that the change has been picked up // Change only the GDB script and check that the change has been picked up
fs_wrapper::remove_file("foo.py"); rfs::remove_file("foo.py");
fs_wrapper::create_file("foo.py"); rfs::create_file("foo.py");
fs_wrapper::write("foo.py", "GDB script v2"); rfs::write("foo.py", "GDB script v2");
rustc() rustc()
.input("foo.rs") .input("foo.rs")
.crate_type("rlib") .crate_type("rlib")
@ -38,9 +38,9 @@ fn main() {
invalid_utf8_contains("libfoo.rmeta", "Natvis v1"); invalid_utf8_contains("libfoo.rmeta", "Natvis v1");
// Now change the Natvis version and check that the change has been picked up // Now change the Natvis version and check that the change has been picked up
fs_wrapper::remove_file("foo.natvis"); rfs::remove_file("foo.natvis");
fs_wrapper::create_file("foo.natvis"); rfs::create_file("foo.natvis");
fs_wrapper::write("foo.natvis", "Natvis v2"); rfs::write("foo.natvis", "Natvis v2");
rustc() rustc()
.input("foo.rs") .input("foo.rs")
.crate_type("rlib") .crate_type("rlib")

View File

@ -4,10 +4,10 @@
// the ensuing compilation failure is not an ICE. // the ensuing compilation failure is not an ICE.
// See https://github.com/rust-lang/rust/pull/85698 // See https://github.com/rust-lang/rust/pull/85698
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::create_file("session"); rfs::create_file("session");
// rustc should fail to create the session directory here. // rustc should fail to create the session directory here.
let out = rustc().input("foo.rs").crate_type("rlib").incremental("session").run_fail(); let out = rustc().input("foo.rs").crate_type("rlib").incremental("session").run_fail();
out.assert_stderr_contains("could not create incremental compilation crate directory"); out.assert_stderr_contains("could not create incremental compilation crate directory");

View File

@ -1,6 +1,6 @@
use run_make_support::fs_wrapper::read_to_string; use run_make_support::fs as rfs;
use run_make_support::regex::Regex; use run_make_support::regex::Regex;
use run_make_support::{read_dir, rustc}; use run_make_support::rustc;
use std::ffi::OsStr; use std::ffi::OsStr;
@ -8,9 +8,9 @@ fn main() {
rustc().input("foo.rs").emit("llvm-ir").codegen_units(2).run(); rustc().input("foo.rs").emit("llvm-ir").codegen_units(2).run();
let re = Regex::new(r"\bcall\b").unwrap(); let re = Regex::new(r"\bcall\b").unwrap();
let mut nb_ll = 0; let mut nb_ll = 0;
read_dir(".", |path| { rfs::read_dir_entries(".", |path| {
if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) { if path.is_file() && path.extension().is_some_and(|ext| ext == OsStr::new("ll")) {
assert!(!re.is_match(&read_to_string(path))); assert!(!re.is_match(&rfs::read_to_string(path)));
nb_ll += 1; nb_ll += 1;
} }
}); });

View File

@ -8,13 +8,13 @@
//@ ignore-windows //@ ignore-windows
// Reason: Because of Windows exception handling, the code is not necessarily any shorter. // Reason: Because of Windows exception handling, the code is not necessarily any shorter.
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
rustc().opt().emit("asm").input("exit-ret.rs").run(); rustc().opt().emit("asm").input("exit-ret.rs").run();
rustc().opt().emit("asm").input("exit-unreachable.rs").run(); rustc().opt().emit("asm").input("exit-unreachable.rs").run();
assert!( assert!(
fs_wrapper::read_to_string("exit-unreachable.s").lines().count() rfs::read_to_string("exit-unreachable.s").lines().count()
< fs_wrapper::read_to_string("exit-ret.s").lines().count() < rfs::read_to_string("exit-ret.s").lines().count()
); );
} }

View File

@ -4,11 +4,11 @@
// one appearing in stderr in this scenario. // one appearing in stderr in this scenario.
// See https://github.com/rust-lang/rust/pull/12645 // See https://github.com/rust-lang/rust/pull/12645
use run_make_support::fs_wrapper::create_file; use run_make_support::fs as rfs;
use run_make_support::{llvm_ar, rustc}; use run_make_support::{llvm_ar, rustc};
fn main() { fn main() {
create_file("lib.rmeta"); rfs::create_file("lib.rmeta");
llvm_ar().obj_to_ar().output_input("libfoo-ffffffff-1.0.rlib", "lib.rmeta").run(); llvm_ar().obj_to_ar().output_input("libfoo-ffffffff-1.0.rlib", "lib.rmeta").run();
rustc().input("foo.rs").run_fail().assert_stderr_contains("found invalid metadata"); rustc().input("foo.rs").run_fail().assert_stderr_contains("found invalid metadata");
} }

View File

@ -4,10 +4,10 @@
// explains that the file exists, but that its metadata is incorrect. // explains that the file exists, but that its metadata is incorrect.
// See https://github.com/rust-lang/rust/pull/88368 // See https://github.com/rust-lang/rust/pull/88368
use run_make_support::{dynamic_lib_name, fs_wrapper, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::create_file(dynamic_lib_name("foo")); rfs::create_file(dynamic_lib_name("foo"));
rustc() rustc()
.crate_type("lib") .crate_type("lib")
.extern_("foo", dynamic_lib_name("foo")) .extern_("foo", dynamic_lib_name("foo"))

View File

@ -4,10 +4,10 @@
// an internal compiler error (ICE). // an internal compiler error (ICE).
// See https://github.com/rust-lang/rust/pull/28673 // See https://github.com/rust-lang/rust/pull/28673
use run_make_support::{fs_wrapper, rustc, static_lib_name}; use run_make_support::{fs as rfs, rustc, static_lib_name};
fn main() { fn main() {
fs_wrapper::create_file(static_lib_name("foo")); rfs::create_file(static_lib_name("foo"));
rustc() rustc()
.arg("-") .arg("-")
.crate_type("rlib") .crate_type("rlib")

View File

@ -3,7 +3,7 @@
#[cfg(unix)] #[cfg(unix)]
extern crate libc; extern crate libc;
use run_make_support::{aux_build, fs_wrapper}; use run_make_support::{aux_build, fs as rfs};
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::PermissionsExt; use std::os::unix::fs::PermissionsExt;
@ -20,7 +20,7 @@ fn main() {
} }
fn verify(path: &Path) { fn verify(path: &Path) {
let perm = fs_wrapper::metadata(path).permissions(); let perm = rfs::metadata(path).permissions();
assert!(!perm.readonly()); assert!(!perm.readonly());

View File

@ -6,12 +6,12 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::fs_wrapper; use run_make_support::fs as rfs;
use run_make_support::rustc; use run_make_support::rustc;
fn main() { fn main() {
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
rustc().arg("-Zls=root").input("foo").run(); rustc().arg("-Zls=root").input("foo").run();
fs_wrapper::create_file("bar"); rfs::create_file("bar");
rustc().arg("-Zls=root").input("bar").run(); rustc().arg("-Zls=root").input("bar").run();
} }

View File

@ -7,7 +7,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::fs_wrapper; use run_make_support::fs as rfs;
use run_make_support::{run, rust_lib_name, rustc, test_while_readonly}; use run_make_support::{run, rust_lib_name, rustc, test_while_readonly};
fn main() { fn main() {

View File

@ -4,12 +4,12 @@
// what should be done to fix the issue. // what should be done to fix the issue.
// See https://github.com/rust-lang/rust/issues/13266 // See https://github.com/rust-lang/rust/issues/13266
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::create_dir("a1"); rfs::create_dir("a1");
fs_wrapper::create_dir("a2"); rfs::create_dir("a2");
fs_wrapper::create_dir("a3"); rfs::create_dir("a3");
rustc().crate_type("rlib").out_dir("a1").input("crateA1.rs").run(); rustc().crate_type("rlib").out_dir("a1").input("crateA1.rs").run();
rustc().crate_type("rlib").library_search_path("a1").input("crateB.rs").run(); rustc().crate_type("rlib").library_search_path("a1").input("crateB.rs").run();
rustc().crate_type("rlib").out_dir("a2").input("crateA2.rs").run(); rustc().crate_type("rlib").out_dir("a2").input("crateA2.rs").run();

View File

@ -6,7 +6,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{dynamic_lib_name, fs_wrapper, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("rlib.rs").crate_type("rlib").crate_type("dylib").run(); rustc().input("rlib.rs").crate_type("rlib").crate_type("dylib").run();
@ -16,6 +16,6 @@ fn main() {
// librlib's dynamic version needs to be removed here to prevent prog.rs from fetching // librlib's dynamic version needs to be removed here to prevent prog.rs from fetching
// the wrong one. // the wrong one.
fs_wrapper::remove_file(dynamic_lib_name("rlib")); rfs::remove_file(dynamic_lib_name("rlib"));
rustc().input("prog.rs").run_fail(); rustc().input("prog.rs").run_fail();
} }

View File

@ -17,20 +17,20 @@
//@ ignore-nvptx64-nvidia-cuda //@ ignore-nvptx64-nvidia-cuda
// FIXME: can't find crate for 'std' // FIXME: can't find crate for 'std'
use run_make_support::{fs_wrapper, rust_lib_name, rustc}; use run_make_support::{fs as rfs, rust_lib_name, rustc};
fn main() { fn main() {
fs_wrapper::create_dir("incr"); rfs::create_dir("incr");
fs_wrapper::create_dir("first_src"); rfs::create_dir("first_src");
fs_wrapper::create_dir("output"); rfs::create_dir("output");
fs_wrapper::rename("my_lib.rs", "first_src/my_lib.rs"); rfs::rename("my_lib.rs", "first_src/my_lib.rs");
fs_wrapper::rename("main.rs", "first_src/main.rs"); rfs::rename("main.rs", "first_src/main.rs");
// Build from "first_src" // Build from "first_src"
std::env::set_current_dir("first_src").unwrap(); std::env::set_current_dir("first_src").unwrap();
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run(); rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();
rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run(); rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run();
std::env::set_current_dir("..").unwrap(); std::env::set_current_dir("..").unwrap();
fs_wrapper::rename("first_src", "second_src"); rfs::rename("first_src", "second_src");
std::env::set_current_dir("second_src").unwrap(); std::env::set_current_dir("second_src").unwrap();
// Build from "second_src" - the output and incremental directory remain identical // Build from "second_src" - the output and incremental directory remain identical
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run(); rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();

View File

@ -1,4 +1,4 @@
use run_make_support::fs_wrapper; use run_make_support::fs as rfs;
use run_make_support::rustc; use run_make_support::rustc;
fn main() { fn main() {
@ -7,6 +7,6 @@ fn main() {
#[cfg(windows)] #[cfg(windows)]
let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]); let non_unicode: std::ffi::OsString = std::os::windows::ffi::OsStringExt::from_wide(&[0xD800]);
let output = rustc().input("non_unicode_env.rs").env("NON_UNICODE_VAR", non_unicode).run_fail(); let output = rustc().input("non_unicode_env.rs").env("NON_UNICODE_VAR", non_unicode).run_fail();
let expected = fs_wrapper::read_to_string("non_unicode_env.stderr"); let expected = rfs::read_to_string("non_unicode_env.stderr");
output.assert_stderr_equals(expected); output.assert_stderr_equals(expected);
} }

View File

@ -1,4 +1,4 @@
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
#[cfg(unix)] #[cfg(unix)]
@ -17,8 +17,8 @@ fn main() {
} }
let incr_dir = "incr-dir"; let incr_dir = "incr-dir";
rustc().input("foo.rs").incremental(&incr_dir).run(); rustc().input("foo.rs").incremental(&incr_dir).run();
for crate_dir in fs_wrapper::read_dir(&incr_dir) { for crate_dir in rfs::read_dir(&incr_dir) {
fs_wrapper::create_dir(crate_dir.unwrap().path().join(&non_unicode)); rfs::create_dir(crate_dir.unwrap().path().join(&non_unicode));
} }
rustc().input("foo.rs").incremental(&incr_dir).run(); rustc().input("foo.rs").incremental(&incr_dir).run();
} }

View File

@ -6,7 +6,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{ use run_make_support::{
cwd, dynamic_lib_name, fs_wrapper, has_extension, rust_lib_name, rustc, shallow_find_files, cwd, dynamic_lib_name, fs as rfs, has_extension, rust_lib_name, rustc, shallow_find_files,
}; };
use std::path::Path; use std::path::Path;
@ -15,7 +15,7 @@ fn main() {
assert!(Path::new(&dynamic_lib_name("test")).exists()); assert!(Path::new(&dynamic_lib_name("test")).exists());
assert!(Path::new(&rust_lib_name("test")).exists()); assert!(Path::new(&rust_lib_name("test")).exists());
fs_wrapper::remove_file(rust_lib_name("test")); rfs::remove_file(rust_lib_name("test"));
rustc().crate_type("dylib").input("test.rs").run(); rustc().crate_type("dylib").input("test.rs").run();
assert!(shallow_find_files(cwd(), |path| { has_extension(path, "rlib") }).is_empty()); assert!(shallow_find_files(cwd(), |path| { has_extension(path, "rlib") }).is_empty());
} }

View File

@ -4,10 +4,10 @@
// potentially-confusing linker error. // potentially-confusing linker error.
// See https://github.com/rust-lang/rust/pull/47203 // See https://github.com/rust-lang/rust/pull/47203
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::create_dir("foo"); rfs::create_dir("foo");
rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains( rustc().input("foo.rs").output("foo").run_fail().assert_stderr_contains(
r#"the generated executable for the input file "foo.rs" conflicts with the existing directory "foo""#, r#"the generated executable for the input file "foo.rs" conflicts with the existing directory "foo""#,
); );

View File

@ -4,14 +4,14 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
fs_wrapper::copy("foo.rs", "foo"); rfs::copy("foo.rs", "foo");
rustc().input("foo").output("foo").run_fail().assert_stderr_contains( rustc().input("foo").output("foo").run_fail().assert_stderr_contains(
r#"the input file "foo" would be overwritten by the generated executable"#, r#"the input file "foo" would be overwritten by the generated executable"#,
); );
fs_wrapper::copy("bar.rs", "bar.rlib"); rfs::copy("bar.rs", "bar.rlib");
rustc().input("bar.rlib").output("bar.rlib").run_fail().assert_stderr_contains( rustc().input("bar.rlib").output("bar.rlib").run_fail().assert_stderr_contains(
r#"the input file "bar.rlib" would be overwritten by the generated executable"#, r#"the input file "bar.rlib" would be overwritten by the generated executable"#,
); );

View File

@ -5,7 +5,7 @@
// See https://github.com/rust-lang/rust/pull/12020 // See https://github.com/rust-lang/rust/pull/12020
use run_make_support::{ use run_make_support::{
bin_name, dynamic_lib_name, filename_not_in_denylist, fs_wrapper, rust_lib_name, rustc, bin_name, dynamic_lib_name, filename_not_in_denylist, fs as rfs, rust_lib_name, rustc,
shallow_find_files, static_lib_name, shallow_find_files, static_lib_name,
}; };
use std::path::PathBuf; use std::path::PathBuf;
@ -20,10 +20,10 @@ fn assert_expected_output_files(expectations: Expectations, rustc_invocation: im
let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } = let Expectations { expected_files: must_exist, allowed_files: can_exist, test_dir: dir } =
expectations; expectations;
fs_wrapper::create_dir(&dir); rfs::create_dir(&dir);
rustc_invocation(); rustc_invocation();
for file in must_exist { for file in must_exist {
fs_wrapper::remove_file(PathBuf::from(&dir).join(&file)); rfs::remove_file(PathBuf::from(&dir).join(&file));
} }
let actual_output_files = let actual_output_files =
shallow_find_files(dir, |path| filename_not_in_denylist(path, &can_exist)); shallow_find_files(dir, |path| filename_not_in_denylist(path, &can_exist));
@ -526,17 +526,14 @@ fn main() {
test_dir: "rlib-emits".to_string(), test_dir: "rlib-emits".to_string(),
}, },
|| { || {
fs_wrapper::rename("staticlib-all3/bar.bc", "rlib-emits/foo.bc"); rfs::rename("staticlib-all3/bar.bc", "rlib-emits/foo.bc");
rustc() rustc()
.input("foo.rs") .input("foo.rs")
.emit("llvm-bc,link") .emit("llvm-bc,link")
.crate_type("rlib") .crate_type("rlib")
.out_dir("rlib-emits") .out_dir("rlib-emits")
.run(); .run();
assert_eq!( assert_eq!(rfs::read("rlib-emits/foo.bc"), rfs::read("rlib-emits/bar.bc"));
fs_wrapper::read("rlib-emits/foo.bc"),
fs_wrapper::read("rlib-emits/bar.bc")
);
}, },
); );
} }

View File

@ -5,12 +5,12 @@
// conflicts. This test uses this flag and checks for successful compilation. // conflicts. This test uses this flag and checks for successful compilation.
// See https://github.com/rust-lang/rust/pull/83846 // See https://github.com/rust-lang/rust/pull/83846
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
use std::sync::{Arc, Barrier}; use std::sync::{Arc, Barrier};
use std::thread; use std::thread;
fn main() { fn main() {
fs_wrapper::create_file("lib.rs"); rfs::create_file("lib.rs");
let barrier = Arc::new(Barrier::new(2)); let barrier = Arc::new(Barrier::new(2));
let handle = { let handle = {
let barrier = Arc::clone(&barrier); let barrier = Arc::clone(&barrier);

View File

@ -10,14 +10,14 @@
//@ needs-profiler-support //@ needs-profiler-support
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{fs_wrapper, llvm_filecheck, llvm_profdata, run_with_args, rustc}; use run_make_support::{fs as rfs, llvm_filecheck, llvm_profdata, run_with_args, rustc};
use std::path::Path; use std::path::Path;
fn main() { fn main() {
let path_prof_data_dir = Path::new("prof_data_dir"); let path_prof_data_dir = Path::new("prof_data_dir");
let path_merged_profdata = path_prof_data_dir.join("merged.profdata"); let path_merged_profdata = path_prof_data_dir.join("merged.profdata");
rustc().input("opaque.rs").run(); rustc().input("opaque.rs").run();
fs_wrapper::create_dir_all(&path_prof_data_dir); rfs::create_dir_all(&path_prof_data_dir);
rustc() rustc()
.input("interesting.rs") .input("interesting.rs")
.profile_generate(&path_prof_data_dir) .profile_generate(&path_prof_data_dir)
@ -34,8 +34,5 @@ fn main() {
.codegen_units(1) .codegen_units(1)
.emit("llvm-ir") .emit("llvm-ir")
.run(); .run();
llvm_filecheck() llvm_filecheck().patterns("filecheck-patterns.txt").stdin(rfs::read("interesting.ll")).run();
.patterns("filecheck-patterns.txt")
.stdin(fs_wrapper::read("interesting.ll"))
.run();
} }

View File

@ -9,8 +9,8 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{ use run_make_support::{
cwd, fs_wrapper, has_extension, has_prefix, llvm_filecheck, llvm_profdata, run_with_args, cwd, fs as rfs, has_extension, has_prefix, llvm_filecheck, llvm_profdata, run_with_args, rustc,
rustc, shallow_find_files, shallow_find_files,
}; };
fn main() { fn main() {
@ -47,7 +47,7 @@ fn main() {
// line with the function name before the line with the function attributes. // line with the function name before the line with the function attributes.
// FileCheck only supports checking that something matches on the next line, // FileCheck only supports checking that something matches on the next line,
// but not if something matches on the previous line. // but not if something matches on the previous line.
let ir = fs_wrapper::read_to_string("main.ll"); let ir = rfs::read_to_string("main.ll");
let lines: Vec<_> = ir.lines().rev().collect(); let lines: Vec<_> = ir.lines().rev().collect();
let mut reversed_ir = lines.join("\n"); let mut reversed_ir = lines.join("\n");
reversed_ir.push('\n'); reversed_ir.push('\n');

View File

@ -1,6 +1,6 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{cwd, dynamic_lib_name, fs_wrapper, read_dir, run, run_fail, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, run, run_fail, rustc};
fn main() { fn main() {
rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").arg("-Cprefer-dynamic").run(); rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").arg("-Cprefer-dynamic").run();
@ -8,7 +8,7 @@ fn main() {
run("foo"); run("foo");
fs_wrapper::remove_file(dynamic_lib_name("bar")); rfs::remove_file(dynamic_lib_name("bar"));
// This time the command should fail. // This time the command should fail.
run_fail("foo"); run_fail("foo");
} }

View File

@ -3,13 +3,13 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{dynamic_lib_name, fs_wrapper, path, run, rust_lib_name, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, path, run, rust_lib_name, rustc};
fn main() { fn main() {
rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").run(); rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").run();
assert!(path(rust_lib_name("bar")).exists()); assert!(path(rust_lib_name("bar")).exists());
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
fs_wrapper::remove_file(rust_lib_name("bar")); rfs::remove_file(rust_lib_name("bar"));
fs_wrapper::remove_file(dynamic_lib_name("bar")); rfs::remove_file(dynamic_lib_name("bar"));
run("foo"); run("foo");
} }

View File

@ -5,13 +5,13 @@
// does not get an unexpected dep-info file. // does not get an unexpected dep-info file.
// See https://github.com/rust-lang/rust/issues/112898 // See https://github.com/rust-lang/rust/issues/112898
use run_make_support::{fs_wrapper, invalid_utf8_contains, rustc}; use run_make_support::{fs as rfs, invalid_utf8_contains, rustc};
use std::path::Path; use std::path::Path;
fn main() { fn main() {
rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run(); rustc().emit("dep-info").arg("-Zunpretty=expanded").input("with-dep.rs").run();
invalid_utf8_contains("with-dep.d", "with-dep.rs"); invalid_utf8_contains("with-dep.d", "with-dep.rs");
fs_wrapper::remove_file("with-dep.d"); rfs::remove_file("with-dep.d");
rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run(); rustc().emit("dep-info").arg("-Zunpretty=normal").input("with-dep.rs").run();
assert!(!Path::new("with-dep.d").exists()); assert!(!Path::new("with-dep.d").exists());
} }

View File

@ -10,7 +10,7 @@ use std::ffi::OsString;
use std::iter::FromIterator; use std::iter::FromIterator;
use std::path::PathBuf; use std::path::PathBuf;
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
struct PrintCfg { struct PrintCfg {
target: &'static str, target: &'static str,
@ -96,7 +96,7 @@ fn check(PrintCfg { target, includes, disallow }: PrintCfg) {
rustc().target(target).arg(print_arg).run(); rustc().target(target).arg(print_arg).run();
let output = fs_wrapper::read_to_string(&tmp_path); let output = rfs::read_to_string(&tmp_path);
check_(&output, includes, disallow); check_(&output, includes, disallow);
} }

View File

@ -4,7 +4,7 @@
use std::ffi::OsString; use std::ffi::OsString;
use std::path::PathBuf; use std::path::PathBuf;
use run_make_support::{fs_wrapper, rustc, target}; use run_make_support::{fs as rfs, rustc, target};
struct Option<'a> { struct Option<'a> {
target: &'a str, target: &'a str,
@ -49,7 +49,7 @@ fn check(args: Option) {
rustc().target(args.target).arg(print_arg).run(); rustc().target(args.target).arg(print_arg).run();
fs_wrapper::read_to_string(&tmp_path) rfs::read_to_string(&tmp_path)
}; };
check_(&stdout, args.includes); check_(&stdout, args.includes);

View File

@ -4,7 +4,7 @@
// See https://github.com/rust-lang/rust/pull/85344 // See https://github.com/rust-lang/rust/pull/85344
use run_make_support::bstr::ByteSlice; use run_make_support::bstr::ByteSlice;
use run_make_support::{bstr, fs_wrapper, is_darwin, rustc}; use run_make_support::{bstr, fs as rfs, is_darwin, rustc};
fn main() { fn main() {
let mut out_simple = rustc(); let mut out_simple = rustc();
@ -60,12 +60,9 @@ fn main() {
// helper functions. // helper functions.
fn rmeta_contains(expected: &str) { fn rmeta_contains(expected: &str) {
// Normalize to account for path differences in Windows. // Normalize to account for path differences in Windows.
if !bstr::BString::from(fs_wrapper::read("liblib.rmeta")) if !bstr::BString::from(rfs::read("liblib.rmeta")).replace(b"\\", b"/").contains_str(expected) {
.replace(b"\\", b"/")
.contains_str(expected)
{
eprintln!("=== FILE CONTENTS (LOSSY) ==="); eprintln!("=== FILE CONTENTS (LOSSY) ===");
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta"))); eprintln!("{}", String::from_utf8_lossy(&rfs::read("liblib.rmeta")));
eprintln!("=== SPECIFIED TEXT ==="); eprintln!("=== SPECIFIED TEXT ===");
eprintln!("{}", expected); eprintln!("{}", expected);
panic!("specified text was not found in file"); panic!("specified text was not found in file");
@ -74,12 +71,9 @@ fn rmeta_contains(expected: &str) {
fn rmeta_not_contains(expected: &str) { fn rmeta_not_contains(expected: &str) {
// Normalize to account for path differences in Windows. // Normalize to account for path differences in Windows.
if bstr::BString::from(fs_wrapper::read("liblib.rmeta")) if bstr::BString::from(rfs::read("liblib.rmeta")).replace(b"\\", b"/").contains_str(expected) {
.replace(b"\\", b"/")
.contains_str(expected)
{
eprintln!("=== FILE CONTENTS (LOSSY) ==="); eprintln!("=== FILE CONTENTS (LOSSY) ===");
eprintln!("{}", String::from_utf8_lossy(&fs_wrapper::read("liblib.rmeta"))); eprintln!("{}", String::from_utf8_lossy(&rfs::read("liblib.rmeta")));
eprintln!("=== SPECIFIED TEXT ==="); eprintln!("=== SPECIFIED TEXT ===");
eprintln!("{}", expected); eprintln!("{}", expected);
panic!("specified text was not found in file"); panic!("specified text was not found in file");

View File

@ -3,7 +3,7 @@
use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian}; use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian};
use object::{Object, ObjectSection}; use object::{Object, ObjectSection};
use run_make_support::{fs_wrapper, gimli, object, rustc}; use run_make_support::{fs as rfs, gimli, object, rustc};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::PathBuf; use std::path::PathBuf;
use std::rc::Rc; use std::rc::Rc;
@ -19,7 +19,7 @@ fn main() {
.join("DWARF") .join("DWARF")
.join("repr128"); .join("repr128");
let output = let output =
fs_wrapper::read(if dsym_location.try_exists().unwrap() { dsym_location } else { output }); rfs::read(if dsym_location.try_exists().unwrap() { dsym_location } else { output });
let obj = object::File::parse(output.as_slice()).unwrap(); let obj = object::File::parse(output.as_slice()).unwrap();
let endian = if obj.is_little_endian() { RunTimeEndian::Little } else { RunTimeEndian::Big }; let endian = if obj.is_little_endian() { RunTimeEndian::Little } else { RunTimeEndian::Big };
let dwarf = gimli::Dwarf::load(|section| -> Result<_, ()> { let dwarf = gimli::Dwarf::load(|section| -> Result<_, ()> {

View File

@ -7,7 +7,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::{bin_name, fs_wrapper, rustc}; use run_make_support::{bin_name, fs as rfs, rustc};
use std::path::Path; use std::path::Path;
fn compile(output_file: &str, emit: Option<&str>) { fn compile(output_file: &str, emit: Option<&str>) {

View File

@ -5,12 +5,12 @@
// the renamed library. // the renamed library.
// See https://github.com/rust-lang/rust/pull/49253 // See https://github.com/rust-lang/rust/pull/49253
use run_make_support::fs_wrapper; use run_make_support::fs as rfs;
use run_make_support::rustc; use run_make_support::rustc;
fn main() { fn main() {
rustc().extra_filename("-hash").input("foo.rs").run(); rustc().extra_filename("-hash").input("foo.rs").run();
rustc().input("bar.rs").run(); rustc().input("bar.rs").run();
fs_wrapper::rename("libfoo-hash.rlib", "libfoo-another-hash.rlib"); rfs::rename("libfoo-hash.rlib", "libfoo-another-hash.rlib");
rustc().input("baz.rs").run(); rustc().input("baz.rs").run();
} }

View File

@ -8,7 +8,7 @@
//@ ignore-cross-compile //@ ignore-cross-compile
// Reason: the compiled binary is executed // Reason: the compiled binary is executed
use run_make_support::{fs_wrapper, run, rust_lib_name, rustc}; use run_make_support::{fs as rfs, run, rust_lib_name, rustc};
fn main() { fn main() {
rustc().input("m1.rs").run(); rustc().input("m1.rs").run();
@ -16,8 +16,8 @@ fn main() {
rustc().input("m3.rs").run(); rustc().input("m3.rs").run();
rustc().input("m4.rs").run(); rustc().input("m4.rs").run();
run("m4"); run("m4");
fs_wrapper::remove_file(rust_lib_name("m1")); rfs::remove_file(rust_lib_name("m1"));
fs_wrapper::remove_file(rust_lib_name("m2")); rfs::remove_file(rust_lib_name("m2"));
fs_wrapper::remove_file(rust_lib_name("m3")); rfs::remove_file(rust_lib_name("m3"));
run("m4"); run("m4");
} }

View File

@ -1,10 +1,10 @@
use run_make_support::{fs_wrapper, htmldocck, rustc, rustdoc, source_root}; use run_make_support::{fs as rfs, htmldocck, rustc, rustdoc, source_root};
use std::path::Path; use std::path::Path;
pub fn scrape(extra_args: &[&str]) { pub fn scrape(extra_args: &[&str]) {
let out_dir = Path::new("rustdoc"); let out_dir = Path::new("rustdoc");
let crate_name = "foobar"; let crate_name = "foobar";
let deps = fs_wrapper::read_dir("examples") let deps = rfs::read_dir("examples")
.filter_map(|entry| entry.ok().map(|e| e.path())) .filter_map(|entry| entry.ok().map(|e| e.path()))
.filter(|path| path.is_file() && path.extension().is_some_and(|ext| ext == "rs")) .filter(|path| path.is_file() && path.extension().is_some_and(|ext| ext == "rs"))
.collect::<Vec<_>>(); .collect::<Vec<_>>();

View File

@ -1,10 +1,10 @@
use run_make_support::{fs_wrapper, rustdoc}; use run_make_support::{fs as rfs, rustdoc};
use std::iter; use std::iter;
use std::path::Path; use std::path::Path;
fn generate_a_lot_of_cfgs(path: &Path) { fn generate_a_lot_of_cfgs(path: &Path) {
let content = iter::repeat("--cfg=a\n").take(100_000).collect::<String>(); let content = iter::repeat("--cfg=a\n").take(100_000).collect::<String>();
fs_wrapper::write(path, content.as_bytes()); rfs::write(path, content.as_bytes());
} }
fn main() { fn main() {

View File

@ -1,15 +1,14 @@
// Test that rustdoc will properly load in a theme file and display it in the theme selector. // Test that rustdoc will properly load in a theme file and display it in the theme selector.
use run_make_support::{fs_wrapper, htmldocck, rustdoc, source_root}; use run_make_support::{fs as rfs, htmldocck, rustdoc, source_root};
use std::path::Path; use std::path::Path;
fn main() { fn main() {
let out_dir = Path::new("rustdoc-themes"); let out_dir = Path::new("rustdoc-themes");
let test_css = "test.css"; let test_css = "test.css";
let no_script = fs_wrapper::read_to_string( let no_script =
source_root().join("src/librustdoc/html/static/css/noscript.css"), rfs::read_to_string(source_root().join("src/librustdoc/html/static/css/noscript.css"));
);
let mut test_content = String::new(); let mut test_content = String::new();
let mut found_begin_light = false; let mut found_begin_light = false;
@ -24,8 +23,8 @@ fn main() {
} }
} }
assert!(!test_content.is_empty()); assert!(!test_content.is_empty());
fs_wrapper::create_dir_all(&out_dir); rfs::create_dir_all(&out_dir);
fs_wrapper::write(&test_css, test_content); rfs::write(&test_css, test_content);
rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run(); rustdoc().output(&out_dir).input("foo.rs").arg("--theme").arg(&test_css).run();
htmldocck().arg(out_dir).arg("foo.rs").run(); htmldocck().arg(out_dir).arg("foo.rs").run();

View File

@ -1,7 +1,7 @@
use run_make_support::fs_wrapper::copy; use run_make_support::fs as rfs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use run_make_support::{assert_recursive_eq, copy_dir_all, rustdoc}; use run_make_support::{assert_recursive_eq, rustdoc};
#[derive(PartialEq)] #[derive(PartialEq)]
enum JsonOutput { enum JsonOutput {
@ -26,7 +26,7 @@ fn main() {
generate_docs(&out_dir, JsonOutput::No); generate_docs(&out_dir, JsonOutput::No);
// Copy first output for to check if it's exactly same after second compilation. // Copy first output for to check if it's exactly same after second compilation.
copy_dir_all(&out_dir, &tmp_out_dir); rfs::copy_dir_all(&out_dir, &tmp_out_dir);
// Generate html docs once again on same output. // Generate html docs once again on same output.
generate_docs(&out_dir, JsonOutput::No); generate_docs(&out_dir, JsonOutput::No);
@ -38,7 +38,7 @@ fn main() {
assert!(out_dir.join("foobar.json").is_file()); assert!(out_dir.join("foobar.json").is_file());
// Copy first json output to check if it's exactly same after second compilation. // Copy first json output to check if it's exactly same after second compilation.
copy(out_dir.join("foobar.json"), tmp_out_dir.join("foobar.json")); rfs::copy(out_dir.join("foobar.json"), tmp_out_dir.join("foobar.json"));
// Generate json doc on the same output. // Generate json doc on the same output.
generate_docs(&out_dir, JsonOutput::Yes); generate_docs(&out_dir, JsonOutput::Yes);

View File

@ -5,7 +5,7 @@
// See https://github.com/rust-lang/rust/pull/16367 // See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{ use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, count_regex_matches_in_files_with_extension, cwd, fs as rfs, has_extension, regex, rustc,
shallow_find_files, shallow_find_files,
}; };

View File

@ -6,7 +6,7 @@
// See https://github.com/rust-lang/rust/pull/16367 // See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{ use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, count_regex_matches_in_files_with_extension, cwd, fs as rfs, has_extension, regex, rustc,
shallow_find_files, shallow_find_files,
}; };

View File

@ -4,7 +4,7 @@
// See https://github.com/rust-lang/rust/pull/16367 // See https://github.com/rust-lang/rust/pull/16367
use run_make_support::{ use run_make_support::{
count_regex_matches_in_files_with_extension, cwd, fs_wrapper, has_extension, regex, rustc, count_regex_matches_in_files_with_extension, cwd, fs as rfs, has_extension, regex, rustc,
shallow_find_files, shallow_find_files,
}; };

View File

@ -11,13 +11,13 @@
//@ ignore-windows //@ ignore-windows
// Reason: Windows refuses files with < and > in their names // Reason: Windows refuses files with < and > in their names
use run_make_support::{diff, fs_wrapper, run, rustc}; use run_make_support::{diff, fs as rfs, run, rustc};
fn main() { fn main() {
fs_wrapper::create_file("<leading-lt"); rfs::create_file("<leading-lt");
fs_wrapper::write("<leading-lt", r#""comes from a file with a name that begins with <""#); rfs::write("<leading-lt", r#""comes from a file with a name that begins with <""#);
fs_wrapper::create_file("trailing-gt>"); rfs::create_file("trailing-gt>");
fs_wrapper::write("trailing-gt>", r#""comes from a file with a name that ends with >""#); rfs::write("trailing-gt>", r#""comes from a file with a name that ends with >""#);
rustc().input("silly-file-names.rs").output("silly-file-names").run(); rustc().input("silly-file-names.rs").output("silly-file-names").run();
let out = run("silly-file-names").stdout_utf8(); let out = run("silly-file-names").stdout_utf8();
diff().expected_file("silly-file-names.run.stdout").actual_text("actual-stdout", out).run(); diff().expected_file("silly-file-names.run.stdout").actual_text("actual-stdout", out).run();

View File

@ -11,12 +11,12 @@
//@ ignore-cross-compile //@ ignore-cross-compile
//@ needs-symlink //@ needs-symlink
use run_make_support::{create_symlink, cwd, fs_wrapper, rustc}; use run_make_support::{cwd, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").run(); rustc().input("foo.rs").run();
fs_wrapper::create_dir_all("other"); rfs::create_dir_all("other");
create_symlink("libfoo.rlib", "other"); rfs::create_symlink("libfoo.rlib", "other");
rustc().input("bar.rs").library_search_path(cwd()).run(); rustc().input("bar.rs").library_search_path(cwd()).run();
rustc().input("baz.rs").extern_("foo", "other").library_search_path(cwd()).run(); rustc().input("baz.rs").extern_("foo", "other").library_search_path(cwd()).run();
} }

View File

@ -8,11 +8,11 @@
//@ ignore-cross-compile //@ ignore-cross-compile
//@ needs-symlink //@ needs-symlink
use run_make_support::{create_symlink, dynamic_lib_name, fs_wrapper, rustc}; use run_make_support::{dynamic_lib_name, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").arg("-Cprefer-dynamic").run(); rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
fs_wrapper::create_dir_all("other"); rfs::create_dir_all("other");
create_symlink(dynamic_lib_name("foo"), "other"); rfs::create_symlink(dynamic_lib_name("foo"), "other");
rustc().input("bar.rs").library_search_path("other").run(); rustc().input("bar.rs").library_search_path("other").run();
} }

View File

@ -8,10 +8,10 @@
//@ ignore-cross-compile //@ ignore-cross-compile
//@ needs-symlink //@ needs-symlink
use run_make_support::{create_symlink, cwd, rustc}; use run_make_support::{cwd, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").crate_type("rlib").output("foo.xxx").run(); rustc().input("foo.rs").crate_type("rlib").output("foo.xxx").run();
create_symlink("foo.xxx", "libfoo.rlib"); rfs::create_symlink("foo.xxx", "libfoo.rlib");
rustc().input("bar.rs").library_search_path(cwd()).run(); rustc().input("bar.rs").library_search_path(cwd()).run();
} }

View File

@ -5,11 +5,11 @@
// using them correctly, or fails with the right error message when using them improperly. // using them correctly, or fails with the right error message when using them improperly.
// See https://github.com/rust-lang/rust/pull/16156 // See https://github.com/rust-lang/rust/pull/16156
use run_make_support::{diff, fs_wrapper, rustc}; use run_make_support::{diff, fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").target("my-awesome-platform.json").crate_type("lib").emit("asm").run(); rustc().input("foo.rs").target("my-awesome-platform.json").crate_type("lib").emit("asm").run();
assert!(!fs_wrapper::read_to_string("foo.s").contains("morestack")); assert!(!rfs::read_to_string("foo.s").contains("morestack"));
rustc() rustc()
.input("foo.rs") .input("foo.rs")
.target("my-invalid-platform.json") .target("my-invalid-platform.json")
@ -40,8 +40,8 @@ fn main() {
.print("target-spec-json") .print("target-spec-json")
.run() .run()
.stdout_utf8(); .stdout_utf8();
fs_wrapper::create_file("test-platform.json"); rfs::create_file("test-platform.json");
fs_wrapper::write("test-platform.json", test_platform.as_bytes()); rfs::write("test-platform.json", test_platform.as_bytes());
let test_platform_2 = rustc() let test_platform_2 = rustc()
.arg("-Zunstable-options") .arg("-Zunstable-options")
.target("test-platform.json") .target("test-platform.json")

View File

@ -4,10 +4,10 @@
// output successfully added the file as a dependency. // output successfully added the file as a dependency.
// See https://github.com/rust-lang/rust/pull/84029 // See https://github.com/rust-lang/rust/pull/84029
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
rustc().input("macro_def.rs").run(); rustc().input("macro_def.rs").run();
rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run(); rustc().env("EXISTING_PROC_MACRO_ENV", "1").emit("dep-info").input("macro_use.rs").run();
assert!(fs_wrapper::read_to_string("macro_use.d").contains("emojis.txt:")); assert!(rfs::read_to_string("macro_use.d").contains("emojis.txt:"));
} }

View File

@ -8,7 +8,7 @@
// Reason: the binary is executed // Reason: the binary is executed
//@ needs-profiler-support //@ needs-profiler-support
use run_make_support::{fs_wrapper, llvm_profdata, run, rustc}; use run_make_support::{fs as rfs, llvm_profdata, run, rustc};
fn main() { fn main() {
// Generate the profile-guided-optimization (PGO) profiles // Generate the profile-guided-optimization (PGO) profiles
@ -19,5 +19,5 @@ fn main() {
// Use the profiles in compilation // Use the profiles in compilation
rustc().profile_use("merged.profdata").emit("dep-info").input("main.rs").run(); rustc().profile_use("merged.profdata").emit("dep-info").input("main.rs").run();
// Check that the profile file is in the dep-info emit file // Check that the profile file is in the dep-info emit file
assert!(fs_wrapper::read_to_string("main.d").contains("merged.profdata")); assert!(rfs::read_to_string("main.d").contains("merged.profdata"));
} }

View File

@ -1,6 +1,6 @@
//@ ignore-cross-compile //@ ignore-cross-compile
use run_make_support::fs_wrapper::read; use run_make_support::fs as rfs;
use run_make_support::{assert_contains, run, rustc}; use run_make_support::{assert_contains, run, rustc};
fn main() { fn main() {
@ -11,7 +11,7 @@ fn main() {
// ... and the loads/stores must not be optimized out. // ... and the loads/stores must not be optimized out.
rustc().input("main.rs").emit("llvm-ir").run(); rustc().input("main.rs").emit("llvm-ir").run();
let raw_llvm_ir = read("main.ll"); let raw_llvm_ir = rfs::read("main.ll");
let llvm_ir = String::from_utf8_lossy(&raw_llvm_ir); let llvm_ir = String::from_utf8_lossy(&raw_llvm_ir);
assert_contains(&llvm_ir, "load volatile"); assert_contains(&llvm_ir, "load volatile");
assert_contains(&llvm_ir, "store volatile"); assert_contains(&llvm_ir, "store volatile");

View File

@ -1,13 +1,13 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::HashMap; use std::collections::HashMap;
fn main() { fn main() {
rustc().input("foo.rs").target("wasm32-wasip1").run(); rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run(); rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
let file = fs_wrapper::read("bar.wasm"); let file = rfs::read("bar.wasm");
let mut custom = HashMap::new(); let mut custom = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
@ -12,7 +12,7 @@ fn main() {
fn verify(path: &Path) { fn verify(path: &Path) {
eprintln!("verify {path:?}"); eprintln!("verify {path:?}");
let file = fs_wrapper::read(&path); let file = rfs::read(&path);
let mut custom = HashMap::new(); let mut custom = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::HashMap; use std::collections::HashMap;
use std::path::Path; use std::path::Path;
use wasmparser::ExternalKind::*; use wasmparser::ExternalKind::*;
@ -33,7 +33,7 @@ fn test(args: &[&str]) {
fn verify_exports(path: &Path, exports: &[(&str, wasmparser::ExternalKind)]) { fn verify_exports(path: &Path, exports: &[(&str, wasmparser::ExternalKind)]) {
println!("verify {path:?}"); println!("verify {path:?}");
let file = fs_wrapper::read(path); let file = rfs::read(path);
let mut wasm_exports = HashMap::new(); let mut wasm_exports = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {
let payload = payload.unwrap(); let payload = payload.unwrap();

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::HashMap; use std::collections::HashMap;
use wasmparser::TypeRef::Func; use wasmparser::TypeRef::Func;
@ -8,7 +8,7 @@ fn main() {
rustc().input("foo.rs").target("wasm32-wasip1").run(); rustc().input("foo.rs").target("wasm32-wasip1").run();
rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run(); rustc().input("bar.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
let file = fs_wrapper::read("bar.wasm"); let file = rfs::read("bar.wasm");
let mut imports = HashMap::new(); let mut imports = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {

View File

@ -1,7 +1,7 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
#![deny(warnings)] #![deny(warnings)]
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
test("a"); test("a");
@ -15,7 +15,7 @@ fn test(cfg: &str) {
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().cfg(cfg).run(); rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().cfg(cfg).run();
let bytes = fs_wrapper::read("foo.wasm"); let bytes = rfs::read("foo.wasm");
println!("{}", bytes.len()); println!("{}", bytes.len());
assert!(bytes.len() < 40_000); assert!(bytes.len() < 40_000);
} }

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::HashMap; use std::collections::HashMap;
fn main() { fn main() {
@ -13,7 +13,7 @@ fn main() {
.arg("-Copt-level=z") .arg("-Copt-level=z")
.run(); .run();
let file = fs_wrapper::read("main.wasm"); let file = rfs::read("main.wasm");
let mut imports = HashMap::new(); let mut imports = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {

View File

@ -1,12 +1,12 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
#![deny(warnings)] #![deny(warnings)]
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run(); rustc().input("foo.rs").target("wasm32-wasip1").arg("-Clto").opt().run();
let bytes = fs_wrapper::read("foo.wasm"); let bytes = rfs::read("foo.wasm");
println!("{}", bytes.len()); println!("{}", bytes.len());
assert!(bytes.len() < 50_000); assert!(bytes.len() < 50_000);
} }

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::path::Path; use std::path::Path;
@ -23,7 +23,7 @@ fn test(file: &str, args: &[&str], expected_imports: &[(&str, &[&str])]) {
rustc().input(file).target("wasm32-wasip1").args(args).run(); rustc().input(file).target("wasm32-wasip1").args(args).run();
let file = fs_wrapper::read(Path::new(file).with_extension("wasm")); let file = rfs::read(Path::new(file).with_extension("wasm"));
let mut imports = HashMap::new(); let mut imports = HashMap::new();
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::path::Path; use std::path::Path;
fn main() { fn main() {
@ -17,7 +17,7 @@ fn main() {
fn verify_symbols(path: &Path) { fn verify_symbols(path: &Path) {
eprintln!("verify {path:?}"); eprintln!("verify {path:?}");
let file = fs_wrapper::read(&path); let file = rfs::read(&path);
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {
let payload = payload.unwrap(); let payload = payload.unwrap();

View File

@ -1,6 +1,6 @@
//@ only-wasm32-wasip1 //@ only-wasm32-wasip1
use run_make_support::{fs_wrapper, rustc, wasmparser}; use run_make_support::{fs as rfs, rustc, wasmparser};
use std::path::Path; use std::path::Path;
fn main() { fn main() {
@ -16,7 +16,7 @@ fn main() {
fn verify_symbols(path: &Path) { fn verify_symbols(path: &Path) {
eprintln!("verify {path:?}"); eprintln!("verify {path:?}");
let file = fs_wrapper::read(&path); let file = rfs::read(&path);
for payload in wasmparser::Parser::new(0).parse_all(&file) { for payload in wasmparser::Parser::new(0).parse_all(&file) {
let payload = payload.unwrap(); let payload = payload.unwrap();

View File

@ -1,4 +1,4 @@
use run_make_support::fs_wrapper::copy; use run_make_support::fs as rfs;
use run_make_support::regex::Regex; use run_make_support::regex::Regex;
use run_make_support::{cwd, rustc}; use run_make_support::{cwd, rustc};
@ -6,12 +6,12 @@ fn main() {
let invalid_characters = [".foo.rs", ".foo.bar", "+foo+bar.rs"]; let invalid_characters = [".foo.rs", ".foo.bar", "+foo+bar.rs"];
let re = Regex::new(r"invalid character.*in crate name:").unwrap(); let re = Regex::new(r"invalid character.*in crate name:").unwrap();
for f in invalid_characters { for f in invalid_characters {
copy("foo.rs", f); rfs::copy("foo.rs", f);
let stderr = rustc().input(f).run_fail().stderr_utf8(); let stderr = rustc().input(f).run_fail().stderr_utf8();
assert!(re.is_match(&stderr)); assert!(re.is_match(&stderr));
} }
copy("foo.rs", "-foo.rs"); rfs::copy("foo.rs", "-foo.rs");
rustc() rustc()
.input(cwd().join("-foo.rs")) .input(cwd().join("-foo.rs"))
.run_fail() .run_fail()

View File

@ -3,7 +3,7 @@
// Tests that WS2_32.dll is not unnecessarily linked, see issue #85441 // Tests that WS2_32.dll is not unnecessarily linked, see issue #85441
use run_make_support::object::{self, read::Object}; use run_make_support::object::{self, read::Object};
use run_make_support::{fs_wrapper, rustc}; use run_make_support::{fs as rfs, rustc};
fn main() { fn main() {
rustc().input("empty.rs").run(); rustc().input("empty.rs").run();
@ -14,7 +14,7 @@ fn main() {
} }
fn links_ws2_32(exe: &str) -> bool { fn links_ws2_32(exe: &str) -> bool {
let binary_data = fs_wrapper::read(exe); let binary_data = rfs::read(exe);
let file = object::File::parse(&*binary_data).unwrap(); let file = object::File::parse(&*binary_data).unwrap();
for import in file.imports().unwrap() { for import in file.imports().unwrap() {
if import.library().eq_ignore_ascii_case(b"WS2_32.dll") { if import.library().eq_ignore_ascii_case(b"WS2_32.dll") {