diff --git a/paddle/fluid/inference/tests/api/CMakeLists.txt b/paddle/fluid/inference/tests/api/CMakeLists.txt index 0125011b74a69db71121f9ead6e9c382ded0ce92..62c9dfa0d9d93560756642e6179510de7efc35c4 100644 --- a/paddle/fluid/inference/tests/api/CMakeLists.txt +++ b/paddle/fluid/inference/tests/api/CMakeLists.txt @@ -140,7 +140,7 @@ set(DAM_SMALL_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/small_dam") download_model_and_data(${DAM_SMALL_INSTALL_DIR} "dam_small_model.tar.gz" "dam_small_data.txt.tar.gz") inference_analysis_test(test_analyzer_small_dam SRCS analyzer_dam_tester.cc EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} - ARGS --infer_model=${DAM_SMALL_INSTALL_DIR}/model --infer_data=${DAM_SMALL_INSTALL_DIR}/data.txt --max_turn_num=1) + ARGS --infer_model=${DAM_SMALL_INSTALL_DIR}/model --infer_data=${DAM_SMALL_INSTALL_DIR}/data.txt) #save model inference_analysis_api_test(test_analyzer_save_model ${DAM_SMALL_INSTALL_DIR} analyzer_save_model_tester.cc) diff --git a/paddle/fluid/inference/tests/api/analyzer_dam_tester.cc b/paddle/fluid/inference/tests/api/analyzer_dam_tester.cc index 78c87b6db508c4eb49f74d3f87bdb83afc470208..00a475b6047e8215264c664dd3c775b9687eb0ff 100644 --- a/paddle/fluid/inference/tests/api/analyzer_dam_tester.cc +++ b/paddle/fluid/inference/tests/api/analyzer_dam_tester.cc @@ -12,10 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include "paddle/fluid/inference/analysis/helper.h" #include "paddle/fluid/inference/tests/api/tester_helper.h" -DEFINE_int32(max_turn_num, 9, - "The max turn number: 1 for the small and 9 for the normal."); +const int FLAGS_max_turn_num = 1; namespace paddle { namespace inference { @@ -300,7 +301,7 @@ TEST(Analyzer_dam, compare_determine) { TEST(Analyzer_dam, save_optim_model) { AnalysisConfig cfg; std::string optimModelPath = FLAGS_infer_model + "/saved_optim_model"; - mkdir(optimModelPath.c_str(), 0777); + MKDIR(optimModelPath.c_str()); SetConfig(&cfg); SaveOptimModel(&cfg, optimModelPath); } diff --git a/paddle/fluid/inference/tests/api/analyzer_save_model_tester.cc b/paddle/fluid/inference/tests/api/analyzer_save_model_tester.cc index 977b2ec885dcba8677a0705f698cd0200b789916..328c105f317ef8c8d7ae3a00282271d16f3f1d10 100644 --- a/paddle/fluid/inference/tests/api/analyzer_save_model_tester.cc +++ b/paddle/fluid/inference/tests/api/analyzer_save_model_tester.cc @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "paddle/fluid/inference/analysis/helper.h" #include "paddle/fluid/inference/tests/api/tester_helper.h" namespace paddle { @@ -36,7 +37,7 @@ TEST(Analyzer, save_model) { cfg.SetModel(FLAGS_infer_model + "/__model__", FLAGS_infer_model + "/param"); // ensure the path being unique std::string optimModelPath = FLAGS_infer_model + "/only_for_save_model_test"; - mkdir(optimModelPath.c_str(), 0777); + MKDIR(optimModelPath.c_str()); SaveOptimModel(&cfg, optimModelPath); // Each config can only be applied to one predictor.