Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests for data_runtime images #38

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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']
Expand Down
33 changes: 15 additions & 18 deletions tests/functional/demos/test_demos_linux_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
51 changes: 17 additions & 34 deletions tests/functional/samples/test_samples_linux_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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': {
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down