From: Ian Jackson Date: Sun, 21 Feb 2021 19:58:43 +0000 (+0000) Subject: Prepare for apitests which run server but not gecko etc. X-Git-Tag: otter-0.4.0~399 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=afe9feae5eb1c6ff49b4b20614eddd76344d192b;p=otter.git Prepare for apitests which run server but not gecko etc. Signed-off-by: Ian Jackson --- diff --git a/Cargo.lock.example b/Cargo.lock.example index 5e816af8..e6697e2a 100644 --- a/Cargo.lock.example +++ b/Cargo.lock.example @@ -1695,6 +1695,20 @@ dependencies = [ "void", ] +[[package]] +name = "otter-api-tests" +version = "0.0.1" +dependencies = [ + "fehler", + "humantime", + "ndarray", + "num-traits", + "otter", + "serde", + "structopt", + "strum", +] + [[package]] name = "otter-base" version = "0.0.1" diff --git a/Cargo.toml b/Cargo.toml index a01c6cb8..97a5ce34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ version = "0.3.0" edition = "2018" [workspace] -members = ["wasm", "daemon", "wdriver"] +members = ["wasm", "daemon", "wdriver", "apitest"] [dependencies] diff --git a/Makefile b/Makefile index 5780248a..b7b73af4 100644 --- a/Makefile +++ b/Makefile @@ -130,7 +130,7 @@ WASM := wasm32-unknown-unknown #---------- toplevel aggregate targets ---------- -check: stamp/cargo.check wdt +check: stamp/cargo.check at wdt @echo 'All tests passed.' doc: cargo-doc @@ -177,6 +177,10 @@ stamp/cargo.check: $(call rsrcs,.) $(CARGO) test --workspace $(stamp) +stamp/cargo-at.debug: $(call rsrcs,.) + $(CARGO) build --workspace $(call cr,$*) -p otter-api-tests + $(stamp) + stamp/cargo-wdt.debug: $(call rsrcs,.) $(CARGO) build --workspace $(call cr,$*) -p otter-webdriver-tests $(stamp) @@ -299,23 +303,37 @@ templates/shapelib.html: $(TARGET_DIR)/debug/otterlib $(LIBRARY_FILES) #---------- webdriver tests (wdt) ---------- +AT_TESTS := $(basename $(notdir $(wildcard apitest/at-*.rs))) WDT_TESTS := $(basename $(notdir $(wildcard wdriver/wdt-*.rs))) WDT_LANDSCAPE_TESTS = wdt-altergame +at: $(foreach f, $(AT_TESTS), stamp/$f.check) + wdt: $(foreach f, $(WDT_TESTS), stamp/$f.check) \ $(foreach f, $(WDT_LANDSCAPE_TESTS), stamp/$f.lcheck) \ -WDT_DEPS = wdriver/run1 stamp/cargo.debug stamp/cargo-wdt.debug \ - $(FILEASSETS) templates/script.js \ +RUNTEST_DEPS = apitest/run1 stamp/cargo.debug $(FILEASSETS) \ $(wildcard libraries/*.toml) $(LIBRARY_FILES) +AT_DEPS = $(filter-out templates/script.js, $(RUNTEST_DEPS)) \ + stamp/cargo-at.debug + +WDT_DEPS = $(RUNTEST_DEPS) \ + stamp/cargo-wdt.debug + +AT_WDT_RUN = $(NAILING_CARGO_JUST_RUN) $(abspath $<) $(basename $(notdir $@)) + +stamp/at-%.check: $(AT_DEPS) + $(AT_WDT_RUN) + $(stamp) + stamp/wdt-%.check: $(WDT_DEPS) - $(NAILING_CARGO_JUST_RUN) $(abspath $<) $(basename $(notdir $@)) + $(AT_WDT_RUN) $(stamp) stamp/wdt-%.lcheck: $(WDT_DEPS) - $(NAILING_CARGO_JUST_RUN) $(abspath $<) $(basename $(notdir $@)) --as-if=lwdt-$* --layout=Landscape + $(AT_WDT_RUN) --as-if=lwdt-$* --layout=Landscape $(stamp) #---------- deployment ---------- diff --git a/apitest.rs b/apitest.rs new file mode 100644 index 00000000..0dbe30b8 --- /dev/null +++ b/apitest.rs @@ -0,0 +1,4 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + diff --git a/apitest/Cargo.toml b/apitest/Cargo.toml new file mode 100644 index 00000000..24756982 --- /dev/null +++ b/apitest/Cargo.toml @@ -0,0 +1,28 @@ +# Copyright 2020-2021 Ian Jackson and contributors to Otter +# SPDX-License-Identifier: AGPL-3.0-or-later +# There is NO WARRANTY. + +[package] +name = "otter-api-tests" +authors = ["Ian Jackson "] +license = "AGPL-3.0-or-later" + +version = "0.0.1" +edition = "2018" + +[dependencies] +otter = { path = ".." } + +humantime = "2" +ndarray = "0.14" + +# Repeated here because importing does not work properly +fehler = "1" +num-traits = "0.2" +serde = { version = "1", features = ["derive","rc"] } +structopt = "0.3" +strum = { version = "0.20", features = ['derive'] } + +[lib] +name = "otter_api_tests" +path = "../apitest.rs" diff --git a/apitest/at-dummy.rs b/apitest/at-dummy.rs new file mode 100644 index 00000000..a281a26d --- /dev/null +++ b/apitest/at-dummy.rs @@ -0,0 +1,6 @@ +// Copyright 2020-2021 Ian Jackson and contributors to Otter +// SPDX-License-Identifier: AGPL-3.0-or-later +// There is NO WARRANTY. + +fn main() { +} diff --git a/apitest/bin b/apitest/bin new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/apitest/bin @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/wdriver/run1 b/apitest/run1 similarity index 100% rename from wdriver/run1 rename to apitest/run1 diff --git a/apitest/src b/apitest/src new file mode 120000 index 00000000..945c9b46 --- /dev/null +++ b/apitest/src @@ -0,0 +1 @@ +. \ No newline at end of file