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:
@@ -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 = {
|
||||
|
||||
@@ -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")]
|
||||
|
||||
@@ -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! {
|
||||
|
||||
Reference in New Issue
Block a user