opt-dist: dont overrwite config.toml when verifying
This is another step toward making opt-dist work in sandboxed environments 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]:606afbb617/src/tools/opt-dist/src/tests.rs (L62-L77)
[^2]:8679004993/src/bootstrap/bootstrap.py (L1057)
This commit is contained in:
parent
0a59f11362
commit
c81a40bbc0
1 changed files with 14 additions and 17 deletions
|
@ -59,26 +59,17 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
|
||||||
.join(format!("llvm-config{}", executable_extension()));
|
.join(format!("llvm-config{}", executable_extension()));
|
||||||
assert!(llvm_config.is_file());
|
assert!(llvm_config.is_file());
|
||||||
|
|
||||||
let config_content = format!(
|
let rustc = format!("build.rustc={}", rustc_path.to_string().replace('\\', "/"));
|
||||||
r#"profile = "user"
|
let cargo = format!("build.cargo={}", cargo_path.to_string().replace('\\', "/"));
|
||||||
change-id = 115898
|
let llvm_config =
|
||||||
|
format!("target.{host_triple}.llvm-config={}", llvm_config.to_string().replace('\\', "/"));
|
||||||
|
|
||||||
[build]
|
log::info!("Set the following configurations for running tests:");
|
||||||
rustc = "{rustc}"
|
log::info!("\t{rustc}");
|
||||||
cargo = "{cargo}"
|
log::info!("\t{cargo}");
|
||||||
|
log::info!("\t{llvm_config}");
|
||||||
[target.{host_triple}]
|
|
||||||
llvm-config = "{llvm_config}"
|
|
||||||
"#,
|
|
||||||
rustc = rustc_path.to_string().replace('\\', "/"),
|
|
||||||
cargo = cargo_path.to_string().replace('\\', "/"),
|
|
||||||
llvm_config = llvm_config.to_string().replace('\\', "/")
|
|
||||||
);
|
|
||||||
log::info!("Using following `config.toml` for running tests:\n{config_content}");
|
|
||||||
|
|
||||||
// Simulate a stage 0 compiler with the extracted optimized dist artifacts.
|
// Simulate a stage 0 compiler with the extracted optimized dist artifacts.
|
||||||
std::fs::write("config.toml", config_content)?;
|
|
||||||
|
|
||||||
let x_py = env.checkout_path().join("x.py");
|
let x_py = env.checkout_path().join("x.py");
|
||||||
let mut args = vec![
|
let mut args = vec![
|
||||||
env.python_binary(),
|
env.python_binary(),
|
||||||
|
@ -97,6 +88,12 @@ llvm-config = "{llvm_config}"
|
||||||
"tests/run-pass-valgrind",
|
"tests/run-pass-valgrind",
|
||||||
"tests/ui",
|
"tests/ui",
|
||||||
"tests/crashes",
|
"tests/crashes",
|
||||||
|
"--set",
|
||||||
|
&rustc,
|
||||||
|
"--set",
|
||||||
|
&cargo,
|
||||||
|
"--set",
|
||||||
|
&llvm_config,
|
||||||
];
|
];
|
||||||
for test_path in env.skipped_tests() {
|
for test_path in env.skipped_tests() {
|
||||||
args.extend(["--skip", test_path]);
|
args.extend(["--skip", test_path]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue