Skip to content

Commit 82d7cd4

Browse files
authored
Merge pull request #709 from rust-lang/reenable-run-make-tests
Reenable run-make tests
2 parents 1e96d86 + 735a6d3 commit 82d7cd4

File tree

4 files changed

+80
-14
lines changed

4 files changed

+80
-14
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
env:
1313
# Enable backtraces for easier debugging
1414
RUST_BACKTRACE: 1
15+
# For the run-make tests.
16+
LLVM_BIN_DIR: /usr/bin
1517

1618
jobs:
1719
build:
@@ -48,7 +50,7 @@ jobs:
4850

4951
- name: Install packages
5052
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for asm tests.
51-
run: sudo apt-get install ninja-build ripgrep llvm-14-tools
53+
run: sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
5254

5355
- name: Install rustfmt & clippy
5456
run: rustup component add rustfmt clippy
@@ -61,6 +63,12 @@ jobs:
6163
sudo dpkg --force-overwrite -i ${{ matrix.libgccjit_version.gcc }}
6264
echo 'gcc-path = "/usr/lib/"' > config.toml
6365
66+
# Some run-make tests fail if we use our forked GCC because it doesn't
67+
# bundle libstdc++, so we switch to gcc-14 to have a GCC that has
68+
# libstdc++.
69+
- name: Set default GCC to gcc-14
70+
run: sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 30
71+
6472
- name: Set env
6573
run: |
6674
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
env:
1313
# Enable backtraces for easier debugging
1414
RUST_BACKTRACE: 1
15+
# For the run-make tests.
16+
LLVM_BIN_DIR: /usr/bin
1517

1618
jobs:
1719
build:
@@ -36,7 +38,8 @@ jobs:
3638
uses: Swatinem/rust-cache@v2
3739

3840
- name: Install packages
39-
run: sudo apt-get install ninja-build ripgrep
41+
# `llvm-14-tools` is needed to install the `FileCheck` binary which is used for run-make tests.
42+
run: sudo apt-get install ninja-build ripgrep llvm-14-tools llvm
4043

4144
- name: Download artifact
4245
run: curl -LO https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
@@ -46,11 +49,15 @@ jobs:
4649
sudo dpkg --force-overwrite -i gcc-15.deb
4750
echo 'gcc-path = "/usr/lib/"' > config.toml
4851
52+
# Some run-make tests fail if we use our forked GCC because it doesn't
53+
# bundle libstdc++, so we switch to gcc-14 to have a GCC that has
54+
# libstdc++.
55+
- name: Set default GCC to gcc-14
56+
run: sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 30
57+
4958
- name: Set env
5059
run: |
5160
echo "workspace="$GITHUB_WORKSPACE >> $GITHUB_ENV
52-
53-
5461
5562
- name: Build
5663
run: |

build_system/src/test.rs

Lines changed: 36 additions & 10 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
)
@@ -509,14 +534,17 @@ fn setup_rustc(env: &mut Env, args: &TestArg) -> Result<PathBuf, String> {
509534
which FileCheck-11 || \
510535
which FileCheck-12 || \
511536
which FileCheck-13 || \
512-
which FileCheck-14",
537+
which FileCheck-14 || \
538+
which FileCheck",
513539
],
514540
rust_dir,
515541
Some(env),
516542
) {
517543
Ok(cmd) => String::from_utf8_lossy(&cmd.stdout).to_string(),
518544
Err(_) => {
519545
eprintln!("Failed to retrieve LLVM FileCheck, ignoring...");
546+
// FIXME: the test tests/run-make/no-builtins-attribute will fail if we cannot find
547+
// FileCheck.
520548
String::new()
521549
}
522550
};
@@ -1089,19 +1117,18 @@ where
10891117
}
10901118

10911119
fn test_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1092-
//test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
1120+
test_rustc_inner(env, args, |_| Ok(false), false, "run-make")?;
10931121
test_rustc_inner(env, args, |_| Ok(false), false, "ui")
10941122
}
10951123

10961124
fn test_failing_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
1097-
let result1 = Ok(());
1098-
/*test_rustc_inner(
1125+
let result1 = test_rustc_inner(
10991126
env,
11001127
args,
11011128
retain_files_callback("tests/failing-run-make-tests.txt", "run-make"),
11021129
false,
11031130
"run-make",
1104-
)*/
1131+
);
11051132

11061133
let result2 = test_rustc_inner(
11071134
env,
@@ -1122,14 +1149,13 @@ fn test_successful_rustc(env: &Env, args: &TestArg) -> Result<(), String> {
11221149
false,
11231150
"ui",
11241151
)?;
1125-
Ok(())
1126-
/*test_rustc_inner(
1152+
test_rustc_inner(
11271153
env,
11281154
args,
11291155
remove_files_callback("tests/failing-run-make-tests.txt", "run-make"),
11301156
false,
11311157
"run-make",
1132-
)*/
1158+
)
11331159
}
11341160

11351161
fn test_failing_ui_pattern_tests(env: &Env, args: &TestArg) -> Result<(), String> {
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)