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=202408 header.b=Biea8MPg; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id C64625A004F for ; Mon, 26 Aug 2024 04:09:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202408; t=1724638184; bh=L8PRBNO2la0mtfNrXE+e4TpCSqSiqgtQAgJ5j9XeB24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Biea8MPg8aMwZmn8AmxXfx5O94QR8VW6pyc0AH+T5zAxtOqT1F+1La+G45itWIUjN EB3AiCkGRLj/LCHL17vV3NbW08YujJiVN09QLW0nrX18bLp7QaSgchrRINgsGbV5vP IcjP+9/WdZfGaZbeqmc2eC3KDYUneRGyA+pKNYk2f/b6X7yfztOPMXC2XFsDjetZ7o aMtNU5ShmzYVJDbZj9M7jIEiThoivUmErshxIC9s0k2N36Ls+zGekzAnVqPDLMxFbH O5yyKSL1ItskDKBPfe1wCmu6nygA8zXPO6KbgbmugCyWgYIFtMfbuptqrbuUqkhXxV QY1CApBnIL1Ag== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WsYyw5HJ9z4x81; Mon, 26 Aug 2024 12:09:44 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v3 03/15] test: Extend make targets to run Avocado tests Date: Mon, 26 Aug 2024 12:09:30 +1000 Message-ID: <20240826020942.545155-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240826020942.545155-1-david@gibson.dropbear.id.au> References: <20240826020942.545155-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 67PW4PHMEUNGUZ4B75TZSR65QGQYN5BW X-Message-ID-Hash: 67PW4PHMEUNGUZ4B75TZSR65QGQYN5BW 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: Add a new 'avocado' target to the test/ Makefile, which will install avocado into a Python venv, and run the Avocado based tests with it. Signed-off-by: David Gibson --- test/.gitignore | 1 + test/Makefile | 17 +++++++++++++++++ test/run_avocado | 9 +++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/test/.gitignore b/test/.gitignore index 6dd4790b..a79d5b6f 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -10,3 +10,4 @@ QEMU_EFI.fd nstool guest-key guest-key.pub +/venv/ diff --git a/test/Makefile b/test/Makefile index 35a3b559..4bf971f7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -63,6 +63,13 @@ LOCAL_ASSETS = mbuto.img mbuto.mem.img podman/bin/podman QEMU_EFI.fd \ ASSETS = $(DOWNLOAD_ASSETS) $(LOCAL_ASSETS) +AVOCADO_JOBS = avocado/static_checkers.json + +PYTHON = python3 +VENV = venv +PIP = $(VENV)/bin/pip3 +RUN_AVOCADO = $(VENV)/bin/python3 run_avocado + CFLAGS = -Wall -Werror -Wextra -pedantic -std=c99 assets: $(ASSETS) @@ -116,6 +123,15 @@ medium.bin: big.bin: dd if=/dev/urandom bs=1M count=10 of=$@ +.PHONY: venv +venv: + $(PYTHON) -m venv $(VENV) + $(PIP) install avocado-framework + +.PHONY: avocado +avocado: venv + $(RUN_AVOCADO) all $(AVOCADO_JOBS) + check: assets ./run @@ -127,6 +143,7 @@ clean: rm -f $(LOCAL_ASSETS) rm -rf test_logs rm -f prepared-*.qcow2 prepared-*.img + rm -rf $(VENV) realclean: clean rm -rf $(DOWNLOAD_ASSETS) diff --git a/test/run_avocado b/test/run_avocado index 2c8822c6..9ee13a0f 100755 --- a/test/run_avocado +++ b/test/run_avocado @@ -34,15 +34,16 @@ def main(): repo_root_path = os.path.dirname(os.path.dirname(__file__)) test_root_path = os.path.join(repo_root_path, "test") + suitename = sys.argv[1] + references = [os.path.join(test_root_path, x) for x in sys.argv[2:]] + os.chdir(test_root_path) config = { - "resolver.references": [ - os.path.join(test_root_path, "avocado", "static_checkers.json") - ], + "resolver.references": references, "runner.identifier_format": "{args}", } - suite = TestSuite.from_config(config, name="static_checkers") + suite = TestSuite.from_config(config, name=suitename) with Job(config, [suite]) as j: return j.run() -- 2.46.0