wasi_test_generator/
set_up_toolchain.rs1use super::util;
2use super::wasi_version::*;
3
4use std::process::Command;
5
6fn install_toolchain(toolchain_name: &str) {
7 println!("Installing rustup toolchain: {toolchain_name}");
8 let rustup_out = Command::new("rustup")
9 .arg("toolchain")
10 .arg("install")
11 .arg(toolchain_name)
12 .output()
13 .expect("Failed to install toolchain with rustup");
14 util::print_info_on_error(&rustup_out, "TOOLCHAIN INSTALL FAILED");
15
16 println!("Installing rustup WASI target");
17 let rustup_out = Command::new("rustup")
18 .arg("target")
19 .arg("add")
20 .arg("wasm32-wasip1")
21 .arg("--toolchain")
22 .arg(toolchain_name)
23 .output()
24 .expect("Failed to wasi target in Rust toolchain");
25 util::print_info_on_error(&rustup_out, "WASI TARGET IN TOOLCHAIN INSTALL FAILED");
26}
27
28pub fn install_toolchains(wasi_versions: &[WasiVersion]) {
29 println!("Setting up system to generate the WASI tests.");
30 println!("WARNING: this may use a lot of disk space.");
31
32 for wasi_version in wasi_versions {
33 install_toolchain(wasi_version.get_compiler_toolchain());
34 }
35}