From 730824040ce9a0a9e08b9b4890b4b59a943bd885 Mon Sep 17 00:00:00 2001 From: zhaoxinxin Date: Wed, 20 Jan 2021 10:33:38 +0800 Subject: [PATCH] modified: tests/ut/ge/CMakeLists.txt modified: tests/ut/ge/graph/load/new_model_manager_model_manager_unittest.cc --- tests/ut/ge/CMakeLists.txt | 2 +- ...ew_model_manager_model_manager_unittest.cc | 40 ++++++++----------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/tests/ut/ge/CMakeLists.txt b/tests/ut/ge/CMakeLists.txt index 9d14461e..18614c16 100755 --- a/tests/ut/ge/CMakeLists.txt +++ b/tests/ut/ge/CMakeLists.txt @@ -572,7 +572,7 @@ set(DISTINCT_GRAPH_LOAD_TEST_FILES "graph/load/data_dumper_unittest.cc" #"graph/load/new_model_manager_data_inputer_unittest.cc" #"graph/load/new_model_manager_davinci_model_unittest.cc" - #"graph/load/new_model_manager_model_manager_unittest.cc" + "graph/load/new_model_manager_model_manager_unittest.cc" #"graph/load/new_model_manager_task_build_unittest.cc" "graph/load/new_model_manager_model_manager_aicpu_unittest.cc" "graph/load/end_graph_task_unittest.cc" diff --git a/tests/ut/ge/graph/load/new_model_manager_model_manager_unittest.cc b/tests/ut/ge/graph/load/new_model_manager_model_manager_unittest.cc index 4096afa5..29b6ae50 100644 --- a/tests/ut/ge/graph/load/new_model_manager_model_manager_unittest.cc +++ b/tests/ut/ge/graph/load/new_model_manager_model_manager_unittest.cc @@ -15,14 +15,10 @@ */ #include - -#include +#include #include "common/debug/log.h" -#include "common/model_parser/base.h" -#include "common/properties_manager.h" #include "common/types.h" -#include "common/l2_cache_optimize.h" - +#include "graph/utils/graph_utils.h" #define private public #define protected public #include "graph/load/new_model_manager/model_manager.h" @@ -32,7 +28,6 @@ #include "graph/load/graph_loader.h" #include "graph/load/new_model_manager/davinci_model.h" #include "graph/load/new_model_manager/davinci_model_parser.h" -#include "new_op_test_utils.h" #undef private #undef protected @@ -87,7 +82,6 @@ class UtestModelManagerModelManager : public testing::Test { data.model_data = new uint8_t[data.model_len]; uint8_t data_ori[model_len]; memset(data_ori, 10, model_len); - uint32_t out_len; ModelFileHeader *header = (ModelFileHeader *)data.model_data; header->magic = MODEL_FILE_MAGIC_NUM; header->version = MODEL_VERSION; @@ -97,7 +91,7 @@ class UtestModelManagerModelManager : public testing::Test { void LoadStandardModelData(ge::ModelData &data) { static const std::string STANDARD_MODEL_DATA_PATH = - "llt/framework/domi/ut/ome/test/data/standard_partition_model.txt"; + "llt/framework/domi/ut/ome/test/data/standard_partition_model.txt"; ge::proto::ModelDef model_def; ReadProtoFromText(STANDARD_MODEL_DATA_PATH.c_str(), &model_def); @@ -113,9 +107,8 @@ class DModelListener : public ge::ModelListener { uint32_t OnComputeDone(uint32_t model_id, uint32_t data_index, uint32_t resultCode) { return 0; } }; -shared_ptr UTEST_CALL_BACK_FUN(new DModelListener()); -TEST_F(UtestModelManagerModelManager, case_load_incorrect_param) { +/*TEST_F(UtestModelManagerModelManager, case_load_incorrect_param) { ModelManager mm; uint32_t model_id = 0; ge::ModelData model; @@ -307,7 +300,7 @@ TEST_F(UtestModelManagerModelManager, get_input_output_desc_info_fail) { } -/* +*//* // test GetInputOutputDescInfo fail TEST_F(UtestModelManagerModelManager, get_input_output_desc_info_zero_copy_fail) { ModelManager manager; @@ -316,7 +309,7 @@ TEST_F(UtestModelManagerModelManager, get_input_output_desc_info_zero_copy_fail) vector output_shape; EXPECT_EQ(ge::PARAM_INVALID, manager.GetInputOutputDescInfoForZeroCopy(2, input_shape, output_shape)); } -*/ +*//* // test Stop TEST_F(UtestModelManagerModelManager, stop_fail) { @@ -347,19 +340,20 @@ TEST_F(UtestModelManagerModelManager, destroy_aicpu_session) { manager.sess_ids_.insert(0); manager.DestroyAicpuSession(0); -} +}*/ // test DataInputTensor TEST_F(UtestModelManagerModelManager, test_data_input_tensor) { + shared_ptr g_label_call_back(nullptr); + auto model = std::make_shared(0, g_label_call_back); ModelManager mm; - mm.model_map_={{1,make_shared()}}; - mm.hybrid_model_map_={{1,make_shared()}}; - ge::ModelData data; - data.model_len = 10; uint32_t model_id = 1; - InputTensorInfo input_tensor = new InputTensorInfo(); - std::vector inputs = {input_tensor}; - auto ret = mm.DataInputTensor(1,inputs); - EXPECT_EQ(ge::SUCCESS, ret); + mm.model_map_[1] = model; + mm.hybrid_model_map_[1] = std::make_shared(); + + auto input_tensor = InputTensorInfo(); + vector inputs; + inputs.emplace_back(input_tensor); + auto ret = mm.DataInputTensor(model_id,inputs); + EXPECT_EQ(ge::UNSUPPORTED, ret); } - } // namespace ge