From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 587365A031C for ; Mon, 05 Aug 2024 14:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1722861425; bh=2KCy9rsYeG5ef2rPHonnZ5wIhYVKayiRS74Hr6ChevI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjr7iTfSbhSd4D7AaKgeJx1LQ43X2Hoqf6v7NJkmZ2A0QwRI06bxBlkzkTDHHkQwh 904CBV/Gyll0pHxBU9USpY9i/+FrEBJWRVGeFB/fVnIIn7Q8NdvJCZ0P99oMjev5lr NX/EWmk4t2g4Oj8yyOG2w1mfPHL/3UoNp6EYbMJ5S/Cz0WhSEPiTQyMxgfyjeuF66U MAZ+Elh926m9h+Mu6BcYFPOYo/35el4/pbyNN+GekWQZKjleJqyYkvmQjVMndj+gHZ Ag/0YOECALcTpFJX7adkrGVpkJafBUVsXUbF30an5cBcVKa4nWWu4YUDKavZNxWlhK oSkoHhjijiLEQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WcwtT2FT8z4x6r; Mon, 5 Aug 2024 22:37:05 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 08/22] tasst: Introduce library of common test helpers Date: Mon, 5 Aug 2024 22:36:47 +1000 Message-ID: <20240805123701.1720730-9-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805123701.1720730-1-david@gibson.dropbear.id.au> References: <20240805123701.1720730-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: QU2CHNU7Z5YYXZ5GLR4IZ7E7TKGCGLD6 X-Message-ID-Hash: QU2CHNU7Z5YYXZ5GLR4IZ7E7TKGCGLD6 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: Cleber Rosa , 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: 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