From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202508 header.b=q1VjQArr; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id A78D05A0278 for ; Thu, 04 Sep 2025 04:50:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202508; t=1756954205; bh=YVyfOoiYMMp5wLoTIO3FddT2+p+6yOZ+Iafn62H20+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q1VjQArr1IKnYY2JPdE82m9LpvqP4nyMZQ7dXk4v9CdxVOVuTnDBuNXqIOIB6iUks q6aS+C9RcxgWzuOX8dIzW+vLg98OhkMOURjWQ9bxav8tqtVOnqgq7nBzvumQK1DTmP LR1RdRto+5yGe3Supo50jReDWFSBQjJUcZyHHWm3bSDwLbt67V5yUO1mWZNzy/ZIMN 9cvAzpfMqmbqJKxTd7tJzNRLvAMnGxscyP0iBr1qdnfC19D+i6tufutMWDfUEMdqNq 262UyuTvrzxd6ovDkC5CA4zqbmdcYM+f71Bo5lEP10sdMNVv0lxfUISguT71hZNnCG TKUd43IW06DrQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4cHP8s5SDgz4w23; Thu, 4 Sep 2025 12:50:05 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v7 1/4] test: Extend test scripts to allow running exeter tests. Date: Thu, 4 Sep 2025 12:50:01 +1000 Message-ID: <20250904025004.491185-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250904025004.491185-1-david@gibson.dropbear.id.au> References: <20250904025004.491185-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: CE2FAL4UFHHP5I6NGWB7M46LV2S4TOMI X-Message-ID-Hash: CE2FAL4UFHHP5I6NGWB7M46LV2S4TOMI X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- test/.gitignore | 1 + test/Makefile | 10 ++++++-- test/lib/exeter | 57 +++++++++++++++++++++++++++++++++++++++++++++ test/run | 9 ++++++- test/smoke/smoke.sh | 33 ++++++++++++++++++++++++++ 5 files changed, 107 insertions(+), 3 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..bfb58f27 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,6 +5,7 @@ # Copyright Red Hat # Author: David Gibson +EXETOOL = exeter/exetool/exetool WGET = wget -c DEBIAN_IMGS = debian-8.11.0-openstack-amd64.qcow2 \ @@ -50,14 +51,14 @@ 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 LOCAL_ASSETS = mbuto.img mbuto.mem.img podman/bin/podman QEMU_EFI.fd \ $(DEBIAN_IMGS:%=prepared-%) $(FEDORA_IMGS:%=prepared-%) \ $(UBUNTU_NEW_IMGS:%=prepared-%) \ - nstool guest-key guest-key.pub \ + nstool guest-key guest-key.pub $(EXETOOL) \ $(TESTDATA_ASSETS) ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS) @@ -70,6 +71,11 @@ assets: $(ASSETS) pull-%: % git -C $* pull +exeter: + git clone https://gitlab.com/dgibson/exeter.git + +exeter/exetool/exetool: pull-exeter + mbuto: git clone git://mbuto.sh/mbuto diff --git a/test/lib/exeter b/test/lib/exeter new file mode 100644 index 00000000..dce4e49d --- /dev/null +++ b/test/lib/exeter @@ -0,0 +1,57 @@ +#!/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 + +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=$($EXETOOL 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 $($EXETOOL list -- "$@"); do + __desc="$($EXETOOL desc -- "$@" -- ${__testid})" + status_test_start "${__desc}" + 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..a642fb96 --- /dev/null +++ b/test/smoke/smoke.sh @@ -0,0 +1,33 @@ +#! /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 + +. $(dirname $0)/../exeter/sh/exeter.sh + +PASST=$(dirname $0)/../../passt +PASTA=$(dirname $0)/../../pasta + +exeter_register passt_version $PASST --version +exeter_set_description passt_version "Check passt --version works" + +exeter_register pasta_version $PASTA --version +exeter_set_description pasta_version "Check pasta --version works" + +exeter_register passt_help $PASST --help +exeter_set_description passt_help "Check passt --help works" + +exeter_register pasta_help $PASTA --help +exeter_set_description pasta_help "Check pasta --help works" + +exeter_main "$@" -- 2.51.0