diff --git a/ge/graph/common/omg_util.h b/ge/graph/common/omg_util.h index d55cc7c8..83057dfb 100644 --- a/ge/graph/common/omg_util.h +++ b/ge/graph/common/omg_util.h @@ -27,11 +27,10 @@ #include "graph/node.h" namespace ge { -namespace { -const int64_t kBufferPoolMemAlignSize = 512; -const uint32_t kBufferPoolNodeOutIndex = 0; -const uint32_t kEventReuseThreshold = 65500; -} // namespace +static constexpr int64_t kBufferPoolMemAlignSize = 512; +static constexpr uint32_t kBufferPoolNodeOutIndex = 0; +static constexpr uint32_t kEventReuseThreshold = 65500; + /// /// @brief get the Original Type of FrameworkOp /// @param [in] node diff --git a/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc b/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc index 5468ec97..7f26aa8c 100644 --- a/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc +++ b/tests/ut/ge/graph/optimize/graph_optimize_unittest.cc @@ -32,14 +32,14 @@ using namespace ge; namespace { const char *const kVectorCore = "VectorCore"; const char *const kAicoreEngine = "AIcoreEngine"; -string CreateEngineConfigJson() { +void CreateEngineConfigJson(string &dir_path, string &file_path) { GELOGI("Begin to create engine config json file."); string base_path = PluginManager::GetPath(); GELOGI("Base path is %s.", base_path.c_str()); - string dir_path = base_path.substr(0, base_path.rfind('/') + 1) + "plugin/nnengine/ge_config"; + dir_path = base_path.substr(0, base_path.rfind('/') + 1) + "plugin/nnengine/ge_config"; string cmd = "mkdir -p " + dir_path; system(cmd.c_str()); - string file_path = dir_path + "/engine_conf.json"; + file_path = dir_path + "/engine_conf.json"; GELOGI("Begin to write into the config file: %s.", file_path.c_str()); ofstream ofs(file_path, ios::out); EXPECT_EQ(!ofs, false); @@ -56,7 +56,6 @@ string CreateEngineConfigJson() { "}"; ofs.close(); GELOGI("Json config file %s has been written.", file_path.c_str()); - return file_path; } void DeleteFile(const string &file_name) { @@ -69,14 +68,16 @@ void DeleteFile(const string &file_name) { class UtestGraphOptimizeTest : public testing::Test { protected: void SetUp() { - config_file_ = CreateEngineConfigJson(); + CreateEngineConfigJson(config_dir_, config_file_); } void TearDown() { DeleteFile(config_file_); + DeleteFile(config_dir_); } private: + string config_dir_; string config_file_; };