diff --git a/tf_adapter/tests/st/optimizers/testcase/om_partition_subgraphs_pass_test.cc b/tf_adapter/tests/st/optimizers/testcase/om_partition_subgraphs_pass_test.cc index 38e0704299108191e82e5d966ed9b68a867a4fcd..e237ac90c821f95810a8dfe3b9d0d306e19f9c27 100644 --- a/tf_adapter/tests/st/optimizers/testcase/om_partition_subgraphs_pass_test.cc +++ b/tf_adapter/tests/st/optimizers/testcase/om_partition_subgraphs_pass_test.cc @@ -333,5 +333,55 @@ TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest06) { ClearLogLevelForC(); system(("rm -rf " + opp_path).c_str()); } +TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest07) { + SetLogLevelForC(0); + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path = opp_path + "custom_opp_path"; + setenv("ASCEND_OPP_PATH", opp_path.c_str(), 1); + setenv("ASCEND_CUSTOM_OPP_PATH", custom_opp_path.c_str(), 1); + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("mkdir -p " + custom_opp_path).c_str()); + nlohmann::json allJson; + NpuOpsIdentifier *instance = new NpuOpsIdentifier(false, allJson); + EXPECT_NE(instance, nullptr); + delete instance; + ClearLogLevelForC(); + system(("rm -rf " + opp_path).c_str()); +} +TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest08) { + SetLogLevelForC(0); + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path_01 = opp_path + "/custom_opp_path_01"; + std::string custom_opp_path_invalid_01 = opp_path + "/custom_opp_path_invalid_01"; + std::string custom_opp_path_empty = ""; + std::string custom_opp_path_02 = opp_path + "/custom_opp_path_02"; + std::string custom_opp_path_invalid_02 = opp_path + "/custom_opp_path_invalid_02"; + setenv("ASCEND_OPP_PATH", opp_path.c_str(), 1); + setenv("ASCEND_CUSTOM_OPP_PATH", (custom_opp_path_01 + ":" + + custom_opp_path_invalid_01 + ":" + + custom_opp_path_empty + ":" + + custom_opp_path_02 + ":" + + custom_opp_path_invalid_02 + ).c_str(), 1); + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + std::string path_config = path_vendors + "/config.ini"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("echo 'load_priority=customize,mdc,lhisi' > " + path_config).c_str()); + system(("mkdir -p " + custom_opp_path_01).c_str()); + system(("mkdir -p " + custom_opp_path_02).c_str()); + nlohmann::json allJson; + NpuOpsIdentifier *instance = new NpuOpsIdentifier(false, allJson); + EXPECT_NE(instance, nullptr); + delete instance; + ClearLogLevelForC(); + system(("rm -rf " + opp_path).c_str()); +} } // end namespace } // end tensorflow diff --git a/tf_adapter/tests/ut/optimizers/testcase/om_partition_subgraphs_pass_test.cc b/tf_adapter/tests/ut/optimizers/testcase/om_partition_subgraphs_pass_test.cc index 38e0704299108191e82e5d966ed9b68a867a4fcd..e237ac90c821f95810a8dfe3b9d0d306e19f9c27 100644 --- a/tf_adapter/tests/ut/optimizers/testcase/om_partition_subgraphs_pass_test.cc +++ b/tf_adapter/tests/ut/optimizers/testcase/om_partition_subgraphs_pass_test.cc @@ -333,5 +333,55 @@ TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest06) { ClearLogLevelForC(); system(("rm -rf " + opp_path).c_str()); } +TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest07) { + SetLogLevelForC(0); + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path = opp_path + "custom_opp_path"; + setenv("ASCEND_OPP_PATH", opp_path.c_str(), 1); + setenv("ASCEND_CUSTOM_OPP_PATH", custom_opp_path.c_str(), 1); + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("mkdir -p " + custom_opp_path).c_str()); + nlohmann::json allJson; + NpuOpsIdentifier *instance = new NpuOpsIdentifier(false, allJson); + EXPECT_NE(instance, nullptr); + delete instance; + ClearLogLevelForC(); + system(("rm -rf " + opp_path).c_str()); +} +TEST_F(OmOptimizationPassTest, NpuOpsIdentifierTest08) { + SetLogLevelForC(0); + std::string opp_path = __FILE__; + opp_path = opp_path.substr(0, opp_path.rfind("/") + 1) + "opp_path/"; + std::string custom_opp_path_01 = opp_path + "/custom_opp_path_01"; + std::string custom_opp_path_invalid_01 = opp_path + "/custom_opp_path_invalid_01"; + std::string custom_opp_path_empty = ""; + std::string custom_opp_path_02 = opp_path + "/custom_opp_path_02"; + std::string custom_opp_path_invalid_02 = opp_path + "/custom_opp_path_invalid_02"; + setenv("ASCEND_OPP_PATH", opp_path.c_str(), 1); + setenv("ASCEND_CUSTOM_OPP_PATH", (custom_opp_path_01 + ":" + + custom_opp_path_invalid_01 + ":" + + custom_opp_path_empty + ":" + + custom_opp_path_02 + ":" + + custom_opp_path_invalid_02 + ).c_str(), 1); + std::string path_builtin = opp_path + "built-in"; + std::string path_vendors = opp_path + "vendors"; + std::string path_config = path_vendors + "/config.ini"; + system(("mkdir -p " + path_builtin).c_str()); + system(("mkdir -p " + path_vendors).c_str()); + system(("echo 'load_priority=customize,mdc,lhisi' > " + path_config).c_str()); + system(("mkdir -p " + custom_opp_path_01).c_str()); + system(("mkdir -p " + custom_opp_path_02).c_str()); + nlohmann::json allJson; + NpuOpsIdentifier *instance = new NpuOpsIdentifier(false, allJson); + EXPECT_NE(instance, nullptr); + delete instance; + ClearLogLevelForC(); + system(("rm -rf " + opp_path).c_str()); +} } // end namespace } // end tensorflow