diff --git a/tests/conftest.py b/tests/conftest.py index 694221d1..469f849a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -38,7 +38,7 @@ def pytest_configure(config): 'markers', 'gpu: run tests on GPU device', ) dist = config.getoption('--distribution') - if dist == 'runtime': + if dist.endswith('runtime'): log.info('Setting up runtime image dependencies') mount_root = pathlib.Path(config.getoption('--mount_root')) package_url = config.getoption('--package_url') @@ -137,6 +137,17 @@ def docker_api(): return DockerAPI() +@pytest.fixture(scope='session') +def dev_root(request): + openvino_dev_path = pathlib.Path(request.config.getoption('--mount_root')) / 'openvino_dev' + dev_root_path = openvino_dev_path.iterdir().__next__() + if dev_root_path.exists() and sum(f.stat().st_size for f in openvino_dev_path.rglob('*')) < 10000000: + pytest.skip(f'The test was skipped because the mount dependencies folder was not removed completely. ' + f'Try to remove it manually via "sudo rm -r {openvino_dev_path}"') + + return dev_root_path + + def switch_container_engine(engine): """Switch Windows docker Engine to -SwitchLinuxEngine or -SwitchWindowsEngine""" cmd_line = ['cmd', '/c', 'where', 'docker'] diff --git a/tests/functional/demos/test_demos_linux_runtime.py b/tests/functional/demos/test_demos_linux_runtime.py index 9f761d95..2f794665 100644 --- a/tests/functional/demos/test_demos_linux_runtime.py +++ b/tests/functional/demos/test_demos_linux_runtime.py @@ -8,10 +8,9 @@ @pytest.mark.usefixtures('_is_image_os', '_is_distribution', '_is_package_url_specified') @pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7'], indirect=True) -@pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) -class TestDemosLinuxRuntime: - def test_detection_ssd_python_cpu(self, tester, image, mount_root, sample_name): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() +@pytest.mark.parametrize('_is_distribution', ['data_runtime'], indirect=True) +class TestDemosLinuxDataRuntime: + def test_detection_ssd_python_cpu(self, tester, image, dev_root, sample_name): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -39,8 +38,7 @@ def test_detection_ssd_python_cpu(self, tester, image, mount_root, sample_name): ) @pytest.mark.gpu - def test_detection_ssd_python_gpu(self, tester, image, mount_root, sample_name): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_detection_ssd_python_gpu(self, tester, image, dev_root, sample_name): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -69,8 +67,7 @@ def test_detection_ssd_python_gpu(self, tester, image, mount_root, sample_name): ) @pytest.mark.vpu - def test_detection_ssd_python_vpu(self, tester, image, mount_root, sample_name): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_detection_ssd_python_vpu(self, tester, image, dev_root, sample_name): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -102,8 +99,7 @@ def test_detection_ssd_python_vpu(self, tester, image, mount_root, sample_name): ) @pytest.mark.hddl - def test_detection_ssd_python_hddl(self, tester, image, mount_root, sample_name): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_detection_ssd_python_hddl(self, tester, image, dev_root, sample_name): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -132,8 +128,12 @@ def test_detection_ssd_python_hddl(self, tester, image, mount_root, sample_name) ], self.test_detection_ssd_python_hddl.__name__, **kwargs, ) - def test_segmentation_python_cpu(self, tester, image, mount_root): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + +@pytest.mark.usefixtures('_is_image_os', '_is_distribution', '_is_package_url_specified') +@pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7'], indirect=True) +@pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) +class TestDemosLinuxRuntime: + def test_segmentation_python_cpu(self, tester, image, dev_root): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -163,8 +163,7 @@ def test_segmentation_python_cpu(self, tester, image, mount_root): ) @pytest.mark.gpu - def test_segmentation_python_gpu(self, tester, image, mount_root): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_segmentation_python_gpu(self, tester, image, dev_root): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -195,8 +194,7 @@ def test_segmentation_python_gpu(self, tester, image, mount_root): ) @pytest.mark.vpu - def test_segmentation_python_vpu(self, tester, image, mount_root): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_segmentation_python_vpu(self, tester, image, dev_root): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -231,8 +229,7 @@ def test_segmentation_python_vpu(self, tester, image, mount_root): @pytest.mark.hddl @pytest.mark.xfail(reason='38557 issue') - def test_segmentation_python_hddl(self, tester, image, mount_root): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_segmentation_python_hddl(self, tester, image, dev_root): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', diff --git a/tests/functional/samples/test_samples_linux_runtime.py b/tests/functional/samples/test_samples_linux_runtime.py index d4629ea9..11aa0c09 100644 --- a/tests/functional/samples/test_samples_linux_runtime.py +++ b/tests/functional/samples/test_samples_linux_runtime.py @@ -19,8 +19,7 @@ def install_build_essential(image_os): @pytest.mark.parametrize('_is_image_os', ['ubuntu18', 'ubuntu20', 'centos7', 'centos8'], indirect=True) @pytest.mark.parametrize('_is_distribution', ['runtime'], indirect=True) class TestSamplesLinuxRuntime: - def test_hello_classification_cpp_cpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_classification_cpp_cpu(self, tester, image, dev_root, image_os): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -64,8 +63,7 @@ def test_hello_classification_cpp_cpu(self, tester, image, mount_root, image_os) ) @pytest.mark.gpu - def test_hello_classification_cpp_gpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_classification_cpp_gpu(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -110,8 +108,7 @@ def test_hello_classification_cpp_gpu(self, tester, image, mount_root, image_os) ) @pytest.mark.vpu - def test_hello_classification_cpp_vpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_classification_cpp_vpu(self, tester, image, dev_root, image_os): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -159,8 +156,7 @@ def test_hello_classification_cpp_vpu(self, tester, image, mount_root, image_os) ) @pytest.mark.hddl - def test_hello_classification_cpp_hddl(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_classification_cpp_hddl(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -207,8 +203,7 @@ def test_hello_classification_cpp_hddl(self, tester, image, mount_root, image_os @pytest.mark.usefixtures('_min_product_version') @pytest.mark.parametrize('_min_product_version', ['2021.2'], indirect=True) - def test_hello_classification_cpp_fail(self, tester, image, mount_root, image_os, caplog): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_classification_cpp_fail(self, tester, image, dev_root, image_os, caplog): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -251,8 +246,7 @@ def test_hello_classification_cpp_fail(self, tester, image, mount_root, image_os if 'Sample supports topologies with 1 output only' not in caplog.text: pytest.fail('Sample supports topologies with 1 output only') - def test_hello_reshape_cpp_cpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_reshape_cpp_cpu(self, tester, image, dev_root, image_os): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -292,8 +286,7 @@ def test_hello_reshape_cpp_cpu(self, tester, image, mount_root, image_os): ) @pytest.mark.gpu - def test_hello_reshape_cpp_gpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_reshape_cpp_gpu(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -334,8 +327,7 @@ def test_hello_reshape_cpp_gpu(self, tester, image, mount_root, image_os): ) @pytest.mark.vpu - def test_hello_reshape_cpp_vpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_reshape_cpp_vpu(self, tester, image, dev_root, image_os): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -379,8 +371,7 @@ def test_hello_reshape_cpp_vpu(self, tester, image, mount_root, image_os): ) @pytest.mark.hddl - def test_hello_reshape_cpp_hddl(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_hello_reshape_cpp_hddl(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -421,8 +412,7 @@ def test_hello_reshape_cpp_hddl(self, tester, image, mount_root, image_os): ], self.test_hello_reshape_cpp_hddl.__name__, **kwargs, ) - def test_object_detection_cpp_cpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_object_detection_cpp_cpu(self, tester, image, dev_root, image_os): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -459,8 +449,7 @@ def test_object_detection_cpp_cpu(self, tester, image, mount_root, image_os): ) @pytest.mark.gpu - def test_object_detection_cpp_gpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_object_detection_cpp_gpu(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -498,8 +487,7 @@ def test_object_detection_cpp_gpu(self, tester, image, mount_root, image_os): ) @pytest.mark.vpu - def test_object_detection_cpp_vpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_object_detection_cpp_vpu(self, tester, image, dev_root, image_os): kwargs = { 'device_cgroup_rules': ['c 189:* rmw'], 'mem_limit': '3g', @@ -540,8 +528,7 @@ def test_object_detection_cpp_vpu(self, tester, image, mount_root, image_os): ) @pytest.mark.hddl - def test_object_detection_cpp_hddl(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_object_detection_cpp_hddl(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g', @@ -579,8 +566,7 @@ def test_object_detection_cpp_hddl(self, tester, image, mount_root, image_os): ], self.test_object_detection_cpp_hddl.__name__, **kwargs, ) - def test_classification_async_cpp_cpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_classification_async_cpp_cpu(self, tester, image, dev_root, image_os): kwargs = { 'mem_limit': '3g', 'volumes': { @@ -624,8 +610,7 @@ def test_classification_async_cpp_cpu(self, tester, image, mount_root, image_os) ) @pytest.mark.gpu - def test_classification_async_cpp_gpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_classification_async_cpp_gpu(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -670,8 +655,7 @@ def test_classification_async_cpp_gpu(self, tester, image, mount_root, image_os) ) @pytest.mark.vpu - def test_classification_async_cpp_vpu(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_classification_async_cpp_vpu(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/dri:/dev/dri'], 'mem_limit': '3g', @@ -719,8 +703,7 @@ def test_classification_async_cpp_vpu(self, tester, image, mount_root, image_os) ) @pytest.mark.hddl - def test_classification_async_cpp_hddl(self, tester, image, mount_root, image_os): - dev_root = (pathlib.Path(mount_root) / 'openvino_dev').iterdir().__next__() + def test_classification_async_cpp_hddl(self, tester, image, dev_root, image_os): kwargs = { 'devices': ['/dev/ion:/dev/ion'], 'mem_limit': '3g',