diff options
-rw-r--r-- | tests/LTP/agl_test_ltp_base.py | 3 | ||||
-rw-r--r-- | tests/LTP/cve/run_tests.py | 2 | ||||
-rw-r--r-- | tests/LTP/math/run_tests.py | 2 | ||||
-rw-r--r-- | tests/LTP/posix_conformance_tests/run_tests.py | 9 | ||||
-rw-r--r-- | tests/LTP/syscalls/run_tests.py | 2 |
5 files changed, 15 insertions, 3 deletions
diff --git a/tests/LTP/agl_test_ltp_base.py b/tests/LTP/agl_test_ltp_base.py index 982e60d..06f3642 100644 --- a/tests/LTP/agl_test_ltp_base.py +++ b/tests/LTP/agl_test_ltp_base.py @@ -37,6 +37,9 @@ class LTPBase(AGLBaseTest): reObj = re.compile('^([\\w\\-]+)(\\s+)(\\w+)', re.MULTILINE) test_file = self.LTPTEST + self.test_name + path_obj = pathlib.Path(test_file) + if not path_obj.is_file(): + return case_list test_cases = open(test_file, 'r') line = test_cases.readline() while line: diff --git a/tests/LTP/cve/run_tests.py b/tests/LTP/cve/run_tests.py index f8e864f..8ed99e5 100644 --- a/tests/LTP/cve/run_tests.py +++ b/tests/LTP/cve/run_tests.py @@ -21,6 +21,8 @@ class CveBase(LTPBase): os.environ['KCONFIG_SKIP_CHECK'] = "True" instance = CveBase() +skip_msg = "The current environment does not match the test requirements." +pytestmark = pytest.mark.skipif(instance.precheck() == False, reason = skip_msg) test_case_list = instance.get_test_case_list() @pytest.fixture(scope='module') diff --git a/tests/LTP/math/run_tests.py b/tests/LTP/math/run_tests.py index 9f82915..e288534 100644 --- a/tests/LTP/math/run_tests.py +++ b/tests/LTP/math/run_tests.py @@ -7,6 +7,8 @@ class MathBase(LTPBase): super().__init__(test_name="math") instance = MathBase() +skip_msg = "The current environment does not match the test requirements." +pytestmark = pytest.mark.skipif(instance.precheck() == False, reason = skip_msg) test_case_list = instance.get_test_case_list() @pytest.fixture(scope='module') diff --git a/tests/LTP/posix_conformance_tests/run_tests.py b/tests/LTP/posix_conformance_tests/run_tests.py index 9d8405d..a081743 100644 --- a/tests/LTP/posix_conformance_tests/run_tests.py +++ b/tests/LTP/posix_conformance_tests/run_tests.py @@ -24,6 +24,8 @@ class Conformance_Base(LTPBase): case_name_list = [] # root path root_dir = pathlib.Path(self.LTPDIR + "./conformance/interfaces/") + if not root_dir.is_dir(): + return case_name_list # search case name by .run-test/.sh files without run.sh for child in root_dir.iterdir(): if child.is_file(): @@ -103,11 +105,12 @@ def local_precheck(): #write test suite info to file instance.write_skip_info() return output + +instance = Conformance_Base() skip_msg = "The current environment does not match the test requirements." -pytestmark = pytest.mark.skipif(local_precheck() == False, reason = skip_msg) +pytestmark = pytest.mark.skipif(local_precheck() == False or instance.precheck() == False, reason = skip_msg) -instance_paramtrize = Conformance_Base() -@pytest.mark.parametrize('case_name', instance_paramtrize.init_param_list()) +@pytest.mark.parametrize('case_name', instance.init_param_list()) def test_posix_conformance(testbase: Conformance_Base, case_name): testbase.run_case(case_name) diff --git a/tests/LTP/syscalls/run_tests.py b/tests/LTP/syscalls/run_tests.py index 37bd365..5421f28 100644 --- a/tests/LTP/syscalls/run_tests.py +++ b/tests/LTP/syscalls/run_tests.py @@ -40,6 +40,8 @@ class SyscallsBase(LTPBase): cwd=cwd_buf, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) instance = SyscallsBase() +skip_msg = "The current environment does not match the test requirements." +pytestmark = pytest.mark.skipif(instance.precheck() == False, reason = skip_msg) case_list = instance.get_test_case_list() @pytest.fixture(scope='module') |