wasmer/lib/wasi-tests/build/set_up_toolchain.rs
Mark McCaskey 6a5efcda98 Update wasi-tests to test multiple versions of WASI
This change also cleans up the `wasi-test` generation a bit.  It's
actually still really, really messy, but at least now it's split up
into easier to understand chunks.

There's still a lot of low-hanging fruit in terms of improving the
readibilty and maintainability of the code.
2020-03-13 15:41:50 -07:00

32 lines
998 B
Rust

use crate::util;
use crate::wasi_version::*;
use std::process::Command;
fn install_toolchain(toolchain_name: &str) {
println!("Installing rustup toolchain: {}", toolchain_name);
let rustup_out = Command::new("rustup")
.arg("toolchain")
.arg("install")
.arg(toolchain_name)
.output()
.expect("Failed to install toolchain with rustup");
util::print_info_on_error(&rustup_out, "TOOLCHAIN INSTALL FAILED");
}
pub fn set_it_up(only_latest: bool) {
println!("Setting up system to generate the WASI tests.");
println!("WARNING: this may use a lot of disk space.");
let wasi_versions = if only_latest {
println!("Only installing the toolchain for the latest WASI version");
LATEST_WASI_VERSION
} else {
println!("Installing the toolchain for all WASI versions");
ALL_WASI_VERSIONS
};
for wasi_version in wasi_versions {
install_toolchain(wasi_version.get_compiler_toolchain());
}
}