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=MgjSCVH3; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id E9DF15A0262 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=lsyM6POxAP71etsy2NEZqiEUAE6k9gtO6PqTne2kiF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MgjSCVH30S8A68C5VQpl17hOIq06GhdxQXWHaL3ay0aPSAElfgEx+49BG5nn1i9hr DoV+qIhDi7xSOh2BWQ5v2fNaQUZjjZCYNhMG5oUB9JNp2nX9YwkZc6wZuZhvJI/v8f lr+21+aHEQA+Ccf8vrNcf6Y3ITyDQsFh18hJi+mquPcIAN/LRiFi9cHHfc7tIuWOYf CiVn5Fl3SR9CcTPewRZMCHlhCPHAMxEAhF+XPjIDcK21SvjiLPyHASPLLNGng4oNFU rudiaLn/zVcgyOE+3lX+ho512KdZodp/g6YBtui5muKgzfXXevpG0PAy3Vm4jRh4yJ b2in0WM1q3naw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4WsYyw59vZz4x82; Mon, 26 Aug 2024 12:09:44 +1000 (AEST) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v3 02/15] test: Adjust how we invoke tests with run_avocado Date: Mon, 26 Aug 2024 12:09:29 +1000 Message-ID: <20240826020942.545155-3-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: HPCDFGXO6D5GZ6652PHOOB6SRQKALAFM X-Message-ID-Hash: HPCDFGXO6D5GZ6652PHOOB6SRQKALAFM 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: Currently the Avocado test cases expect to be run from the base dir of the passt repo. At least for the time being, it turns out to be more convenient to structure the tests to run from the test/ subdirectory. So, adjust them to do so. We make some changes to run_avocado to work better with this too: * It appeared to have one too many os.path.dirname() calls, so it set repo_root_path to the parent of the passt tree, rather than the tree itself * We add an os.chdir(), so the tests will be invoked from the test directory regardles of where we invoke run_avocado * We adjust the runner.identifier config parameter so we get distinct (although very verbose) names for the more complex tests we're going to add. Signed-off-by: David Gibson --- test/avocado/static_checkers.json | 8 ++------ test/run_avocado | 12 +++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/test/avocado/static_checkers.json b/test/avocado/static_checkers.json index 5fae43ed..480b2461 100644 --- a/test/avocado/static_checkers.json +++ b/test/avocado/static_checkers.json @@ -2,15 +2,11 @@ { "kind": "exec-test", "uri": "make", - "args": [ - "clang-tidy" - ] + "args": ["-C", "..", "clang-tidy"] }, { "kind": "exec-test", "uri": "make", - "args": [ - "cppcheck" - ] + "args": ["-C", "..", "cppcheck"] } ] diff --git a/test/run_avocado b/test/run_avocado index 37db17c3..2c8822c6 100755 --- a/test/run_avocado +++ b/test/run_avocado @@ -31,14 +31,16 @@ from avocado.core.suite import TestSuite def main(): - repo_root_path = os.path.abspath( - os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - ) + repo_root_path = os.path.dirname(os.path.dirname(__file__)) + test_root_path = os.path.join(repo_root_path, "test") + + os.chdir(test_root_path) + config = { "resolver.references": [ - os.path.join(repo_root_path, "test", "avocado", "static_checkers.json") + os.path.join(test_root_path, "avocado", "static_checkers.json") ], - "runner.identifier_format": "{args[0]}", + "runner.identifier_format": "{args}", } suite = TestSuite.from_config(config, name="static_checkers") with Job(config, [suite]) as j: -- 2.46.0