Files
wasmtime/winch/src/filetests.rs
Kevin Rizzo da03ff47f1 winch: Adding support for integration tests (#5588)
* Adding in the foundations for Winch `filetests`

This commit adds two new crates into the Winch workspace:
`filetests` and `test-macros`. The intent is to mimic the
structure of Cranelift `filetests`, but in a simpler way.

* Updates to documentation

This commits adds a high level document to outline how to test Winch
through the `winch-tools` utility. It also updates some inline
documentation which gets propagated to the CLI.

* Updating test-macro to use a glob instead of only a flat directory
2023-01-19 07:34:48 -05:00

26 lines
691 B
Rust

use std::process::Command;
use anyhow::Result;
use clap::Parser;
#[derive(Parser, Debug)]
pub struct Options {
/// Passes extra arguments to `cargo test --package winch-filetests`. For example, to run a single
/// test, use `-- --test-threads 1 --test single_test_name`.
#[clap(last = true, value_parser)]
cargo_test_args: Vec<String>,
}
pub fn run(opts: &Options) -> Result<()> {
Command::new("cargo")
.arg("test")
.arg("--package")
.arg("winch-filetests")
.arg("--")
.args(&opts.cargo_test_args)
.spawn()?
.wait()
.map(|_| ())
.map_err(|e| anyhow::anyhow!("Failed to run cargo test: {}", e))
}