Create a Python package "tasst" with common helper code for use in passt
and pasta. Initially it just has a placeholder selftest.
Extend the meta tests to include selftests within the tasst library. This
lets us test the functionality of the library itself without involving
actual passt or pasta.
Signed-off-by: David Gibson
---
test/Makefile | 13 +++++++++----
test/tasst/.gitignore | 1 +
test/tasst/__init__.py | 11 +++++++++++
test/tasst/__main__.py | 22 ++++++++++++++++++++++
4 files changed, 43 insertions(+), 4 deletions(-)
create mode 100644 test/tasst/.gitignore
create mode 100644 test/tasst/__init__.py
create mode 100644 test/tasst/__main__.py
diff --git a/test/Makefile b/test/Makefile
index 0b3ed3d0..81f94f70 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -70,15 +70,17 @@ EXETER_PY = build/build.py
EXETER_JOBS = $(EXETER_SH:%.sh=%.json) $(EXETER_PY:%.py=%.json)
AVOCADO_JOBS = $(EXETER_JOBS) avocado/static_checkers.json
-EXETER_META = meta/lint.json
+TASST_SRCS = __init__.py __main__.py
+
+EXETER_META = meta/lint.json meta/tasst.json
META_JOBS = $(EXETER_META)
-PYPKGS = $(EXETER_PY)
+PYPKGS = tasst $(EXETER_PY)
PYTHON = python3
VENV = venv
PIP = $(VENV)/bin/pip3
-PYPATH = exeter/py3
+PYPATH = . exeter/py3
SPACE = $(subst ,, )
PYPATH_TEST = $(subst $(SPACE),:,$(PYPATH))
PYPATH_BASE = $(subst $(SPACE),:,$(PYPATH:%=test/%))
@@ -151,6 +153,9 @@ venv: pull-exeter
%.json: %.py pull-exeter
cd ..; PYTHONPATH=$(PYPATH_BASE) $(PYTHON) test/$< --avocado > test/$@
+meta/tasst.json: $(TASST_SRCS:%=tasst/%) $(VENV) pull-exeter
+ cd ..; PYTHONPATH=$(PYPATH_BASE) $(PYTHON) -m tasst --avocado > test/$@
+
.PHONY: avocado
avocado: venv $(AVOCADO_JOBS)
$(RUN_AVOCADO) all $(AVOCADO_JOBS)
@@ -176,7 +181,7 @@ clean:
rm -f $(LOCAL_ASSETS)
rm -rf test_logs
rm -f prepared-*.qcow2 prepared-*.img
- rm -rf $(VENV)
+ rm -rf $(VENV) tasst/__pycache__
rm -f $(EXETER_JOBS) $(EXETER_META)
realclean: clean
diff --git a/test/tasst/.gitignore b/test/tasst/.gitignore
new file mode 100644
index 00000000..c18dd8d8
--- /dev/null
+++ b/test/tasst/.gitignore
@@ -0,0 +1 @@
+__pycache__/
diff --git a/test/tasst/__init__.py b/test/tasst/__init__.py
new file mode 100644
index 00000000..c1d5d9dd
--- /dev/null
+++ b/test/tasst/__init__.py
@@ -0,0 +1,11 @@
+#! /usr/bin/env python3
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright Red Hat
+# Author: David Gibson
+
+"""
+Test A Simple Socket Transport
+library of test helpers for passt & pasta
+"""
diff --git a/test/tasst/__main__.py b/test/tasst/__main__.py
new file mode 100644
index 00000000..c365b986
--- /dev/null
+++ b/test/tasst/__main__.py
@@ -0,0 +1,22 @@
+#! /usr/bin/env python3
+
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright Red Hat
+# Author: David Gibson
+
+"""
+Test A Simple Socket Transport
+library of test helpers for passt & pasta
+"""
+
+import exeter
+
+
+@exeter.test
+def placeholder():
+ pass
+
+
+if __name__ == '__main__':
+ exeter.main()
--
2.45.2