From 96f6fed2eba4ddaa6912a5cdba41e80a91e47115 Mon Sep 17 00:00:00 2001 From: Qiu Tingting Date: Sun, 24 Jul 2022 16:17:13 +0800 Subject: Add precheck() fun Checking env before run testsuite is necessary. 1. Add common check in agl_test_base.py. It is currently an empty function. If necessary, common check sould be added. 2. Add ptest common check in agl_test_ptest_base.py. For ptest testsuite, check whether ptest-runner and run-ptest script exist. 3. Add special check in run_tests.py. For aio-stress testsuite, check whether compiled aio-stress script exists For bzip2 testsuite, check whether bzip2 cmd exists. Bug-AGL: SPEC-4345 Signed-off-by: Qiu Tingting Change-Id: Id7841c0337465266dd607403ecb3e1c4377c6198 --- tests/aio-stress/run_tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/aio-stress/run_tests.py') diff --git a/tests/aio-stress/run_tests.py b/tests/aio-stress/run_tests.py index fc966a1..e7e8b5c 100644 --- a/tests/aio-stress/run_tests.py +++ b/tests/aio-stress/run_tests.py @@ -1,5 +1,6 @@ import pytest import subprocess +import pathlib from plugins.agl_test_base import AGLBaseTest @@ -27,6 +28,11 @@ class AIOBase(AGLBaseTest): self.case_info_list = {'test_aiostress': ['test_aiostress', '', 'failed']} + def precheck(self): + run_test = self.get_workdir() + "/aio-stress" + path_script = pathlib.Path(run_test) + return super().precheck() and path_script.is_file() + @pytest.fixture(scope='module') def testbase(): #init instance for test @@ -42,6 +48,12 @@ def testbase(): def setup_module(testbase: AIOBase): print("setup function start") +def precheck(): + instance = AIOBase() + return instance.precheck() +skip_msg = "The current environment does not match the test requirements." +pytestmark = pytest.mark.skipif(precheck() == False, reason = skip_msg) + @pytest.mark.oss_default def test_aiostress(testbase: AIOBase): assert testbase.case_info_list['test_aiostress'][2] == 'passed' -- cgit 1.2.3-korg