* Move most wasmtime tests into one test suite This commit moves most wasmtime tests into a single test suite which gets compiled into one executable instead of having lots of test executables. The goal here is to reduce disk space on CI, and this should be achieved by having fewer executables which means fewer copies of `libwasmtime.rlib` linked across binaries on the system. More importantly though this means that DWARF debug information should only be in one executable rather than duplicated across many. * Share more build caches Globally set `RUSTFLAGS` to `-Dwarnings` instead of individually so all build steps share the same value. * Allow some dead code in cranelift-codegen Prevents having to fix all warnings for all possible feature combinations, only the main ones which come up. * Update some debug file paths
35 lines
825 B
Rust
35 lines
825 B
Rust
use anyhow::{Context as _, Result};
|
|
use std::fs::File;
|
|
use std::path::Path;
|
|
use target_lexicon::Triple;
|
|
use wasmtime::Strategy;
|
|
use wasmtime_cli::compile_to_obj;
|
|
use wasmtime_environ::CacheConfig;
|
|
|
|
pub fn compile_cranelift(
|
|
wasm: &[u8],
|
|
target: Option<Triple>,
|
|
output: impl AsRef<Path>,
|
|
) -> Result<()> {
|
|
let obj = compile_to_obj(
|
|
wasm,
|
|
target.as_ref(),
|
|
Strategy::Cranelift,
|
|
false,
|
|
wasmtime::OptLevel::None,
|
|
true,
|
|
output
|
|
.as_ref()
|
|
.file_name()
|
|
.unwrap()
|
|
.to_string_lossy()
|
|
.to_string(),
|
|
&CacheConfig::new_cache_disabled(),
|
|
)?;
|
|
|
|
let file = File::create(output).context("failed to create object file")?;
|
|
obj.write(file).context("failed to write object file")?;
|
|
|
|
Ok(())
|
|
}
|