Exemplo n.º 1
0
def pytest_configure(config):
    config.addinivalue_line(
        'markers',
        'hddl: run tests on HDDL device',
    )
    config.addinivalue_line(
        'markers',
        'vpu: run tests on VPU device',
    )
    config.addinivalue_line(
        'markers',
        'gpu: run tests on GPU device',
    )
    dist = config.getoption('--distribution')
    if dist in ('data_runtime', 'runtime', 'custom-no-omz', 'custom-no-cv'):
        log.info('Setting up runtime image dependencies')
        mount_root = pathlib.Path(config.getoption('--mount_root'))
        package_url = config.getoption('--package_url')
        image_os = config.getoption('--image_os')
        if (mount_root / 'openvino_dev').exists():
            log.info(
                'Directory for runtime testing dependency already exists, skipping dependency preparation'
            )
            return

        if not package_url:
            return

        mount_root.mkdir(parents=True, exist_ok=True)
        dev_package_url = package_url.replace('_runtime_', '_dev_')
        # Temporarily, until there is no dev package for these distros
        if image_os in ('ubuntu20', 'centos7', 'centos8'):
            dev_package_url = dev_package_url.replace(image_os, 'ubuntu18')
        if package_url.startswith(('http://', 'https://', 'ftp://')):
            if 'win' in image_os:
                dldt_package = 'dldt.zip'
            else:
                dldt_package = 'dldt.tgz'
            log.info('Downloading dependent package...')
            download_file(
                dev_package_url,
                filename=mount_root / dldt_package,
                parents_=True,
                exist_ok_=True,
            )
            log.info('Extracting dependent package...')
            unzip_file(str(mount_root / dldt_package),
                       str(mount_root / 'openvino_dev'))
            log.info('Dependent package downloaded and extracted')
        else:
            dev_package_archive = pathlib.Path(dev_package_url)
            if dev_package_archive.exists():
                unzip_file(str(dev_package_archive),
                           str(mount_root / 'openvino_dev'))
                log.info('Dependent package extracted')
            else:
                err_msg = f"""Provided path of the dependent package should be an http/https/ftp access scheme
                                or a local file in the project location as dependent package: {package_url}"""
                log.error(err_msg)
                raise FailedTest(err_msg)
Exemplo n.º 2
0
 def test_dive_windows(self, image):
     location = pathlib.Path(__file__).parent
     dive_zip_file = location / 'dive.zip'
     download_file(DIVE_URL['windows'], dive_zip_file)
     unzip_file(str(dive_zip_file), str(location))
     dive_file = location / 'dive.exe'
     cmd_line = [str(dive_file), '--ci', image]
     process = subprocess.run(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False)  # nosec
     if process.returncode != 0:
         pytest.fail(f'Linter dive issues: {process.stdout.decode()}')
     else:
         print(f'Linter dive output: {process.stdout.decode()}')