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 <david(a)gibson.dropbear.id.au> --- 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