forked from libre-chip/fayalite
add fake which for miri
This commit is contained in:
parent
b08a747e20
commit
122c08d3cf
1 changed files with 9 additions and 2 deletions
|
@ -258,7 +258,7 @@ pub struct VerilogArgs {
|
||||||
default_value = "firtool",
|
default_value = "firtool",
|
||||||
env = "FIRTOOL",
|
env = "FIRTOOL",
|
||||||
value_hint = ValueHint::CommandName,
|
value_hint = ValueHint::CommandName,
|
||||||
value_parser = OsStringValueParser::new().try_map(which::which)
|
value_parser = OsStringValueParser::new().try_map(which)
|
||||||
)]
|
)]
|
||||||
pub firtool: PathBuf,
|
pub firtool: PathBuf,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
|
@ -428,6 +428,13 @@ impl clap::Args for FormalAdjustArgs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn which(v: std::ffi::OsString) -> which::Result<PathBuf> {
|
||||||
|
#[cfg(not(miri))]
|
||||||
|
return which::which(v);
|
||||||
|
#[cfg(miri)]
|
||||||
|
return Ok(Path::new("/").join(v));
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Parser, Clone)]
|
#[derive(Parser, Clone)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub struct FormalArgs {
|
pub struct FormalArgs {
|
||||||
|
@ -438,7 +445,7 @@ pub struct FormalArgs {
|
||||||
default_value = "sby",
|
default_value = "sby",
|
||||||
env = "SBY",
|
env = "SBY",
|
||||||
value_hint = ValueHint::CommandName,
|
value_hint = ValueHint::CommandName,
|
||||||
value_parser = OsStringValueParser::new().try_map(which::which)
|
value_parser = OsStringValueParser::new().try_map(which)
|
||||||
)]
|
)]
|
||||||
pub sby: PathBuf,
|
pub sby: PathBuf,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue