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 ab572caf5fdf75486977cce99bf52ee41fdabe64..d28de624c7898558e310cb1ff636283f08315df4 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 @@ -164,10 +164,7 @@ TEST_F(OmOptimizationPassTest, UnaryOpsTest) { string org_graph_def_path = "tf_adapter/tests/ut/optimizers/pbtxt/om_test_unaryops.pbtxt"; InitGraph(org_graph_def_path); std::string target_graph = DoRunOmOptimizationPassTest(true); - bool ret = false; - if (target_graph.find("_Floor") != target_graph.npos && target_graph.find("_Abs") != target_graph.npos) { - ret = true; - } + bool ret = target_graph.find("_Floor") != target_graph.npos && target_graph.find("_Abs") != target_graph.npos; EXPECT_EQ(ret, true); } TEST_F(OmOptimizationPassTest, InOutPairFlagFalseTest) { diff --git a/tf_adapter/tests/st/util/testcase/ge_plugin_test.cc b/tf_adapter/tests/st/util/testcase/ge_plugin_test.cc index dfcbf6d4c57ab568f0d349add4724001b190b7ad..e2117f25902a20ae1a9c4fff0de5bfda57de975b 100644 --- a/tf_adapter/tests/st/util/testcase/ge_plugin_test.cc +++ b/tf_adapter/tests/st/util/testcase/ge_plugin_test.cc @@ -29,6 +29,7 @@ TEST_F(GePluginTest, PluginInitTest) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest_Success) { @@ -49,6 +50,7 @@ TEST_F(GePluginTest, PluginInitTest_Success) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest_fail) { @@ -71,6 +73,7 @@ TEST_F(GePluginTest, PluginInitTest_fail) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest_hccl) { @@ -96,6 +99,7 @@ TEST_F(GePluginTest, PluginInitTest_hccl) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginFinalizeTest) { @@ -164,6 +168,7 @@ TEST_F(GePluginTest, NpuCloseTest) { init_options["ge.jobType"] = "1"; init_options["ge.tuningPath"] = "./"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); NpuClose(); } TEST_F(GePluginTest, RdmaInitAndRegisterFail1Test) { diff --git a/tf_adapter/tests/st/util/testcase/host_queue_test.cc b/tf_adapter/tests/st/util/testcase/host_queue_test.cc index 71ae595cffc3fe785159310d6f0752cfd8035257..f3eb67b0cf9a9503d97cc2dfac87b1a6fd2b2aee 100644 --- a/tf_adapter/tests/st/util/testcase/host_queue_test.cc +++ b/tf_adapter/tests/st/util/testcase/host_queue_test.cc @@ -27,7 +27,8 @@ TEST_F(HostQueueTest, HostQueueSendData) { void *buff = nullptr; TF_CHECK_OK(MappingTensor2Buff(ACL_TENSOR_DATA_TENSOR, tensors, buff)); bool need_resend = false; - TF_CHECK_OK(HostQueueSendData(queue_id, buff, need_resend)); + Status s = HostQueueSendData(queue_id, buff, need_resend); + ASSERT_TRUE(s.ok()); HostQueueDestroy(queue_id); } @@ -39,8 +40,9 @@ TEST_F(HostQueueTest, HostQueueEndOfSequence) { void *buff = nullptr; TF_CHECK_OK(MappingTensor2Buff(ACL_TENSOR_DATA_TENSOR, {}, buff)); bool need_resend = false; - TF_CHECK_OK(HostQueueSendData(queue_id, buff, need_resend)); + Status s = HostQueueSendData(queue_id, buff, need_resend); + ASSERT_TRUE(s.ok()); HostQueueDestroy(queue_id); } } -} // end tensorflow \ No newline at end of file +} // end tensorflow diff --git a/tf_adapter/tests/st/util/testcase/npu_attrs_test.cc b/tf_adapter/tests/st/util/testcase/npu_attrs_test.cc index 680f3bf3288f932fbe7d67cffa34673eb61a0a53..4a2d97a139956222b8d305b1e98b91339c6e68e2 100644 --- a/tf_adapter/tests/st/util/testcase/npu_attrs_test.cc +++ b/tf_adapter/tests/st/util/testcase/npu_attrs_test.cc @@ -20,8 +20,8 @@ class NpuAttrTest : public testing::Test { }; TEST_F(NpuAttrTest, GetEnvDeviceIdDefaultTest) { uint32_t device_id = 0; - (void)GetEnvDeviceID(device_id); - EXPECT_EQ(device_id, 0); + Status s = GetEnvDeviceID(device_id); + EXPECT_EQ(s.ok(), true); } TEST_F(NpuAttrTest, GetEnvAscendDeviceIdEmptyTest) { uint32_t device_id = 0; 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 a1abc75bcde170806ca9f1772e30267add539111..9bba2fdee6a1aac88b7b3bf45efc5ec667ab07db 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 @@ -164,10 +164,7 @@ TEST_F(OmOptimizationPassTest, UnaryOpsTest) { string org_graph_def_path = "tf_adapter/tests/ut/optimizers/pbtxt/om_test_unaryops.pbtxt"; InitGraph(org_graph_def_path); std::string target_graph = DoRunOmOptimizationPassTest(true); - bool ret = false; - if (target_graph.find("_Floor") != target_graph.npos && target_graph.find("_Abs") != target_graph.npos) { - ret = true; - } + bool ret = target_graph.find("_Floor") != target_graph.npos && target_graph.find("_Abs") != target_graph.npos; EXPECT_EQ(ret, true); } TEST_F(OmOptimizationPassTest, InOutPairFlagFalseTest) { diff --git a/tf_adapter/tests/ut/util/testcase/ge_plugin_test.cc b/tf_adapter/tests/ut/util/testcase/ge_plugin_test.cc index 1b6dab8812efdbbde2e7801123e631a726dc0aa6..80561d575ca9d512d5f45b3c91fe2fbb05b8af1c 100644 --- a/tf_adapter/tests/ut/util/testcase/ge_plugin_test.cc +++ b/tf_adapter/tests/ut/util/testcase/ge_plugin_test.cc @@ -27,6 +27,7 @@ TEST_F(GePluginTest, PluginInitTest_1) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest_Success) { @@ -45,6 +46,7 @@ TEST_F(GePluginTest, PluginInitTest_Success) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest) { @@ -65,6 +67,7 @@ TEST_F(GePluginTest, PluginInitTest) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginInitTest_hccl) { @@ -89,6 +92,7 @@ TEST_F(GePluginTest, PluginInitTest_hccl) { init_options["ge.opDebugLevel"] = "1"; init_options["ge.jobType"] = "2"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); } TEST_F(GePluginTest, PluginFinalizeTest) { @@ -157,6 +161,7 @@ TEST_F(GePluginTest, NpuCloseTest) { init_options["ge.jobType"] = "1"; init_options["ge.tuningPath"] = "./"; PluginInit(init_options); + ASSERT_FALSE(GePlugin::GetInstance()->GetInitOptions().empty()); NpuClose(); } TEST_F(GePluginTest, RdmaInitAndRegisterFail1Test) { diff --git a/tf_adapter/tests/ut/util/testcase/host_queue_test.cc b/tf_adapter/tests/ut/util/testcase/host_queue_test.cc index 71ae595cffc3fe785159310d6f0752cfd8035257..f3eb67b0cf9a9503d97cc2dfac87b1a6fd2b2aee 100644 --- a/tf_adapter/tests/ut/util/testcase/host_queue_test.cc +++ b/tf_adapter/tests/ut/util/testcase/host_queue_test.cc @@ -27,7 +27,8 @@ TEST_F(HostQueueTest, HostQueueSendData) { void *buff = nullptr; TF_CHECK_OK(MappingTensor2Buff(ACL_TENSOR_DATA_TENSOR, tensors, buff)); bool need_resend = false; - TF_CHECK_OK(HostQueueSendData(queue_id, buff, need_resend)); + Status s = HostQueueSendData(queue_id, buff, need_resend); + ASSERT_TRUE(s.ok()); HostQueueDestroy(queue_id); } @@ -39,8 +40,9 @@ TEST_F(HostQueueTest, HostQueueEndOfSequence) { void *buff = nullptr; TF_CHECK_OK(MappingTensor2Buff(ACL_TENSOR_DATA_TENSOR, {}, buff)); bool need_resend = false; - TF_CHECK_OK(HostQueueSendData(queue_id, buff, need_resend)); + Status s = HostQueueSendData(queue_id, buff, need_resend); + ASSERT_TRUE(s.ok()); HostQueueDestroy(queue_id); } } -} // end tensorflow \ No newline at end of file +} // end tensorflow diff --git a/tf_adapter/tests/ut/util/testcase/npu_attrs_test.cc b/tf_adapter/tests/ut/util/testcase/npu_attrs_test.cc index 86f6f4ba3112fe207d59d8dba7a69fbfcbecb27f..d1f517604a3f3025d0b512e430344264e553492b 100644 --- a/tf_adapter/tests/ut/util/testcase/npu_attrs_test.cc +++ b/tf_adapter/tests/ut/util/testcase/npu_attrs_test.cc @@ -28,8 +28,8 @@ TEST_F(NpuAttrTest, CheckIsNewDataTransfer) { TEST_F(NpuAttrTest, GetEnvDeviceIdDefaultTest) { uint32_t device_id = 0; - (void)GetEnvDeviceID(device_id); - EXPECT_EQ(device_id, 0); + Status s = GetEnvDeviceID(device_id); + EXPECT_EQ(s.ok(), true); } TEST_F(NpuAttrTest, GetEnvAscendDeviceIdEmptyTest) { uint32_t device_id = 0;