rust/tests/run-make/extra-filename-with-temp-outputs/rmake.rs
许杰友 Jieyou Xu (Joe) d69cc1ccbf tests: update for rfs rename
2024-07-17 13:34:18 +00:00

20 lines
892 B
Rust

// In order to prevent temporary files from overwriting each other in parallel
// compilation, rustc was changed to mix an extra filename with temporary
// outputs. However, as this is a similar behavior with the codegen flag
// -C extra-filename, this test checks that the manually passed flag
// is not overwritten by this feature, and that the output files
// are named as expected.
// See https://github.com/rust-lang/rust/pull/15686
use run_make_support::{bin_name, cwd, has_prefix, has_suffix, rfs, rustc, shallow_find_files};
fn main() {
rustc().extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
let object_files = shallow_find_files(cwd(), |path| {
has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o")
});
let object_file = object_files.get(0).unwrap();
rfs::remove_file(object_file);
rfs::remove_file(bin_name("foobar"));
}