bench-api: configure execution with a flags string (#4096)

As discussed previously, we need a way to be able to configure Wasmtime when running it in the Sightglass benchmark infrastructure. The easiest way to do this seemed to be to pass a string from Sightglass to the `bench-api` library and parse this in the same way that Wasmtime parses its CLI flags. The structure that contains these flags is `CommonOptions`, so it has been moved to its own crate to be depended on by both `wasmtime-cli` and `wasmtime-bench-api`. Also, this change adds an externally-visible function for parsing a string into `CommonOptions`, which is used for configuring an engine.
This commit is contained in:
Andrew Brown
2022-05-04 16:30:39 -07:00
committed by GitHub
parent 527b7a9b05
commit 5c3642fcb1
13 changed files with 1093 additions and 744 deletions

View File

@@ -1,12 +1,12 @@
//! The module that implements the `wasmtime compile` command.
use crate::CommonOptions;
use anyhow::{bail, Context, Result};
use clap::Parser;
use std::fs;
use std::path::PathBuf;
use target_lexicon::Triple;
use wasmtime::Engine;
use wasmtime_cli_flags::CommonOptions;
lazy_static::lazy_static! {
static ref AFTER_HELP: String = {

View File

@@ -1,6 +1,5 @@
//! The module that implements the `wasmtime run` command.
use crate::{CommonOptions, WasiModules};
use anyhow::{anyhow, bail, Context as _, Result};
use clap::Parser;
use std::fs::File;
@@ -13,6 +12,7 @@ use std::{
process,
};
use wasmtime::{Engine, Func, Linker, Module, Store, Trap, Val, ValType};
use wasmtime_cli_flags::{CommonOptions, WasiModules};
use wasmtime_wasi::sync::{ambient_authority, Dir, TcpListener, WasiCtxBuilder};
#[cfg(feature = "wasi-nn")]

View File

@@ -1,10 +1,10 @@
//! The module that implements the `wasmtime wast` command.
use crate::CommonOptions;
use anyhow::{Context as _, Result};
use clap::Parser;
use std::path::PathBuf;
use wasmtime::{Engine, Store};
use wasmtime_cli_flags::CommonOptions;
use wasmtime_wast::WastContext;
lazy_static::lazy_static! {