From: Ian Jackson Date: Fri, 21 May 2021 19:11:33 +0000 (+0100) Subject: apitest: Pass ds into OtterArgsSpec X-Git-Tag: otter-0.6.0~93 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=06097a9d35e4336ca722bfc62a91b2cdeb0994da;p=otter.git apitest: Pass ds into OtterArgsSpec Signed-off-by: Ian Jackson --- diff --git a/apitest/apitest.rs b/apitest/apitest.rs index dea84a08..9d1151de 100644 --- a/apitest/apitest.rs +++ b/apitest/apitest.rs @@ -742,16 +742,18 @@ impl Drop for OtterOutput { } pub trait OtterArgsSpec { - fn to_args(&self) -> Vec; + fn to_args(&self, ds: &DirSubst) -> Vec; } impl OtterArgsSpec for [S] where for <'s> &'s S: Into { - fn to_args(&self) -> Vec { + fn to_args(&self, _: &DirSubst) -> Vec { self.iter().map(|s| s.into()).collect() } } impl OtterArgsSpec for Vec where for <'s> &'s S: Into { - fn to_args(&self) -> Vec { self.as_slice().to_args() } + fn to_args(&self, ds: &DirSubst) -> Vec { + self.as_slice().to_args(ds) + } } impl DirSubst { @@ -780,7 +782,7 @@ impl DirSubst { let mut args: Vec = vec![]; args.push("--config" .to_owned()); args.push(prctx.resolve(&CONFIG)); args.push("--spec-dir".to_owned()); args.push(prctx.resolve(&specs) ); - args.extend(xargs.to_args()); + args.extend(xargs.to_args(ds)); let dbg = format!("running {} {:?}", &exe, &args); let mut output = NamedTempFile::new_in( ds.subst("@abstmp@").unwrap() diff --git a/apitest/main.rs b/apitest/main.rs index 6c8dd0dd..38d4035b 100644 --- a/apitest/main.rs +++ b/apitest/main.rs @@ -490,7 +490,7 @@ impl UsualCtx { pub fn otter(&mut self, args: &dyn OtterArgsSpec) -> OtterOutput { let args: Vec = ["--account", "server:"].iter().cloned().map(Into::into) - .chain(args.to_args().into_iter()) + .chain(args.to_args(&self.su().ds).into_iter()) .collect(); self.su().ds.otter_prctx(&self.prctx, &args)? }