From: Ian Jackson Date: Mon, 17 May 2021 16:52:29 +0000 (+0100) Subject: apitest: Make it also a portmanteau X-Git-Tag: otter-0.6.0~184 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=a88c72ce005415512d41ae69fc8c700203c12276;p=otter.git apitest: Make it also a portmanteau Signed-off-by: Ian Jackson --- diff --git a/Makefile b/Makefile index f4704c21..70e96bf5 100644 --- a/Makefile +++ b/Makefile @@ -383,7 +383,7 @@ WDT_DEPS = $(RUNTEST_DEPS) \ AT_WDT_RUN = $(NAILING_CARGO_JUST_RUN) $(abspath $<) -AT_RUN = $(AT_WDT_RUN) $(basename $(notdir $@)) +AT_RUN = $(AT_WDT_RUN) apitest --test=$(basename $(notdir $@)) WDT_RUN = $(AT_WDT_RUN) wdriver --test=$(basename $(notdir $@)) for-at: $(AT_DEPS) diff --git a/apitest/Cargo.toml b/apitest/Cargo.toml index 90c7c264..a2572e87 100644 --- a/apitest/Cargo.toml +++ b/apitest/Cargo.toml @@ -20,8 +20,8 @@ name="otter_api_tests" path="apitest.rs" [[bin]] -name="at-otter" -path="at-otter.rs" +name="apitest" +path="main.rs" [dependencies] diff --git a/apitest/apitest.rs b/apitest/apitest.rs index a9463421..04b0b877 100644 --- a/apitest/apitest.rs +++ b/apitest/apitest.rs @@ -1051,7 +1051,9 @@ pub fn portmanteau_main(prefix: &str){ s } else { let s = s.strip_prefix("--test=") - .expect("found non-long-option looking for --test={wdt,at}-*"); + .expect(&format!( + "found non-long-option looking for --test={}-*: {:?}", + prefix, s)); if ! plausible(s) { panic!("found non --no-bwrap --{}-* option looking for --{}-*", prefix,prefix); diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index c3b8bfad..5d7018bb 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -777,11 +777,11 @@ fn tests(mut c: Ctx) { } #[throws(Explode)] -fn main() { +pub fn main() { { let (opts, _instance, su) = setup_core( &[module_path!()], - &mut |_|false + &mut |s: &OsStr| s.to_str().unwrap().starts_with("--test=") )?; let spec = su.ds.game_spec_data()?; let mut mc = su.mgmt_conn(); diff --git a/apitest/main.rs b/apitest/main.rs new file mode 100644 index 00000000..81897523 --- /dev/null +++ b/apitest/main.rs @@ -0,0 +1,10 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + +pub use otter_api_tests::*; + +portmanteau_has!("at-otter.rs", at_otter); + +#[throws(AE)] +fn main() { portmanteau_main("at")? }