Skip to content

Commit f94950d

Browse files
committed
Auto merge of #125473 - weihanglo:respect-existing-config-toml, r=<try>
fix(opt-dist): respect existing config.toml This is another step toward making opt-dist work in sandboxed environments. See also <#125465>. opt-dist verifies the final built rustc against a subset of rustc test suite. However it overwrote the pre-existing `config.toml` [^1], and that results in ./vendor/ directory removed [^2]. Instead of overwriting, this patch use `--set <config-value>` to override paths to rustc / cargo / llvm-config. [^1]: https://github.com/rust-lang/rust/blob/606afbb617a2949a4e35c4b0258ff94c980b9451/src/tools/opt-dist/src/tests.rs#L62-L77 [^2]: https://github.com/rust-lang/rust/blob/8679004993f08807289911d9f400f4ac4391d2bc/src/bootstrap/bootstrap.py#L1057
2 parents 0a59f11 + 159ccd4 commit f94950d

File tree

2 files changed

+15
-18
lines changed

2 files changed

+15
-18
lines changed

src/ci/github-actions/jobs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ envs:
6161

6262
try:
6363
<<: *production
64-
DIST_TRY_BUILD: 1
64+
#DIST_TRY_BUILD: 1
6565

6666
auto:
6767
<<: *production

src/tools/opt-dist/src/tests.rs

+14-17
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,17 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
5959
.join(format!("llvm-config{}", executable_extension()));
6060
assert!(llvm_config.is_file());
6161

62-
let config_content = format!(
63-
r#"profile = "user"
64-
change-id = 115898
62+
let rustc = format!("build.rustc={}", rustc_path.to_string().replace('\\', "/"));
63+
let cargo = format!("build.cargo={}", cargo_path.to_string().replace('\\', "/"));
64+
let llvm_config =
65+
format!("target.{host_triple}.llvm-config={}", llvm_config.to_string().replace('\\', "/"));
6566

66-
[build]
67-
rustc = "{rustc}"
68-
cargo = "{cargo}"
69-
70-
[target.{host_triple}]
71-
llvm-config = "{llvm_config}"
72-
"#,
73-
rustc = rustc_path.to_string().replace('\\', "/"),
74-
cargo = cargo_path.to_string().replace('\\', "/"),
75-
llvm_config = llvm_config.to_string().replace('\\', "/")
76-
);
77-
log::info!("Using following `config.toml` for running tests:\n{config_content}");
67+
log::info!("Set the following configurations for running tests:");
68+
log::info!("\t{rustc}");
69+
log::info!("\t{cargo}");
70+
log::info!("\t{llvm_config}");
7871

7972
// Simulate a stage 0 compiler with the extracted optimized dist artifacts.
80-
std::fs::write("config.toml", config_content)?;
81-
8273
let x_py = env.checkout_path().join("x.py");
8374
let mut args = vec![
8475
env.python_binary(),
@@ -97,6 +88,12 @@ llvm-config = "{llvm_config}"
9788
"tests/run-pass-valgrind",
9889
"tests/ui",
9990
"tests/crashes",
91+
"--set",
92+
&rustc,
93+
"--set",
94+
&cargo,
95+
"--set",
96+
&llvm_config,
10097
];
10198
for test_path in env.skipped_tests() {
10299
args.extend(["--skip", test_path]);

0 commit comments

Comments
 (0)