chiark / gitweb /
Prepare for apitests which run server but not gecko etc.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Feb 2021 19:58:43 +0000 (19:58 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 21 Feb 2021 19:58:43 +0000 (19:58 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Cargo.lock.example
Cargo.toml
Makefile
apitest.rs [new file with mode: 0644]
apitest/Cargo.toml [new file with mode: 0644]
apitest/at-dummy.rs [new file with mode: 0644]
apitest/bin [new symlink]
apitest/run1 [moved from wdriver/run1 with 100% similarity]
apitest/src [new symlink]

index 5e816af8753263143c78cea805c48736f913f8e7..e6697e2ab353874650b45d0ec8726f960cd6a45a 100644 (file)
@@ -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"
index a01c6cb8dee631fb0a3c8b246a47343c34d38a1e..97a5ce3480d36abb367bacd3d15c220d51578cba 100644 (file)
@@ -11,7 +11,7 @@ version = "0.3.0"
 edition = "2018"
 
 [workspace]
-members = ["wasm", "daemon", "wdriver"]
+members = ["wasm", "daemon", "wdriver", "apitest"]
 
 [dependencies]
 
index 5780248a9867b4e8d151be334665f6465b8d88af..b7b73af4d7f3a000dcba1ed8950e5c77212dfb9f 100644 (file)
--- 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 (file)
index 0000000..0dbe30b
--- /dev/null
@@ -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 (file)
index 0000000..2475698
--- /dev/null
@@ -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 <ijackson@chiark.greenend.org.uk>"]
+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 (file)
index 0000000..a281a26
--- /dev/null
@@ -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 (symlink)
index 0000000..945c9b4
--- /dev/null
@@ -0,0 +1 @@
+.
\ No newline at end of file
similarity index 100%
rename from wdriver/run1
rename to apitest/run1
diff --git a/apitest/src b/apitest/src
new file mode 120000 (symlink)
index 0000000..945c9b4
--- /dev/null
@@ -0,0 +1 @@
+.
\ No newline at end of file