From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 1/3] test: Prepare for tunbridge based tests
Date: Thu, 2 Oct 2025 17:57:06 +1000 [thread overview]
Message-ID: <20251002075708.461931-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20251002075708.461931-1-david@gibson.dropbear.id.au>
I plan to start converting many of our tests to the tunbridge[0] network
simulator framework. This is the first step: downloading and setting up
tunbridge to work within our test scripts. It also introduces a 'tasst'
Python library for code that we might want to reuse across various
tunbridge based tests.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
test/.gitignore | 2 ++
test/Makefile | 19 +++++++++++--------
test/run | 2 +-
test/smoke/smoke.py | 26 ++++++++++++++++++++++++++
test/tasst/__init__.py | 10 ++++++++++
5 files changed, 50 insertions(+), 9 deletions(-)
create mode 100755 test/smoke/smoke.py
create mode 100644 test/tasst/__init__.py
diff --git a/test/.gitignore b/test/.gitignore
index 9412f0d3..71409c51 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -12,4 +12,6 @@ rampstream
guest-key
guest-key.pub
/exeter/
+/tunbridge/
*.bats
+__pycache__/
diff --git a/test/Makefile b/test/Makefile
index 5b5f0fc1..f66c7e7e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -54,7 +54,7 @@ UBUNTU_NEW_IMGS = xenial-server-cloudimg-powerpc-disk1.img \
jammy-server-cloudimg-s390x.img
UBUNTU_IMGS = $(UBUNTU_OLD_IMGS) $(UBUNTU_NEW_IMGS)
-DOWNLOAD_ASSETS = $(EXETOOL) mbuto podman \
+DOWNLOAD_ASSETS = $(EXETOOL) tunbridge mbuto podman \
$(DEBIAN_IMGS) $(FEDORA_IMGS) $(OPENSUSE_IMGS) $(UBUNTU_IMGS)
TESTDATA_ASSETS = small.bin big.bin medium.bin \
rampstream
@@ -65,15 +65,15 @@ LOCAL_ASSETS = mbuto.img mbuto.mem.img podman/bin/podman QEMU_EFI.fd \
ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS)
-EXETER_PYPATH = exeter/py3
-EXETER_PYTHON = build/build.py
-EXETER_BATS = smoke/smoke.sh.bats \
- $(EXETER_PYTHON:%=%.bats) build/static_checkers.sh.bats
+EXETER_SH = smoke/smoke.sh build/static_checkers.sh
+EXETER_PYPATH = exeter/py3:tunbridge/:.
+EXETER_PYTHON = smoke/smoke.py build/build.py
+EXETER_BATS = $(EXETER_SH:%=%.bats) $(EXETER_PYTHON:%=%.bats)
BATS_FILES = $(EXETER_BATS) \
podman/test/system/505-networking-pasta.bats
# Python test code (for linters)
-PYPKGS = $(EXETER_PYTHON)
+PYPKGS = $(EXETER_PYTHON) tasst
CFLAGS = -Wall -Werror -Wextra -pedantic -std=c99
@@ -88,6 +88,9 @@ exeter:
exeter/exetool/exetool: pull-exeter
+tunbridge:
+ git clone https://gitlab.com/dgibson/tunbridge.git
+
mbuto:
git clone git://mbuto.sh/mbuto
@@ -139,7 +142,7 @@ flake8: pull-exeter
mypy: pull-exeter
PYTHONPATH=$(EXETER_PYPATH) $(MYPY) $(PYPKGS)
-$(EXETER_BATS): %.bats: % $(EXETOOL)
+$(EXETER_BATS): %.bats: % $(EXETOOL) pull-tunbridge
PYTHONPATH=$(EXETER_PYPATH) $(EXETOOL) bats -- $< > $@
bats: $(BATS_FILES) pull-podman
@@ -153,7 +156,7 @@ debug: assets
clean:
rm -f perf.js *~
- rm -rf .mypy_cache
+ rm -rf .mypy_cache __pycache__
rm -f $(LOCAL_ASSETS)
rm -f $(EXETER_BATS)
rm -rf test_logs
diff --git a/test/run b/test/run
index f858e558..3872a56e 100755
--- a/test/run
+++ b/test/run
@@ -44,7 +44,7 @@ KERNEL=${KERNEL:-"/boot/vmlinuz-$(uname -r)"}
COMMIT="$(git log --oneline --no-decorate -1)"
# Let exeter tests written in Python find their modules
-export PYTHONPATH=${BASEPATH}/exeter/py3
+export PYTHONPATH=${BASEPATH}/exeter/py3:${BASEPATH}/tunbridge:${BASEPATH}
. lib/util
. lib/context
diff --git a/test/smoke/smoke.py b/test/smoke/smoke.py
new file mode 100755
index 00000000..cbf77ad9
--- /dev/null
+++ b/test/smoke/smoke.py
@@ -0,0 +1,26 @@
+#! /usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# test/smoke/smoke.py - Python smoke tests
+#
+# Copyright Red Hat
+# Author: David Gibson <david@gibson.dropbear.id.au>
+
+import exeter
+
+
+@exeter.test
+def py_test_libraries() -> None:
+ """Check test in Python have access to the libraries we need"""
+
+ import tunbridge
+ import tasst
+
+ print(f"Imported exeter: {exeter}")
+ print(f"Imported tunbridge: {tunbridge}")
+ print(f"Imported tasst: {tasst}")
+
+
+if __name__ == '__main__':
+ exeter.main()
diff --git a/test/tasst/__init__.py b/test/tasst/__init__.py
new file mode 100644
index 00000000..fd4fe9a8
--- /dev/null
+++ b/test/tasst/__init__.py
@@ -0,0 +1,10 @@
+#! /usr/bin/env python3
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# TASST - Test A Simple Socket Transport
+#
+# test/tasst/__init.py__ - Python library code useful for test cases
+#
+# Copyright Red Hat
+# Author: David Gibson <david@gibson.dropbear.id.au>
--
2.51.0
next prev parent reply other threads:[~2025-10-02 7:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 7:57 [PATCH 0/3] RFC: Preview of " David Gibson
2025-10-02 7:57 ` David Gibson [this message]
2025-10-02 7:57 ` [PATCH 2/3] test: Add some missing quoting in exeter runner David Gibson
2025-10-02 7:57 ` [PATCH 3/3] test: Re-implement pasta NDP tests using tunbridge & exeter David Gibson
2025-10-02 7:57 ` [PATCH 0/3] RFC: Preview of tunbridge based tests David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251002075708.461931-2-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).