public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>, passt-dev@passt.top
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v5 1/4] test: Extend test scripts to allow running exeter tests.
Date: Wed, 20 Aug 2025 20:54:53 +1000	[thread overview]
Message-ID: <20250820105456.1281906-2-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20250820105456.1281906-1-david@gibson.dropbear.id.au>

Introduce some trivial testcases based on the exeter library.  These run
passt and pasta with --help and --version options.  Extend our test
scripts to run these tests.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 test/.gitignore     |  1 +
 test/Makefile       |  5 +++-
 test/lib/exeter     | 56 +++++++++++++++++++++++++++++++++++++++++++++
 test/run            |  9 +++++++-
 test/smoke/smoke.sh | 27 ++++++++++++++++++++++
 5 files changed, 96 insertions(+), 2 deletions(-)
 create mode 100644 test/lib/exeter
 create mode 100755 test/smoke/smoke.sh

diff --git a/test/.gitignore b/test/.gitignore
index 3573444f..cf48b885 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -11,3 +11,4 @@ nstool
 rampstream
 guest-key
 guest-key.pub
+/exeter/
diff --git a/test/Makefile b/test/Makefile
index bf63db87..332f3f3e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -50,7 +50,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 = mbuto podman \
+DOWNLOAD_ASSETS = exeter mbuto podman \
 	$(DEBIAN_IMGS) $(FEDORA_IMGS) $(OPENSUSE_IMGS) $(UBUNTU_IMGS)
 TESTDATA_ASSETS = small.bin big.bin medium.bin \
 	rampstream
@@ -70,6 +70,9 @@ assets: $(ASSETS)
 pull-%: %
 	git -C $* pull
 
+exeter:
+	git clone https://gitlab.com/dgibson/exeter.git
+
 mbuto:
 	git clone git://mbuto.sh/mbuto
 
diff --git a/test/lib/exeter b/test/lib/exeter
new file mode 100644
index 00000000..e381cc2d
--- /dev/null
+++ b/test/lib/exeter
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+#  for qemu/UNIX domain socket mode
+#
+# PASTA - Pack A Subtle Tap Abstraction
+#  for network namespace/tap device mode
+#
+# test/lib/exeter - Run exeter tests within the rest of passt's tests
+#
+# Copyright Red Hat
+# Author: David Gibson <david@gibson.dropbear.id.au>
+
+EXETOOL="$BASEPATH/exeter/exetool/exetool"
+
+# is_exeter() - Determine if a test file is an exeter program
+# $@:	Command line to invoke test program
+is_exeter() {
+	$EXETOOL probe -- "$@"
+}
+
+# exeter() - Run each test in an exeter program, logging each test separately
+# $@:	Command line to invoke exeter test program
+exeter() {
+	STATESETUP="${STATEBASE}/$1"
+	mkdir -p "${STATESETUP}"
+
+	context_setup_host host
+	layout_host
+
+	cd test
+
+	__ntests=$("$@" --list | wc -l)
+	if [ $? != 0 ]; then
+		info "Failed to get exeter manifest for $@"
+		pause_continue \
+			"Press any key to pause test session"		\
+			"Resuming in "					\
+			"Paused, press any key to continue"		\
+			5
+		return
+	fi
+
+	status_file_start "$* (exeter)" ${__ntests}
+
+	for __testid in $("$@" --list); do
+		status_test_start "${__testid}"
+		context_run host "$@" "${__testid}" && status_test_ok || status_test_fail
+	done
+
+	cd ..
+
+	teardown_context_watch ${PANE_HOST} host
+}
diff --git a/test/run b/test/run
index f73c3119..745a09fa 100755
--- a/test/run
+++ b/test/run
@@ -53,6 +53,7 @@ COMMIT="$(git log --oneline --no-decorate -1)"
 . lib/layout_ugly
 . lib/test
 . lib/video
+. lib/exeter
 
 # cleanup() - Remove temporary files
 cleanup() {
@@ -67,6 +68,8 @@ run() {
 	perf_init
 	[ ${CI} -eq 1 ]   && video_start ci
 
+	exeter smoke/smoke.sh
+
 	setup build
 	test build/all
 	test build/cppcheck
@@ -223,6 +226,10 @@ run_selected() {
 
 	__setup=
 	for __test; do
+                if is_exeter "test/${__test}"; then
+                        exeter "${__test}"
+                        continue
+                fi
 		# HACK: the migrate tests need the setup repeated for
 		#       each test
 		if [ "${__test%%/*}" != "${__setup}" -o		\
@@ -234,7 +241,7 @@ run_selected() {
 
 		test "${__test}"
 	done
-	teardown "${__setup}"
+	[ -n "${__setup}" ] && teardown "${__setup}"
 
 	log "PASS: ${STATUS_PASS}, FAIL: ${STATUS_FAIL}, SKIPPED: ${STATUS_SKIPPED}"
 
diff --git a/test/smoke/smoke.sh b/test/smoke/smoke.sh
new file mode 100755
index 00000000..b01c7c89
--- /dev/null
+++ b/test/smoke/smoke.sh
@@ -0,0 +1,27 @@
+#! /bin/sh
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+#  for qemu/UNIX domain socket mode
+#
+# PASTA - Pack A Subtle Tap Abstraction
+#  for network namespace/tap device mode
+#
+# test/smoke/smoke.sh - Basic smoke tests
+#
+# Copyright Red Hat
+# Author: David Gibson <david@gibson.dropbear.id.au>
+
+. $(dirname $0)/../exeter/sh/exeter.sh
+
+PASST=$(dirname $0)/../../passt
+PASTA=$(dirname $0)/../../pasta
+
+exeter_register passt_version $PASST --version
+exeter_register pasta_version $PASTA --version
+
+exeter_register passt_help $PASST --help
+exeter_register pasta_help $PASTA --help
+
+exeter_main "$@"
-- 
@@ -0,0 +1,27 @@
+#! /bin/sh
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# PASST - Plug A Simple Socket Transport
+#  for qemu/UNIX domain socket mode
+#
+# PASTA - Pack A Subtle Tap Abstraction
+#  for network namespace/tap device mode
+#
+# test/smoke/smoke.sh - Basic smoke tests
+#
+# Copyright Red Hat
+# Author: David Gibson <david@gibson.dropbear.id.au>
+
+. $(dirname $0)/../exeter/sh/exeter.sh
+
+PASST=$(dirname $0)/../../passt
+PASTA=$(dirname $0)/../../pasta
+
+exeter_register passt_version $PASST --version
+exeter_register pasta_version $PASTA --version
+
+exeter_register passt_help $PASST --help
+exeter_register pasta_help $PASTA --help
+
+exeter_main "$@"
-- 
2.50.1


  reply	other threads:[~2025-08-20 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-20 10:54 [PATCH v5 0/4] RFC: New proof-of-concept based exeter tests David Gibson
2025-08-20 10:54 ` David Gibson [this message]
2025-08-20 10:54 ` [PATCH v5 2/4] test: Run static checkers as " David Gibson
2025-08-20 10:54 ` [PATCH v5 3/4] test: Convert build tests to exeter David Gibson
2025-08-20 10:54 ` [PATCH v5 4/4] test: Allow exeter & podman tests to be parallel executed with BATS David Gibson
2025-08-20 20:40 ` [PATCH v5 0/4] RFC: New proof-of-concept based exeter tests Stefano Brivio
2025-08-21  2:48   ` David Gibson
2025-08-21 21:27     ` Stefano Brivio
2025-08-25  1:55       ` 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=20250820105456.1281906-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).