From 3b261ee4a453b6c62fe33fef5708985bed8594a6 Mon Sep 17 00:00:00 2001 From: wuweikang Date: Mon, 5 Jul 2021 09:59:23 +0800 Subject: [PATCH] fix dump step check --- ge/common/dump/dump_properties.cc | 14 ++++---------- tests/ut/ge/common/dump_properties_unittest.cc | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/ge/common/dump/dump_properties.cc b/ge/common/dump/dump_properties.cc index 84bdb7bf..099920e7 100644 --- a/ge/common/dump/dump_properties.cc +++ b/ge/common/dump/dump_properties.cc @@ -204,7 +204,7 @@ FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY DumpProperties &DumpProperties: FMK_FUNC_HOST_VISIBILITY FMK_FUNC_DEV_VISIBILITY Status DumpProperties::SetDumpOptions() { if (enable_dump_ == kEnableFlag) { std::string dump_step; - if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS) { + if (GetContext().GetOption(OPTION_EXEC_DUMP_STEP, dump_step) == GRAPH_SUCCESS && !dump_step.empty()) { GE_CHK_STATUS_RET(CheckDumpStep(dump_step), "[Check][dump_step] failed."); GELOGI("Get dump step %s successfully", dump_step.c_str()); SetDumpStep(dump_step); @@ -441,16 +441,10 @@ Status DumpProperties::SetDumpDebugOptions() { if (enable_dump_debug_ == kEnableFlag) { std::string dump_debug_mode; if (GetContext().GetOption(OPTION_EXEC_DUMP_DEBUG_MODE, dump_debug_mode) == GRAPH_SUCCESS) { - GELOGD("Get dump debug mode %s successfully", dump_debug_mode.c_str()); + GELOGD("Get ge.exec.dumpDebugMode %s successfully", dump_debug_mode.c_str()); } else { - REPORT_INPUT_ERROR("E10001", std::vector({"parameter", "value", "reason"}), - std::vector({ - "ge.exec.dumpDebugMode", - dump_debug_mode, - "ge.exec.dumpDebugMode is not set."})); - GELOGE(PARAM_INVALID, "[Check][dump_debug_mode] failed. Dump debug mode is not set."); - - return PARAM_INVALID; + GELOGW("ge.exec.dumpDebugMode is not set."); + return SUCCESS; } if (dump_debug_mode == OP_DEBUG_AICORE) { diff --git a/tests/ut/ge/common/dump_properties_unittest.cc b/tests/ut/ge/common/dump_properties_unittest.cc index 57809013..3623bc6d 100644 --- a/tests/ut/ge/common/dump_properties_unittest.cc +++ b/tests/ut/ge/common/dump_properties_unittest.cc @@ -115,12 +115,12 @@ TEST_F(UTEST_dump_properties, init_by_options_success_2) { EXPECT_EQ(st, SUCCESS); } -TEST_F(UTEST_dump_properties, init_by_options_failed) { +TEST_F(UTEST_dump_properties, init_by_options_success_3) { DumpProperties dp; std::map options {{OPTION_EXEC_ENABLE_DUMP_DEBUG, "1"}, {OPTION_EXEC_DUMP_PATH, "/tmp/"}}; GetThreadLocalContext().SetGlobalOption(options); Status st = dp.InitByOptions(); - EXPECT_NE(st, SUCCESS); + EXPECT_EQ(st, SUCCESS); } } // namespace ge \ No newline at end of file