[CAPI][TEST] remove testdata repository dependency (#16259)
* [CAPI][TEST] remove testdata repository dependency Change-Id: I93798d47bcf4abf69562f76aab1469498b4e9ee1 * SCI issue Change-Id: Ifb422fafdefe26be85a0ae8efdc1530f7f032079 * Apply TEST SUIT for C API tests Change-Id: Ic716cdb357060e1cbf989871ae39d006f2878632 * Fix issue for static build Change-Id: I5d33f23b48dcda4baf260553aa8d34e62c13c128
This commit is contained in:
parent
0145e538f5
commit
0ca3ccb7fb
@ -447,16 +447,10 @@ jobs:
|
||||
|
||||
- script: |
|
||||
$(RUN_PREFIX) $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-InferenceEngineCAPITests.xml
|
||||
env:
|
||||
DATA_PATH: $(MODELS_PATH)
|
||||
MODELS_PATH: $(MODELS_PATH)
|
||||
displayName: 'IE CAPITests'
|
||||
|
||||
- script: |
|
||||
$(RUN_PREFIX) $(INSTALL_TEST_DIR)/ov_capi_test --gtest_output=xml:$(INSTALL_TEST_DIR)/TEST-ov_capi_test.xml
|
||||
env:
|
||||
DATA_PATH: $(MODELS_PATH)
|
||||
MODELS_PATH: $(MODELS_PATH)
|
||||
displayName: 'OV CAPITests'
|
||||
|
||||
- task: CMake@1
|
||||
|
@ -315,16 +315,10 @@ jobs:
|
||||
|
||||
- script: |
|
||||
call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineCAPITests --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-InferenceEngineCAPITests.xml
|
||||
env:
|
||||
DATA_PATH: $(MODELS_PATH)
|
||||
MODELS_PATH: $(MODELS_PATH)
|
||||
displayName: 'IE CAPITests'
|
||||
|
||||
- script: |
|
||||
call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ov_capi_test --gtest_output=xml:$(INSTALL_TEST_DIR)\TEST-ov_capi_test.xml
|
||||
env:
|
||||
DATA_PATH: $(MODELS_PATH)
|
||||
MODELS_PATH: $(MODELS_PATH)
|
||||
displayName: 'OV CAPITests'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
|
@ -11,9 +11,7 @@ target_link_libraries(${TARGET_NAME} PRIVATE openvino_c commonTestUtils gtest_ma
|
||||
|
||||
target_compile_definitions(${TARGET_NAME}
|
||||
PRIVATE
|
||||
$<$<BOOL:${ENABLE_GAPI_PREPROCESSING}>:ENABLE_GAPI_PREPROCESSING>
|
||||
DATA_PATH=\"${DATA_PATH}\"
|
||||
MODELS_PATH=\"${MODELS_PATH}\")
|
||||
$<$<BOOL:${ENABLE_GAPI_PREPROCESSING}>:ENABLE_GAPI_PREPROCESSING>)
|
||||
|
||||
if(ENABLE_AUTO OR ENABLE_MULTI)
|
||||
add_dependencies(${TARGET_NAME} openvino_auto_plugin)
|
||||
@ -55,11 +53,6 @@ target_link_libraries(${TARGET_NAME} PRIVATE openvino_c openvino::util
|
||||
target_include_directories(${TARGET_NAME} PUBLIC
|
||||
$<BUILD_INTERFACE:${OPENVINO_API_SOURCE_DIR}/include>)
|
||||
|
||||
target_compile_definitions(${TARGET_NAME}
|
||||
PRIVATE
|
||||
DATA_PATH=\"${DATA_PATH}\"
|
||||
MODELS_PATH=\"${MODELS_PATH}\")
|
||||
|
||||
if(TARGET OpenCL::OpenCL)
|
||||
target_link_libraries(${TARGET_NAME} PRIVATE OpenCL::OpenCL)
|
||||
endif()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -6,18 +6,26 @@
|
||||
|
||||
namespace {
|
||||
|
||||
class ov_compiled_model : public ::testing::TestWithParam<std::string> {};
|
||||
class ov_compiled_model_test : public ov_capi_test_base {
|
||||
void SetUp() override {
|
||||
ov_capi_test_base::SetUp();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_compiled_model, ::testing::Values("CPU"));
|
||||
void TearDown() override {
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_inputs_size) {
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_compiled_model_test, ::testing::Values("CPU"));
|
||||
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_inputs_size) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -33,14 +41,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_inputs_size) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_input) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_input) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -57,14 +65,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_input) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_input_by_index) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_input_by_index) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -85,14 +93,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_input_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_input_by_name) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_input_by_name) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -113,7 +121,7 @@ TEST_P(ov_compiled_model, ov_compiled_model_input_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, set_and_get_property) {
|
||||
TEST_P(ov_compiled_model_test, set_and_get_property) {
|
||||
// It seems that all set_property() for CPU plugin are not implement in compiled_model.
|
||||
auto device_name = "MULTI:GPU,CPU";
|
||||
ov_core_t* core = nullptr;
|
||||
@ -128,7 +136,7 @@ TEST_P(ov_compiled_model, set_and_get_property) {
|
||||
}
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -152,14 +160,14 @@ TEST_P(ov_compiled_model, set_and_get_property) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, get_property) {
|
||||
TEST_P(ov_compiled_model_test, get_property) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -176,14 +184,14 @@ TEST_P(ov_compiled_model, get_property) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, create_compiled_model_with_property) {
|
||||
TEST_P(ov_compiled_model_test, create_compiled_model_with_property) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
const char* key = ov_property_key_hint_performance_mode;
|
||||
@ -201,14 +209,14 @@ TEST_P(ov_compiled_model, create_compiled_model_with_property) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_outputs_size) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_outputs_size) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -224,14 +232,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_outputs_size) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_output) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_output) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -248,14 +256,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_output) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_output_by_index) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_output_by_index) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -276,14 +284,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_output_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, ov_compiled_model_output_by_name) {
|
||||
TEST_P(ov_compiled_model_test, ov_compiled_model_output_by_name) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -291,7 +299,7 @@ TEST_P(ov_compiled_model, ov_compiled_model_output_by_name) {
|
||||
EXPECT_NE(nullptr, compiled_model);
|
||||
|
||||
ov_output_const_port_t* output_port = nullptr;
|
||||
OV_EXPECT_OK(ov_compiled_model_output_by_name(compiled_model, "fc_out", &output_port));
|
||||
OV_EXPECT_OK(ov_compiled_model_output_by_name(compiled_model, "relu", &output_port));
|
||||
EXPECT_NE(nullptr, output_port);
|
||||
|
||||
ov_shape_t shape;
|
||||
@ -304,14 +312,14 @@ TEST_P(ov_compiled_model, ov_compiled_model_output_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, get_runtime_model) {
|
||||
TEST_P(ov_compiled_model_test, get_runtime_model) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -328,14 +336,14 @@ TEST_P(ov_compiled_model, get_runtime_model) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, get_runtime_model_error_handling) {
|
||||
TEST_P(ov_compiled_model_test, get_runtime_model_error_handling) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -352,14 +360,14 @@ TEST_P(ov_compiled_model, get_runtime_model_error_handling) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, create_infer_request) {
|
||||
TEST_P(ov_compiled_model_test, create_infer_request) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -376,14 +384,14 @@ TEST_P(ov_compiled_model, create_infer_request) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_compiled_model, create_infer_request_error_handling) {
|
||||
TEST_P(ov_compiled_model_test, create_infer_request_error_handling) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
|
@ -22,10 +22,19 @@ TEST(ov_util, ov_get_error_info_check) {
|
||||
EXPECT_STREQ(res, str);
|
||||
}
|
||||
|
||||
class ov_core : public ::testing::TestWithParam<std::string> {};
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_core, ::testing::Values("CPU"));
|
||||
class ov_core_test : public ov_capi_test_base {
|
||||
public:
|
||||
void SetUp() override {
|
||||
ov_capi_test_base::SetUp();
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_create_with_config) {
|
||||
void TearDown() override {
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
};
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_core_test, ::testing::Values("CPU"));
|
||||
|
||||
TEST_P(ov_core_test, ov_core_create_with_config) {
|
||||
std::string plugins_xml = TestDataHelpers::generate_test_xml_file();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create_with_config(plugins_xml.c_str(), &core));
|
||||
@ -34,45 +43,45 @@ TEST(ov_core, ov_core_create_with_config) {
|
||||
TestDataHelpers::delete_test_xml_file();
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_create_with_no_config) {
|
||||
TEST_P(ov_core_test, ov_core_create_with_no_config) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_read_model) {
|
||||
TEST_P(ov_core_test, ov_core_read_model) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_model_free(model);
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_read_model_no_bin) {
|
||||
TEST_P(ov_core_test, ov_core_read_model_no_bin) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, nullptr, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), nullptr, &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_model_free(model);
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_read_model_from_memory) {
|
||||
TEST_P(ov_core_test, ov_core_read_model_from_memory) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
std::vector<uint8_t> weights_content(content_from_file(bin, true));
|
||||
std::vector<uint8_t> weights_content(content_from_file(bin_file_name.c_str(), true));
|
||||
|
||||
ov_tensor_t* tensor = nullptr;
|
||||
ov_shape_t shape;
|
||||
@ -81,7 +90,7 @@ TEST(ov_core, ov_core_read_model_from_memory) {
|
||||
OV_EXPECT_OK(ov_tensor_create_from_host_ptr(ov_element_type_e::U8, shape, weights_content.data(), &tensor));
|
||||
EXPECT_NE(nullptr, tensor);
|
||||
|
||||
std::vector<uint8_t> xml_content(content_from_file(xml, false));
|
||||
std::vector<uint8_t> xml_content(content_from_file(xml_file_name.c_str(), false));
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(
|
||||
ov_core_read_model_from_memory(core, reinterpret_cast<const char*>(xml_content.data()), tensor, &model));
|
||||
@ -93,14 +102,14 @@ TEST(ov_core, ov_core_read_model_from_memory) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_compile_model) {
|
||||
TEST_P(ov_core_test, ov_core_compile_model) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, nullptr, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), nullptr, &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -112,14 +121,14 @@ TEST_P(ov_core, ov_core_compile_model) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_compile_model_with_property) {
|
||||
TEST_P(ov_core_test, ov_core_compile_model_with_property) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, nullptr, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), nullptr, &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -138,14 +147,14 @@ TEST_P(ov_core, ov_core_compile_model_with_property) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_compile_model_with_property_invalid) {
|
||||
TEST_P(ov_core_test, ov_core_compile_model_with_property_invalid) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, nullptr, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), nullptr, &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
@ -159,21 +168,21 @@ TEST_P(ov_core, ov_core_compile_model_with_property_invalid) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_compile_model_from_file) {
|
||||
TEST_P(ov_core_test, ov_core_compile_model_from_file) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml, device_name.c_str(), 0, &compiled_model));
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml_file_name.c_str(), device_name.c_str(), 0, &compiled_model));
|
||||
EXPECT_NE(nullptr, compiled_model);
|
||||
|
||||
ov_compiled_model_free(compiled_model);
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_property_enum) {
|
||||
TEST_P(ov_core_test, ov_core_set_property_enum) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -186,7 +195,7 @@ TEST_P(ov_core, ov_core_set_property_enum) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_property_invalid_number_property_arguments) {
|
||||
TEST_P(ov_core_test, ov_core_set_property_invalid_number_property_arguments) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -209,7 +218,7 @@ TEST_P(ov_core, ov_core_set_property_invalid_number_property_arguments) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_property_enum_invalid) {
|
||||
TEST_P(ov_core_test, ov_core_set_property_enum_invalid) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -232,7 +241,7 @@ TEST_P(ov_core, ov_core_set_property_enum_invalid) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_and_get_property_enum) {
|
||||
TEST_P(ov_core_test, ov_core_set_and_get_property_enum) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -249,7 +258,7 @@ TEST_P(ov_core, ov_core_set_and_get_property_enum) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_and_get_property_bool) {
|
||||
TEST_P(ov_core_test, ov_core_set_and_get_property_bool) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -266,7 +275,7 @@ TEST_P(ov_core, ov_core_set_and_get_property_bool) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_and_get_property_bool_invalid) {
|
||||
TEST_P(ov_core_test, ov_core_set_and_get_property_bool_invalid) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -284,7 +293,7 @@ TEST_P(ov_core, ov_core_set_and_get_property_bool_invalid) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_get_property) {
|
||||
TEST_P(ov_core_test, ov_core_get_property) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -297,7 +306,7 @@ TEST_P(ov_core, ov_core_get_property) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_get_property_str) {
|
||||
TEST_P(ov_core_test, ov_core_set_get_property_str) {
|
||||
#ifdef __aarch64__
|
||||
GTEST_SKIP() << "Skip this test for ARM CPU for now, cause no string property supported";
|
||||
#endif
|
||||
@ -319,7 +328,7 @@ TEST_P(ov_core, ov_core_set_get_property_str) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_get_property_int) {
|
||||
TEST_P(ov_core_test, ov_core_set_get_property_int) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -337,7 +346,7 @@ TEST_P(ov_core, ov_core_set_get_property_int) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_property_int_invalid) {
|
||||
TEST_P(ov_core_test, ov_core_set_property_int_invalid) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -353,7 +362,7 @@ TEST_P(ov_core, ov_core_set_property_int_invalid) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_set_multiple_common_properties) {
|
||||
TEST_P(ov_core_test, ov_core_set_multiple_common_properties) {
|
||||
#ifdef __aarch64__
|
||||
GTEST_SKIP() << "Skip this test for ARM CPU for now, cause no string property supported";
|
||||
#endif
|
||||
@ -404,7 +413,7 @@ TEST_P(ov_core, ov_core_set_multiple_common_properties) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_get_available_devices) {
|
||||
TEST_P(ov_core_test, ov_core_get_available_devices) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
@ -416,7 +425,7 @@ TEST(ov_core, ov_core_get_available_devices) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_compiled_model_export_model) {
|
||||
TEST_P(ov_core_test, ov_compiled_model_export_model) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -429,17 +438,17 @@ TEST_P(ov_core, ov_compiled_model_export_model) {
|
||||
}
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml, device_name.c_str(), 0, &compiled_model));
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml_file_name.c_str(), device_name.c_str(), 0, &compiled_model));
|
||||
EXPECT_NE(nullptr, compiled_model);
|
||||
|
||||
std::string export_path = TestDataHelpers::generate_model_path("test_model", "exported_model.blob");
|
||||
std::string export_path = TestDataHelpers::get_exported_blob_file_name();
|
||||
OV_EXPECT_OK(ov_compiled_model_export_model(compiled_model, export_path.c_str()));
|
||||
|
||||
ov_compiled_model_free(compiled_model);
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_import_model) {
|
||||
TEST_P(ov_core_test, ov_core_import_model) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
|
||||
@ -453,10 +462,10 @@ TEST_P(ov_core, ov_core_import_model) {
|
||||
}
|
||||
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml, device_name.c_str(), 0, &compiled_model));
|
||||
OV_EXPECT_OK(ov_core_compile_model_from_file(core, xml_file_name.c_str(), device_name.c_str(), 0, &compiled_model));
|
||||
EXPECT_NE(nullptr, compiled_model);
|
||||
|
||||
std::string export_path = TestDataHelpers::generate_model_path("test_model", "exported_model.blob");
|
||||
std::string export_path = TestDataHelpers::get_exported_blob_file_name();
|
||||
OV_EXPECT_OK(ov_compiled_model_export_model(compiled_model, export_path.c_str()));
|
||||
ov_compiled_model_free(compiled_model);
|
||||
|
||||
@ -472,7 +481,7 @@ TEST_P(ov_core, ov_core_import_model) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_get_versions_by_device_name) {
|
||||
TEST_P(ov_core_test, ov_core_get_versions_by_device_name) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -495,14 +504,14 @@ const std::vector<std::wstring> test_unicode_postfix_vector = {L"unicode_Яㅎ
|
||||
L"그것이정당하다",
|
||||
L"АБВГДЕЁЖЗИЙ",
|
||||
L"СТУФХЦЧШЩЬЮЯ"};
|
||||
TEST(ov_core, ov_core_create_with_config_unicode) {
|
||||
TEST_P(ov_core_test, ov_core_create_with_config_unicode) {
|
||||
std::string plugins_xml = TestDataHelpers::generate_test_xml_file();
|
||||
ov_core_t* core = nullptr;
|
||||
|
||||
for (std::size_t index = 0; index < test_unicode_postfix_vector.size(); index++) {
|
||||
std::wstring postfix = L"_" + test_unicode_postfix_vector[index];
|
||||
std::wstring plugins_xml_ws = add_unicode_postfix_to_path(plugins_xml, postfix);
|
||||
ASSERT_EQ(true, copy_file(plugins_xml, plugins_xml_ws));
|
||||
std::wstring plugins_xml_ws = add_unicode_postfix_to_path(plugins_xml.c_str(), postfix);
|
||||
ASSERT_EQ(true, copy_file(plugins_xml.c_str(), plugins_xml_ws));
|
||||
|
||||
OV_EXPECT_OK(ov_core_create_with_config_unicode(plugins_xml_ws.c_str(), &core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
@ -512,7 +521,7 @@ TEST(ov_core, ov_core_create_with_config_unicode) {
|
||||
TestDataHelpers::delete_test_xml_file();
|
||||
}
|
||||
|
||||
TEST(ov_core, ov_core_read_model_unicode) {
|
||||
TEST_P(ov_core_test, ov_core_read_model_unicode) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
@ -520,11 +529,11 @@ TEST(ov_core, ov_core_read_model_unicode) {
|
||||
ov_model_t* model = nullptr;
|
||||
for (std::size_t index = 0; index < test_unicode_postfix_vector.size(); index++) {
|
||||
std::wstring postfix = L"_" + test_unicode_postfix_vector[index];
|
||||
std::wstring xml_ws = add_unicode_postfix_to_path(xml, postfix);
|
||||
std::wstring bin_ws = add_unicode_postfix_to_path(bin, postfix);
|
||||
std::wstring xml_ws = add_unicode_postfix_to_path(xml_file_name.c_str(), postfix);
|
||||
std::wstring bin_ws = add_unicode_postfix_to_path(bin_file_name.c_str(), postfix);
|
||||
|
||||
ASSERT_EQ(true, copy_file(xml, xml_ws));
|
||||
ASSERT_EQ(true, copy_file(bin, bin_ws));
|
||||
ASSERT_EQ(true, copy_file(xml_file_name.c_str(), xml_ws));
|
||||
ASSERT_EQ(true, copy_file(bin_file_name.c_str(), bin_ws));
|
||||
|
||||
OV_EXPECT_OK(ov_core_read_model_unicode(core, xml_ws.c_str(), bin_ws.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
@ -537,7 +546,7 @@ TEST(ov_core, ov_core_read_model_unicode) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST_P(ov_core, ov_core_compile_model_from_file_unicode) {
|
||||
TEST_P(ov_core_test, ov_core_compile_model_from_file_unicode) {
|
||||
auto device_name = GetParam();
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
@ -546,10 +555,10 @@ TEST_P(ov_core, ov_core_compile_model_from_file_unicode) {
|
||||
ov_compiled_model_t* compiled_model = nullptr;
|
||||
for (std::size_t index = 0; index < test_unicode_postfix_vector.size(); index++) {
|
||||
std::wstring postfix = L"_" + test_unicode_postfix_vector[index];
|
||||
std::wstring xml_ws = add_unicode_postfix_to_path(xml, postfix);
|
||||
std::wstring bin_ws = add_unicode_postfix_to_path(bin, postfix);
|
||||
ASSERT_EQ(true, copy_file(xml, xml_ws));
|
||||
ASSERT_EQ(true, copy_file(bin, bin_ws));
|
||||
std::wstring xml_ws = add_unicode_postfix_to_path(xml_file_name.c_str(), postfix);
|
||||
std::wstring bin_ws = add_unicode_postfix_to_path(bin_file_name.c_str(), postfix);
|
||||
ASSERT_EQ(true, copy_file(xml_file_name.c_str(), xml_ws));
|
||||
ASSERT_EQ(true, copy_file(bin_file_name.c_str(), bin_ws));
|
||||
|
||||
OV_EXPECT_OK(
|
||||
ov_core_compile_model_from_file_unicode(core, xml_ws.c_str(), device_name.c_str(), 0, &compiled_model));
|
||||
|
@ -30,7 +30,7 @@ inline void get_tensor_info(ov_model_t* model, bool input, char** name, ov_shape
|
||||
ov_output_const_port_free(port);
|
||||
}
|
||||
|
||||
class ov_infer_request : public ::testing::TestWithParam<std::string> {
|
||||
class ov_infer_request_test : public ov_capi_test_base {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
auto device_name = GetParam();
|
||||
@ -43,11 +43,12 @@ protected:
|
||||
infer_request = nullptr;
|
||||
input_const_port = nullptr;
|
||||
input_port = nullptr;
|
||||
ov_capi_test_base::SetUp();
|
||||
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
OV_EXPECT_OK(ov_model_const_input(model, &input_const_port));
|
||||
@ -81,6 +82,7 @@ protected:
|
||||
ov_compiled_model_free(compiled_model);
|
||||
ov_model_free(model);
|
||||
ov_core_free(core);
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
|
||||
public:
|
||||
@ -97,11 +99,11 @@ public:
|
||||
static bool ready;
|
||||
static std::condition_variable condVar;
|
||||
};
|
||||
bool ov_infer_request::ready = false;
|
||||
std::mutex ov_infer_request::m;
|
||||
std::condition_variable ov_infer_request::condVar;
|
||||
bool ov_infer_request_test::ready = false;
|
||||
std::mutex ov_infer_request_test::m;
|
||||
std::condition_variable ov_infer_request_test::condVar;
|
||||
|
||||
class ov_infer_request_ppp : public ::testing::TestWithParam<std::string> {
|
||||
class ov_infer_request_ppp : public ov_capi_test_base {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
auto device_name = GetParam();
|
||||
@ -118,11 +120,12 @@ protected:
|
||||
ov_layout_t* model_layout = nullptr;
|
||||
compiled_model = nullptr;
|
||||
infer_request = nullptr;
|
||||
ov_capi_test_base::SetUp();
|
||||
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
@ -182,6 +185,7 @@ protected:
|
||||
ov_preprocess_prepostprocessor_free(preprocess);
|
||||
ov_model_free(model);
|
||||
ov_core_free(core);
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
|
||||
public:
|
||||
@ -198,83 +202,83 @@ public:
|
||||
ov_preprocess_input_model_info_t* input_model;
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_infer_request, ::testing::Values("CPU"));
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_infer_request_test, ::testing::Values("CPU"));
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_infer_request_ppp, ::testing::Values("CPU"));
|
||||
|
||||
TEST_P(ov_infer_request, set_tensor) {
|
||||
TEST_P(ov_infer_request_test, set_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor(infer_request, in_tensor_name, input_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_input_tensor_by_index) {
|
||||
TEST_P(ov_infer_request_test, set_input_tensor_by_index) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_input_tensor_by_index(infer_request, 0, input_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_tensor_by_port) {
|
||||
TEST_P(ov_infer_request_test, set_tensor_by_port) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor_by_port(infer_request, input_port, input_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_tensor_by_const_port) {
|
||||
TEST_P(ov_infer_request_test, set_tensor_by_const_port) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor_by_const_port(infer_request, input_const_port, input_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_input_tensor) {
|
||||
TEST_P(ov_infer_request_test, set_input_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_input_tensor(infer_request, input_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_output_tensor_by_index) {
|
||||
TEST_P(ov_infer_request_test, set_output_tensor_by_index) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_output_tensor_by_index(infer_request, 0, &output_tensor));
|
||||
EXPECT_NE(nullptr, output_tensor);
|
||||
OV_EXPECT_OK(ov_infer_request_set_output_tensor_by_index(infer_request, 0, output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_output_tensor) {
|
||||
TEST_P(ov_infer_request_test, set_output_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_output_tensor_by_index(infer_request, 0, &output_tensor));
|
||||
EXPECT_NE(nullptr, output_tensor);
|
||||
OV_EXPECT_OK(ov_infer_request_set_output_tensor(infer_request, output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, set_tensor_error_handling) {
|
||||
TEST_P(ov_infer_request_test, set_tensor_error_handling) {
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_set_tensor(nullptr, in_tensor_name, input_tensor));
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_set_tensor(infer_request, nullptr, input_tensor));
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_set_tensor(infer_request, in_tensor_name, nullptr));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_tensor) {
|
||||
TEST_P(ov_infer_request_test, get_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_tensor(infer_request, in_tensor_name, &input_tensor));
|
||||
EXPECT_NE(nullptr, input_tensor);
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_input_tensor_by_index) {
|
||||
TEST_P(ov_infer_request_test, get_input_tensor_by_index) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_input_tensor_by_index(infer_request, 0, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_tensor_by_const_port) {
|
||||
TEST_P(ov_infer_request_test, get_tensor_by_const_port) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_tensor_by_const_port(infer_request, input_const_port, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_tensor_by_port) {
|
||||
TEST_P(ov_infer_request_test, get_tensor_by_port) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_tensor_by_port(infer_request, input_port, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_input_tensor) {
|
||||
TEST_P(ov_infer_request_test, get_input_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_input_tensor(infer_request, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_output_tensor_by_index) {
|
||||
TEST_P(ov_infer_request_test, get_output_tensor_by_index) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_output_tensor_by_index(infer_request, 0, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_output_tensor) {
|
||||
TEST_P(ov_infer_request_test, get_output_tensor) {
|
||||
OV_EXPECT_OK(ov_infer_request_get_output_tensor(infer_request, &output_tensor));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_tensor_error_handling) {
|
||||
TEST_P(ov_infer_request_test, get_tensor_error_handling) {
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_get_tensor(nullptr, in_tensor_name, &input_tensor));
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_get_tensor(infer_request, nullptr, &input_tensor));
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_get_tensor(infer_request, in_tensor_name, nullptr));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, infer) {
|
||||
TEST_P(ov_infer_request_test, infer) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor(infer_request, in_tensor_name, input_tensor));
|
||||
|
||||
OV_ASSERT_OK(ov_infer_request_infer(infer_request));
|
||||
@ -291,7 +295,7 @@ TEST_P(ov_infer_request, infer) {
|
||||
ov_free(out_tensor_name);
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, cancel) {
|
||||
TEST_P(ov_infer_request_test, cancel) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor(infer_request, in_tensor_name, input_tensor));
|
||||
|
||||
OV_EXPECT_OK(ov_infer_request_cancel(infer_request));
|
||||
@ -306,11 +310,11 @@ TEST_P(ov_infer_request_ppp, infer_ppp) {
|
||||
EXPECT_NE(nullptr, output_tensor);
|
||||
}
|
||||
|
||||
TEST(ov_infer_request, infer_error_handling) {
|
||||
TEST_P(ov_infer_request_test, infer_error_handling) {
|
||||
OV_EXPECT_NOT_OK(ov_infer_request_infer(nullptr));
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, infer_async) {
|
||||
TEST_P(ov_infer_request_test, infer_async) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_input_tensor_by_index(infer_request, 0, input_tensor));
|
||||
|
||||
OV_ASSERT_OK(ov_infer_request_start_async(infer_request));
|
||||
@ -323,7 +327,7 @@ TEST_P(ov_infer_request, infer_async) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, infer_async_wait_for) {
|
||||
TEST_P(ov_infer_request_test, infer_async_wait_for) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_input_tensor_by_index(infer_request, 0, input_tensor));
|
||||
|
||||
OV_ASSERT_OK(ov_infer_request_start_async(infer_request));
|
||||
@ -358,12 +362,12 @@ inline void infer_request_callback(void* args) {
|
||||
|
||||
ov_tensor_free(out_tensor);
|
||||
|
||||
std::lock_guard<std::mutex> lock(ov_infer_request::m);
|
||||
ov_infer_request::ready = true;
|
||||
ov_infer_request::condVar.notify_one();
|
||||
std::lock_guard<std::mutex> lock(ov_infer_request_test::m);
|
||||
ov_infer_request_test::ready = true;
|
||||
ov_infer_request_test::condVar.notify_one();
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, infer_request_set_callback) {
|
||||
TEST_P(ov_infer_request_test, infer_request_set_callback) {
|
||||
OV_EXPECT_OK(ov_infer_request_set_input_tensor_by_index(infer_request, 0, input_tensor));
|
||||
|
||||
ov_callback_t callback;
|
||||
@ -375,14 +379,14 @@ TEST_P(ov_infer_request, infer_request_set_callback) {
|
||||
OV_ASSERT_OK(ov_infer_request_start_async(infer_request));
|
||||
|
||||
if (!HasFatalFailure()) {
|
||||
std::unique_lock<std::mutex> lock(ov_infer_request::m);
|
||||
ov_infer_request::condVar.wait(lock, [] {
|
||||
return ov_infer_request::ready;
|
||||
std::unique_lock<std::mutex> lock(ov_infer_request_test::m);
|
||||
ov_infer_request_test::condVar.wait(lock, [] {
|
||||
return ov_infer_request_test::ready;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
TEST_P(ov_infer_request, get_profiling_info) {
|
||||
TEST_P(ov_infer_request_test, get_profiling_info) {
|
||||
auto device_name = GetParam();
|
||||
OV_EXPECT_OK(ov_infer_request_set_tensor(infer_request, in_tensor_name, input_tensor));
|
||||
|
||||
|
@ -3,13 +3,25 @@
|
||||
//
|
||||
#include "ov_test.hpp"
|
||||
|
||||
TEST(ov_model, ov_model_const_input) {
|
||||
class ov_model_test : public ov_capi_test_base {
|
||||
void SetUp() override {
|
||||
ov_capi_test_base::SetUp();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(device_name, ov_model_test, ::testing::Values(""));
|
||||
|
||||
TEST_P(ov_model_test, ov_model_const_input) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* input_port = nullptr;
|
||||
@ -21,13 +33,13 @@ TEST(ov_model, ov_model_const_input) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_const_input_by_name) {
|
||||
TEST_P(ov_model_test, ov_model_const_input_by_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* input_port = nullptr;
|
||||
@ -43,13 +55,13 @@ TEST(ov_model, ov_model_const_input_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_const_input_by_index) {
|
||||
TEST_P(ov_model_test, ov_model_const_input_by_index) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* input_port = nullptr;
|
||||
@ -65,13 +77,13 @@ TEST(ov_model, ov_model_const_input_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_input) {
|
||||
TEST_P(ov_model_test, ov_model_input) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* input_port = nullptr;
|
||||
@ -83,13 +95,13 @@ TEST(ov_model, ov_model_input) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_input_by_name) {
|
||||
TEST_P(ov_model_test, ov_model_input_by_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* input_port = nullptr;
|
||||
@ -105,13 +117,13 @@ TEST(ov_model, ov_model_input_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_input_by_index) {
|
||||
TEST_P(ov_model_test, ov_model_input_by_index) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* input_port = nullptr;
|
||||
@ -127,13 +139,13 @@ TEST(ov_model, ov_model_input_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_const_output) {
|
||||
TEST_P(ov_model_test, ov_model_const_output) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* output_port = nullptr;
|
||||
@ -145,13 +157,13 @@ TEST(ov_model, ov_model_const_output) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_const_output_by_index) {
|
||||
TEST_P(ov_model_test, ov_model_const_output_by_index) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* output_port = nullptr;
|
||||
@ -167,17 +179,17 @@ TEST(ov_model, ov_model_const_output_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_const_output_by_name) {
|
||||
TEST_P(ov_model_test, ov_model_const_output_by_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* output_port = nullptr;
|
||||
OV_EXPECT_OK(ov_model_const_output_by_name(model, "fc_out", &output_port));
|
||||
OV_EXPECT_OK(ov_model_const_output_by_name(model, "relu", &output_port));
|
||||
EXPECT_NE(nullptr, output_port);
|
||||
|
||||
ov_shape_t shape;
|
||||
@ -189,13 +201,13 @@ TEST(ov_model, ov_model_const_output_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_output) {
|
||||
TEST_P(ov_model_test, ov_model_output) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* output_port = nullptr;
|
||||
@ -207,13 +219,13 @@ TEST(ov_model, ov_model_output) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_output_by_index) {
|
||||
TEST_P(ov_model_test, ov_model_output_by_index) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* output_port = nullptr;
|
||||
@ -229,17 +241,17 @@ TEST(ov_model, ov_model_output_by_index) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_output_by_name) {
|
||||
TEST_P(ov_model_test, ov_model_output_by_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* output_port = nullptr;
|
||||
OV_EXPECT_OK(ov_model_output_by_name(model, "fc_out", &output_port));
|
||||
OV_EXPECT_OK(ov_model_output_by_name(model, "relu", &output_port));
|
||||
EXPECT_NE(nullptr, output_port);
|
||||
|
||||
ov_shape_t shape;
|
||||
@ -251,13 +263,13 @@ TEST(ov_model, ov_model_output_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_inputs_size) {
|
||||
TEST_P(ov_model_test, ov_model_inputs_size) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
size_t input_size;
|
||||
@ -268,13 +280,13 @@ TEST(ov_model, ov_model_inputs_size) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_outputs_size) {
|
||||
TEST_P(ov_model_test, ov_model_outputs_size) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
size_t output_size;
|
||||
@ -285,13 +297,13 @@ TEST(ov_model, ov_model_outputs_size) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_is_dynamic) {
|
||||
TEST_P(ov_model_test, ov_model_is_dynamic) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
EXPECT_NO_THROW(ov_model_is_dynamic(model));
|
||||
@ -300,13 +312,13 @@ TEST(ov_model, ov_model_is_dynamic) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_reshape_input_by_name) {
|
||||
TEST_P(ov_model_test, ov_model_reshape_input_by_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* input_port_1 = nullptr;
|
||||
@ -339,13 +351,13 @@ TEST(ov_model, ov_model_reshape_input_by_name) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_reshape) {
|
||||
TEST_P(ov_model_test, ov_model_reshape) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_const_port_t* input_port_1 = nullptr;
|
||||
@ -379,13 +391,13 @@ TEST(ov_model, ov_model_reshape) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_reshape_by_port_indexes) {
|
||||
TEST_P(ov_model_test, ov_model_reshape_by_port_indexes) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
size_t port_indexs[] = {0};
|
||||
@ -409,13 +421,13 @@ TEST(ov_model, ov_model_reshape_by_port_indexes) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_reshape_single_input) {
|
||||
TEST_P(ov_model_test, ov_model_reshape_single_input) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_shape_t shape = {0, nullptr};
|
||||
@ -437,13 +449,13 @@ TEST(ov_model, ov_model_reshape_single_input) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_reshape_by_ports) {
|
||||
TEST_P(ov_model_test, ov_model_reshape_by_ports) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
ov_output_port_t* input_port_1 = nullptr;
|
||||
@ -471,13 +483,13 @@ TEST(ov_model, ov_model_reshape_by_ports) {
|
||||
ov_core_free(core);
|
||||
}
|
||||
|
||||
TEST(ov_model, ov_model_get_friendly_name) {
|
||||
TEST_P(ov_model_test, ov_model_get_friendly_name) {
|
||||
ov_core_t* core = nullptr;
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
ov_model_t* model = nullptr;
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
char* friendly_name = nullptr;
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
#include "ov_test.hpp"
|
||||
|
||||
class ov_preprocess : public ::testing::Test {
|
||||
class ov_preprocess_test : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
core = nullptr;
|
||||
@ -17,10 +17,14 @@ protected:
|
||||
output_tensor_info = nullptr;
|
||||
input_model = nullptr;
|
||||
|
||||
TestDataHelpers::generate_test_model();
|
||||
xml_file_name = TestDataHelpers::get_model_xml_file_name();
|
||||
bin_file_name = TestDataHelpers::get_model_bin_file_name();
|
||||
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
}
|
||||
void TearDown() override {
|
||||
@ -34,6 +38,7 @@ protected:
|
||||
ov_preprocess_prepostprocessor_free(preprocess);
|
||||
ov_model_free(model);
|
||||
ov_core_free(core);
|
||||
TestDataHelpers::release_test_model();
|
||||
}
|
||||
|
||||
public:
|
||||
@ -47,14 +52,15 @@ public:
|
||||
ov_preprocess_output_info_t* output_info;
|
||||
ov_preprocess_output_tensor_info_t* output_tensor_info;
|
||||
ov_preprocess_input_model_info_t* input_model;
|
||||
std::string xml_file_name, bin_file_name;
|
||||
};
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_create) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_create) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_input_info) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -62,7 +68,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info) {
|
||||
EXPECT_NE(nullptr, input_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info_by_name) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_input_info_by_name) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -70,7 +76,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info_by_name) {
|
||||
EXPECT_NE(nullptr, input_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info_by_index) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_input_info_by_index) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -78,7 +84,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_input_info_by_index) {
|
||||
EXPECT_NE(nullptr, input_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_info_get_tensor_info) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_info_get_tensor_info) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -89,7 +95,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_info_get_tensor_info) {
|
||||
EXPECT_NE(nullptr, input_tensor_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_info_get_preprocess_steps) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_info_get_preprocess_steps) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -100,7 +106,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_info_get_preprocess_steps) {
|
||||
EXPECT_NE(nullptr, input_process);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_resize) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_resize) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -113,7 +119,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_resize) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_resize(input_process, ov_preprocess_resize_algorithm_e::RESIZE_LINEAR));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_scale) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_scale) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -126,7 +132,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_scale) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_scale(input_process, 2.0f));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_mean) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_mean) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -139,7 +145,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_mean) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_mean(input_process, 2.0f));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_crop) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_crop) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -154,7 +160,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_crop) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_crop(input_process, begin, 4, end, 4));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_layout) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_convert_layout) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -172,7 +178,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_layout) {
|
||||
ov_layout_free(layout);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_reverse_channels) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_reverse_channels) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -185,7 +191,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_reverse_channels) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_reverse_channels(input_process));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_element_type) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -198,7 +204,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_input_tensor_info_set_element_type(input_tensor_info, ov_element_type_e::F32));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_from) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_from) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -218,7 +224,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_from) {
|
||||
ov_shape_free(&shape);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_layout) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_layout) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -236,7 +242,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_layout) {
|
||||
ov_layout_free(layout);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_color_format) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_color_format) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -250,7 +256,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_color_format) {
|
||||
ov_preprocess_input_tensor_info_set_color_format(input_tensor_info, ov_color_format_e::NV12_SINGLE_PLANE));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_spatial_static_shape) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_tensor_info_set_spatial_static_shape) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -266,7 +272,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_tensor_info_set_spatial_static_shape)
|
||||
ov_preprocess_input_tensor_info_set_spatial_static_shape(input_tensor_info, input_height, input_width));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_element_type) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_convert_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -283,7 +289,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_convert_element_type(input_process, ov_element_type_e::F32));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_color) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_convert_color) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -304,7 +310,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_color) {
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_convert_color(input_process, ov_color_format_e::BGR));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_color_rgb_to_gray) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_preprocess_steps_convert_color_rgb_to_gray) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -321,7 +327,7 @@ TEST_F(ov_preprocess, ov_preprocess_preprocess_steps_convert_color_rgb_to_gray)
|
||||
OV_EXPECT_OK(ov_preprocess_preprocess_steps_convert_color(input_process, ov_color_format_e::GRAY));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_output_info) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_output_info) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -329,7 +335,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_output_info) {
|
||||
EXPECT_NE(nullptr, output_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_output_info_by_index) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_output_info_by_index) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -337,15 +343,15 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_output_info_by_index) {
|
||||
EXPECT_NE(nullptr, output_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_get_output_info_by_name) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_get_output_info_by_name) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_get_output_info_by_name(preprocess, "fc_out", &output_info));
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_get_output_info_by_name(preprocess, "relu", &output_info));
|
||||
EXPECT_NE(nullptr, output_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_output_info_get_tensor_info) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_output_info_get_tensor_info) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -356,7 +362,7 @@ TEST_F(ov_preprocess, ov_preprocess_output_info_get_tensor_info) {
|
||||
EXPECT_NE(nullptr, output_tensor_info);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_output_set_element_type) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_output_set_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -369,7 +375,7 @@ TEST_F(ov_preprocess, ov_preprocess_output_set_element_type) {
|
||||
OV_EXPECT_OK(ov_preprocess_output_set_element_type(output_tensor_info, ov_element_type_e::F32));
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_info_get_model_info) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_info_get_model_info) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -380,7 +386,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_info_get_model_info) {
|
||||
EXPECT_NE(nullptr, input_model);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_input_model_info_set_layout) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_input_model_info_set_layout) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -398,7 +404,7 @@ TEST_F(ov_preprocess, ov_preprocess_input_model_info_set_layout) {
|
||||
ov_layout_free(layout);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_build) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_build) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -409,7 +415,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_build) {
|
||||
ov_model_free(new_model);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_build_apply) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_build_apply) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
@ -459,7 +465,7 @@ TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_build_apply) {
|
||||
ov_model_free(new_model);
|
||||
}
|
||||
|
||||
TEST_F(ov_preprocess, ov_preprocess_prepostprocessor_for_nv12_input) {
|
||||
TEST_F(ov_preprocess_test, ov_preprocess_prepostprocessor_for_nv12_input) {
|
||||
OV_EXPECT_OK(ov_preprocess_prepostprocessor_create(model, &preprocess));
|
||||
EXPECT_NE(nullptr, preprocess);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "openvino/runtime/intel_gpu/ocl/ocl_wrapper.hpp"
|
||||
#include "ov_test.hpp"
|
||||
|
||||
class ov_remote_context_ocl : public ::testing::TestWithParam<std::string> {
|
||||
class ov_remote_context_ocl : public ov_capi_test_base {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
core = nullptr;
|
||||
@ -16,11 +16,12 @@ protected:
|
||||
remote_tensor = nullptr;
|
||||
out_tensor_name = nullptr;
|
||||
in_tensor_name = nullptr;
|
||||
ov_capi_test_base::SetUp();
|
||||
|
||||
OV_EXPECT_OK(ov_core_create(&core));
|
||||
EXPECT_NE(nullptr, core);
|
||||
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml, bin, &model));
|
||||
OV_EXPECT_OK(ov_core_read_model(core, xml_file_name.c_str(), bin_file_name.c_str(), &model));
|
||||
EXPECT_NE(nullptr, model);
|
||||
|
||||
char* info = nullptr;
|
||||
@ -68,6 +69,7 @@ protected:
|
||||
ov_free(in_tensor_name);
|
||||
ov_remote_context_free(context);
|
||||
ov_core_free(core);
|
||||
ov_capi_test_base::TearDown();
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -3,14 +3,6 @@
|
||||
//
|
||||
#include "ov_test.hpp"
|
||||
|
||||
#include "test_model_repo.hpp"
|
||||
|
||||
std::string xml_std = TestDataHelpers::generate_model_path("test_model", "test_model_fp32.xml");
|
||||
std::string bin_std = TestDataHelpers::generate_model_path("test_model", "test_model_fp32.bin");
|
||||
|
||||
const char* xml = xml_std.c_str();
|
||||
const char* bin = bin_std.c_str();
|
||||
|
||||
std::map<ov_element_type_e, size_t> element_type_size_map = {{ov_element_type_e::BOOLEAN, 8},
|
||||
{ov_element_type_e::BF16, 16},
|
||||
{ov_element_type_e::F16, 16},
|
||||
|
@ -11,11 +11,7 @@
|
||||
|
||||
#include "openvino/c/openvino.h"
|
||||
#include "openvino/openvino.hpp"
|
||||
|
||||
extern const char* xml;
|
||||
extern const char* bin;
|
||||
extern const char* input_image;
|
||||
extern const char* input_image_nv12;
|
||||
#include "test_model_repo.hpp"
|
||||
|
||||
#define OV_EXPECT_OK(...) EXPECT_EQ(ov_status_e::OK, __VA_ARGS__)
|
||||
#define OV_ASSERT_OK(...) ASSERT_EQ(ov_status_e::OK, __VA_ARGS__)
|
||||
@ -40,6 +36,22 @@ extern const char* input_image_nv12;
|
||||
extern std::map<ov_element_type_e, size_t> element_type_size_map;
|
||||
#define GET_ELEMENT_TYPE_SIZE(a) element_type_size_map[a]
|
||||
|
||||
class ov_capi_test_base : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
void SetUp() override {
|
||||
TestDataHelpers::generate_test_model();
|
||||
xml_file_name = TestDataHelpers::get_model_xml_file_name();
|
||||
bin_file_name = TestDataHelpers::get_model_bin_file_name();
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
TestDataHelpers::release_test_model();
|
||||
}
|
||||
|
||||
public:
|
||||
std::string xml_file_name, bin_file_name;
|
||||
};
|
||||
|
||||
inline size_t find_device(ov_available_devices_t avai_devices, const char* device_name) {
|
||||
for (size_t i = 0; i < avai_devices.size; ++i) {
|
||||
if (strstr(avai_devices.devices[i], device_name))
|
||||
|
@ -1,51 +1,54 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <fstream>
|
||||
#include <random>
|
||||
|
||||
#include "ngraph_functions/builders.hpp"
|
||||
#include "ngraph_functions/subgraph_builders.hpp"
|
||||
#include "openvino/pass/manager.hpp"
|
||||
|
||||
namespace TestDataHelpers {
|
||||
|
||||
static const char kPathSeparator =
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
'\\';
|
||||
#else
|
||||
'/';
|
||||
#endif
|
||||
static const std::string model_bin_name = "test_model.bin";
|
||||
static const std::string model_xml_name = "test_model.xml";
|
||||
static const std::string model_exported_name = "test_exported_model.blob";
|
||||
|
||||
inline std::string getModelPathNonFatal() noexcept {
|
||||
if (const auto envVar = std::getenv("MODELS_PATH")) {
|
||||
return envVar;
|
||||
inline void generate_test_model() {
|
||||
ov::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::Serialize>(model_xml_name, model_bin_name);
|
||||
auto function = ngraph::builder::subgraph::makeConvPoolReluNoReshapes({1, 3, 227, 227});
|
||||
manager.run_passes(function);
|
||||
}
|
||||
|
||||
inline std::string get_model_xml_file_name() {
|
||||
return model_xml_name;
|
||||
}
|
||||
|
||||
inline std::string get_model_bin_file_name() {
|
||||
return model_bin_name;
|
||||
}
|
||||
|
||||
inline std::string get_exported_blob_file_name() {
|
||||
return model_exported_name;
|
||||
}
|
||||
|
||||
inline void release_test_model() {
|
||||
std::remove(model_xml_name.c_str());
|
||||
std::remove(model_bin_name.c_str());
|
||||
}
|
||||
|
||||
inline void fill_random_input_nv12_data(uint8_t* data, const size_t w, const size_t h) {
|
||||
size_t size = w * h * 3 / 2;
|
||||
std::mt19937 gen(0);
|
||||
std::uniform_int_distribution<> distribution(0, 255);
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
data[i] = static_cast<uint8_t>(distribution(gen));
|
||||
}
|
||||
|
||||
#ifdef MODELS_PATH
|
||||
return MODELS_PATH;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::string get_models_path() {
|
||||
return getModelPathNonFatal() + kPathSeparator + std::string("models");
|
||||
};
|
||||
|
||||
inline std::string get_data_path() {
|
||||
if (const auto envVar = std::getenv("DATA_PATH")) {
|
||||
return envVar;
|
||||
}
|
||||
|
||||
#ifdef DATA_PATH
|
||||
return DATA_PATH;
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
|
||||
inline std::string generate_model_path(std::string dir, std::string filename) {
|
||||
return get_models_path() + kPathSeparator + dir + kPathSeparator + filename;
|
||||
}
|
||||
|
||||
inline std::string generate_image_path(std::string dir, std::string filename) {
|
||||
return get_data_path() + kPathSeparator + "validation_set" + kPathSeparator + dir + kPathSeparator + filename;
|
||||
return;
|
||||
}
|
||||
|
||||
inline std::string generate_test_xml_file() {
|
||||
|
Loading…
Reference in New Issue
Block a user