Skip to content

Commit 3f09406

Browse files
committed
Add patch to fix a run-make test
1 parent 033fa35 commit 3f09406

File tree

2 files changed

+52
-2
lines changed

2 files changed

+52
-2
lines changed

build_system/src/test.rs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ use crate::build;
99
use crate::config::{Channel, ConfigInfo};
1010
use crate::utils::{
1111
create_dir, get_sysroot_dir, get_toolchain, git_clone, git_clone_root_dir, remove_file,
12-
run_command, run_command_with_env, run_command_with_output_and_env, rustc_version_info,
13-
split_args, walk_dir,
12+
run_command, run_command_with_env, run_command_with_output, run_command_with_output_and_env,
13+
rustc_version_info, split_args, walk_dir,
1414
};
1515

1616
type Env = HashMap<String, String>;
@@ -484,6 +484,31 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
484484
} else {
485485
run_command_with_output_and_env(&[&"git", &"checkout"], rust_dir, Some(env))?;
486486
}
487+
488+
let mut patches = Vec::new();
489+
walk_dir(
490+
"patches/tests",
491+
&mut |_| Ok(()),
492+
&mut |file_path: &Path| {
493+
patches.push(file_path.to_path_buf());
494+
Ok(())
495+
},
496+
false,
497+
)?;
498+
patches.sort();
499+
// TODO: remove duplication with prepare.rs by creating a apply_patch function in the utils
500+
// module.
501+
for file_path in patches {
502+
println!("[GIT] apply `{}`", file_path.display());
503+
let path = Path::new("../..").join(file_path);
504+
run_command_with_output(&[&"git", &"apply", &path], rust_dir)?;
505+
run_command_with_output(&[&"git", &"add", &"-A"], rust_dir)?;
506+
run_command_with_output(
507+
&[&"git", &"commit", &"--no-gpg-sign", &"-m", &format!("Patch {}", path.display())],
508+
rust_dir,
509+
)?;
510+
}
511+
487512
let cargo = String::from_utf8(
488513
run_command_with_env(&[&"rustup", &"which", &"cargo"], rust_dir, Some(env))?.stdout,
489514
)
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From a131c69e54b5c02fe3b517e8f3ad23d4f784ffc8 Mon Sep 17 00:00:00 2001
2+
From: Antoni Boucher <[email protected]>
3+
Date: Fri, 13 Jun 2025 20:25:33 -0400
4+
Subject: [PATCH] Workaround to make a run-make test pass
5+
6+
---
7+
tests/run-make/linker-warning/rmake.rs | 2 +-
8+
1 file changed, 1 insertion(+), 1 deletion(-)
9+
10+
diff --git a/tests/run-make/linker-warning/rmake.rs b/tests/run-make/linker-warning/rmake.rs
11+
index bc21739fefc..0946a7e2a48 100644
12+
--- a/tests/run-make/linker-warning/rmake.rs
13+
+++ b/tests/run-make/linker-warning/rmake.rs
14+
@@ -55,7 +55,7 @@ fn main() {
15+
diff()
16+
.expected_file("short-error.txt")
17+
.actual_text("(linker error)", out.stderr())
18+
- .normalize(r#"/rustc[^/]*/"#, "/rustc/")
19+
+ .normalize(r#"/tmp/rustc[^/]*/"#, "/tmp/rustc/")
20+
.normalize(
21+
regex::escape(run_make_support::build_root().to_str().unwrap()),
22+
"/build-root",
23+
--
24+
2.49.0
25+

0 commit comments

Comments
 (0)