Fix tests after update archive with models (#9063)

This commit is contained in:
Anton Romanov authored and GitHub committed 2021-12-08 14:53:18 +03:00
1 parent f734e7679b
commit 18d6fd3296
9 files changed
+31 -27

No files matched your search

@@ -135,6 +135,10 @@ def getting_samples_data_zip(url, samples_path, size_of_chunk=128):
print("\nExtracting of samples_smoke_tests_data.zip...")
with zipfile.ZipFile(samples_path, 'r') as samples_zip:
samples_zip.extractall(Environment.env['smoke_tests_path'])
nameFolder = str(Environment.env['samples_data_zip'])[Environment.env['samples_data_zip'].rfind('/')+1:][:-4]
smoke_tests_path = os.path.join(Environment.env['smoke_tests_path'])
if os.path.exists(os.path.join(smoke_tests_path,nameFolder)):
os.rename(os.path.join(smoke_tests_path, nameFolder), os.path.join(smoke_tests_path, 'samples_smoke_tests_data') )
if os.path.exists(samples_path):
print("\nRemoving samples_smoke_tests_data.zip...")
os.remove(samples_path)
@@ -169,10 +173,16 @@ class SamplesCommonTestClass():
@staticmethod
def reset_models_path(model):
if ('FP32' in os.path.split(model)[0] or 'FP16' in os.path.split(model)[0]):
model = search_model_path_recursively(config_key=Environment.env['icv_model_zoo_models'], model_name=model)
else:
model = os.path.join(Environment.env['public_models'], model)
pathList = model.split(os.sep)
modelName = pathList[len(pathList)-1]
precision = pathList[len(pathList)-2]
for root, subFolder, files in os.walk(Environment.env['models_path']):
for item in files:
if item.endswith(modelName) :
if precision in root :
model = str(os.path.join(root,item))
else :
model = os.path.join(Environment.env['models_path'], model)
return model
@staticmethod
@@ -328,10 +338,8 @@ class SamplesCommonTestClass():
def setup_class(cls):
getting_samples_data_zip(Environment.env['samples_data_zip'], Environment.env['samples_path'])
assert os.environ.get('IE_APP_PATH') is not None, "IE_APP_PATH environment variable is not specified!"
assert os.path.exists(Environment.env['public_models']), \
"Path for public models {} is not exist!".format(Environment.env['public_models'])
assert os.path.exists(Environment.env['icv_model_zoo_models']), \
"Path for icv models {} is not exist!".format(Environment.env['icv_model_zoo_models'])
assert os.path.exists(Environment.env['models_path']), \
"Path for public models {} is not exist!".format(Environment.env['models_path'])
assert os.path.exists(Environment.env['test_data']), \
"Path for test data {} is not exist!".format(Environment.env['test_data'])
cls.output_dir = Environment.env['out_directory']
+1 -1
View File
@@ -45,7 +45,7 @@ def pytest_configure(config):
try:
Environment.env = fix_env_conf(yaml.safe_load(env_conf))
# Check mandatory env variables:
mandatory_env_varibales = ['out_directory', 'public_models', 'icv_model_zoo_models', 'test_data', 'samples_data_zip', 'smoke_tests_path', 'samples_path']
mandatory_env_varibales = ['out_directory', 'models_path', 'test_data', 'samples_data_zip', 'smoke_tests_path', 'samples_path']
missing_variables = []
for variable in mandatory_env_varibales:
if variable not in Environment.env:
@@ -1,9 +1,8 @@
out_directory: ${WORKSPACE}/out
public_models: ${SHARE}/models/public/
icv_model_zoo_models: ${SHARE}/models/omz_models/
models_path: ${SHARE}/models/
test_data: ${SHARE}/validation_set/
#Performance data:
perf_result_path: ${SHARE}/validation_set/performance_result/
samples_data_zip: "https://storage.openvinotoolkit.org/repositories/openvino/ci_dependencies/test/samples_smoke_tests_data.zip"
samples_data_zip: "https://storage.openvinotoolkit.org/repositories/openvino/ci_dependencies/test/2021.4/samples_smoke_tests_data_2021.4.zip"
smoke_tests_path: ${WORKSPACE}/tests/smoke_tests
samples_path: ${WORKSPACE}/tests/smoke_tests/samples_smoke_tests_data.zip
@@ -21,7 +21,7 @@ log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=s
test_data_fp32_async = get_tests \
(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1', 'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'batch': [1],
'sample_type': ['C++', 'Python'],
'd': ['CPU'],
@@ -33,7 +33,7 @@ test_data_fp32_async = get_tests \
test_data_fp32_sync = get_tests \
(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1', 'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'batch': [1],
'sample_type': ['C++', 'Python'],
'd': ['CPU'],
@@ -21,7 +21,7 @@ from common.samples_common_test_clas import get_tests
log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout)
test_data_fp32 = get_tests(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1', 'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'nt': ['1'],
'sample_type': ['C++','Python'],
'batch': [1, 2, 4],
@@ -30,7 +30,7 @@ test_data_fp32 = get_tests(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')]
)
test_data_fp16 = get_tests(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1', 'caffe_squeezenet_v1_1_FP16_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'nt': ['1'],
'sample_type': ['C++','Python'],
'batch': [1, 2, 4],
@@ -26,15 +26,13 @@ import shutil
log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout)
test_data_fp32 = get_tests(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1',
'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'd': ['CPU'],
'sample_type': ['C++', 'C']},
use_device=['d'])
test_data_fp32_unicode = get_tests(cmd_params={'i': [os.path.join('227x227', 'dog.bmp')],
'm': [os.path.join('squeezenet1.1',
'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'd': ['CPU'],
'sample_type': ['C++', 'C']},
use_device=['d'])
@@ -91,8 +89,8 @@ class TestHello(SamplesCommonTestClass):
# Copy files
shutil.copy(Path(Environment.env['test_data']) / Path(param['i']), tmp_image_dir)
shutil.copy(Path(Environment.env['public_models']) / Path(param['m']), tmp_model_dir)
shutil.copy(Path(Environment.env['public_models']) / Path(param['m'].replace('.xml', '.bin')), tmp_model_dir)
shutil.copy(Path(Environment.env['models_path']) / 'public' / Path(param['m']), tmp_model_dir)
shutil.copy(Path(Environment.env['models_path']) / 'public' / Path(param['m'].replace('.xml', '.bin')), tmp_model_dir)
image_path = tmp_image_dir / Path(param['i']).name
original_image_name = image_path.name.split(sep='.')[0]
@@ -21,7 +21,7 @@ from common.samples_common_test_clas import SamplesCommonTestClass
log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout)
test_data_fp32 = get_tests(cmd_params={'i': [os.path.join('224x224', 'dog6.yuv')],
'm': [os.path.join('squeezenet1.1', 'caffe_squeezenet_v1_1_FP32_batch_1_seqlen_[1]_v10.xml')],
'm': [os.path.join('squeezenet1.1', 'FP32', 'squeezenet1.1.xml')],
'size': ['224x224'],
'sample_type': ['C++', 'C'],
'd': ['CPU']},
@@ -21,8 +21,7 @@ from common.specific_samples_parsers import parse_hello_reshape_ssd
log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout)
test_data_fp32 = get_tests(cmd_params={'i': [os.path.join('500x500', 'cat.bmp')],
'm': [os.path.join('ssd300',
'caffe_ssd_300_FP32_v10.xml')],
'm': [os.path.join('ssd512', 'FP32', 'ssd512.xml')],
'd': ['CPU'],
'batch': [1, 2, 4]}, use_device=['d'], use_batch=True
)
@@ -21,7 +21,7 @@ from common.common_utils import parse_avg_err
log.basicConfig(format="[ %(levelname)s ] %(message)s", level=log.INFO, stream=sys.stdout)
test_data_nthreads = get_tests(cmd_params={'i': [os.path.join('ark', 'dev93_10.ark')],
'm': [os.path.join('FP32', 'wsj_dnn5b.xml')],
'm': [os.path.join('wsj', 'FP32', 'wsj_dnn5b.xml')],
'bs': [1, 2],
'o': ['res_output.ark'],
'r': [os.path.join('ark', 'dev93_scores_10.ark')],
@@ -32,7 +32,7 @@ test_data_nthreads = get_tests(cmd_params={'i': [os.path.join('ark', 'dev93_10.a
)
test_data_nthreads_negative = get_tests(cmd_params={'i': [os.path.join('ark', 'dev93_10.ark')],
'm': [os.path.join('FP32', 'wsj_dnn5b.xml')],
'm': [os.path.join('wsj', 'FP32', 'wsj_dnn5b.xml')],
'bs': [1],
'o': ['res_output.ark'],
'r': [os.path.join('ark', 'dev93_scores_10.ark')],