Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8795245

Browse files
authoredJul 13, 2024
Unrolled build for rust-lang#127338
Rollup merge of rust-lang#127338 - Oneirical:ready-your-arbatests, r=jieyouxu Migrate `extra-filename-with-temp-outputs` and `issue-85019-moved-src-dir` `run-make` tests to rmake 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). Please try: try-job: armhf-gnu // try-job: test-various // already tried try-job: x86_64-msvc try-job: aarch64-apple
2 parents c6727fc + c6cdbe6 commit 8795245

File tree

8 files changed

+64
-37
lines changed

8 files changed

+64
-37
lines changed
 

‎src/tools/run-make-support/src/lib.rs

+5
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ pub fn filename_not_in_denylist<P: AsRef<Path>, V: AsRef<[String]>>(path: P, exp
303303
.is_some_and(|name| !expected.contains(&name.to_str().unwrap().to_owned()))
304304
}
305305

306+
/// Returns true if the filename at `path` ends with `suffix`.
307+
pub fn has_suffix<P: AsRef<Path>>(path: P, suffix: &str) -> bool {
308+
path.as_ref().file_name().is_some_and(|name| name.to_str().unwrap().ends_with(suffix))
309+
}
310+
306311
/// Gathers all files in the current working directory that have the extension `ext`, and counts
307312
/// the number of lines within that contain a match with the regex pattern `re`.
308313
pub fn count_regex_matches_in_files_with_extension(re: &regex::Regex, ext: &str) -> usize {

‎src/tools/tidy/src/allowed_run_make_makefiles.txt

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ run-make/extern-fn-with-packed-struct/Makefile
3737
run-make/extern-fn-with-union/Makefile
3838
run-make/extern-multiple-copies/Makefile
3939
run-make/extern-multiple-copies2/Makefile
40-
run-make/extra-filename-with-temp-outputs/Makefile
4140
run-make/fmt-write-bloat/Makefile
4241
run-make/foreign-double-unwind/Makefile
4342
run-make/foreign-exceptions/Makefile
@@ -60,7 +59,6 @@ run-make/issue-47551/Makefile
6059
run-make/issue-69368/Makefile
6160
run-make/issue-83045/Makefile
6261
run-make/issue-84395-lto-embed-bitcode/Makefile
63-
run-make/issue-85019-moved-src-dir/Makefile
6462
run-make/issue-85401-static-mir/Makefile
6563
run-make/issue-88756-default-output/Makefile
6664
run-make/issue-97463-abi-param-passing/Makefile

‎tests/run-make/extra-filename-with-temp-outputs/Makefile

-7
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// In order to prevent temporary files from overwriting each other in parallel
2+
// compilation, rustc was changed to mix an extra filename with temporary
3+
// outputs. However, as this is a similar behavior with the codegen flag
4+
// -C extra-filename, this test checks that the manually passed flag
5+
// is not overwritten by this feature, and that the output files
6+
// are named as expected.
7+
// See https://github.com/rust-lang/rust/pull/15686
8+
9+
use run_make_support::{
10+
bin_name, cwd, fs_wrapper, has_prefix, has_suffix, rustc, shallow_find_files,
11+
};
12+
13+
fn main() {
14+
rustc().extra_filename("bar").input("foo.rs").arg("-Csave-temps").run();
15+
let object_files = shallow_find_files(cwd(), |path| {
16+
has_prefix(path, "foobar.foo") && has_suffix(path, "0.rcgu.o")
17+
});
18+
let object_file = object_files.get(0).unwrap();
19+
fs_wrapper::remove_file(object_file);
20+
fs_wrapper::remove_file(bin_name("foobar"));
21+
}

‎tests/run-make/issue-85019-moved-src-dir/Makefile

-28
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// A SourceFile created during compilation may have a relative
2+
// path (e.g. if rustc itself is invoked with a relative path).
3+
// When we write out crate metadata, we convert all relative paths
4+
// to absolute paths using the current working directory.
5+
// However, the working directory was previously not included in the crate hash.
6+
// This meant that the crate metadata could change while the crate
7+
// hash remained the same. Among other problems, this could cause a
8+
// fingerprint mismatch ICE, since incremental compilation uses
9+
// the crate metadata hash to determine if a foreign query is green.
10+
// This test checks that we don't get an ICE when the working directory
11+
// (but not the build directory!) changes between compilation
12+
// sessions.
13+
// See https://github.com/rust-lang/rust/issues/85019
14+
15+
//@ ignore-none
16+
// Reason: no-std is not supported
17+
//@ ignore-nvptx64-nvidia-cuda
18+
// FIXME: can't find crate for 'std'
19+
20+
use run_make_support::{fs_wrapper, rust_lib_name, rustc};
21+
22+
fn main() {
23+
fs_wrapper::create_dir("incr");
24+
fs_wrapper::create_dir("first_src");
25+
fs_wrapper::create_dir("output");
26+
fs_wrapper::rename("my_lib.rs", "first_src/my_lib.rs");
27+
fs_wrapper::rename("main.rs", "first_src/main.rs");
28+
// Build from "first_src"
29+
std::env::set_current_dir("first_src").unwrap();
30+
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();
31+
rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run();
32+
std::env::set_current_dir("..").unwrap();
33+
fs_wrapper::rename("first_src", "second_src");
34+
std::env::set_current_dir("second_src").unwrap();
35+
// Build from "second_src" - the output and incremental directory remain identical
36+
rustc().input("my_lib.rs").incremental("incr").crate_type("lib").run();
37+
rustc().input("main.rs").incremental("incr").extern_("my_lib", rust_lib_name("my_lib")).run();
38+
}

0 commit comments

Comments
 (0)
Failed to load comments.