未验证 提交 bcddefef 编写于 作者: Z Zhaolong Xing 提交者: GitHub

[Fix Ut]: fix inference ut which exist bug on windows. (#25814)

* fix windows test
test=develop

* fix ci
test=develop
上级 5f30e57c
...@@ -140,7 +140,7 @@ set(DAM_SMALL_INSTALL_DIR "${INFERENCE_DEMO_INSTALL_DIR}/small_dam") ...@@ -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") 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 inference_analysis_test(test_analyzer_small_dam SRCS analyzer_dam_tester.cc
EXTRA_DEPS ${INFERENCE_EXTRA_DEPS} 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 #save model
inference_analysis_api_test(test_analyzer_save_model ${DAM_SMALL_INSTALL_DIR} analyzer_save_model_tester.cc) inference_analysis_api_test(test_analyzer_save_model ${DAM_SMALL_INSTALL_DIR} analyzer_save_model_tester.cc)
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include <vector>
#include "paddle/fluid/inference/analysis/helper.h"
#include "paddle/fluid/inference/tests/api/tester_helper.h" #include "paddle/fluid/inference/tests/api/tester_helper.h"
DEFINE_int32(max_turn_num, 9, const int FLAGS_max_turn_num = 1;
"The max turn number: 1 for the small and 9 for the normal.");
namespace paddle { namespace paddle {
namespace inference { namespace inference {
...@@ -300,7 +301,7 @@ TEST(Analyzer_dam, compare_determine) { ...@@ -300,7 +301,7 @@ TEST(Analyzer_dam, compare_determine) {
TEST(Analyzer_dam, save_optim_model) { TEST(Analyzer_dam, save_optim_model) {
AnalysisConfig cfg; AnalysisConfig cfg;
std::string optimModelPath = FLAGS_infer_model + "/saved_optim_model"; std::string optimModelPath = FLAGS_infer_model + "/saved_optim_model";
mkdir(optimModelPath.c_str(), 0777); MKDIR(optimModelPath.c_str());
SetConfig(&cfg); SetConfig(&cfg);
SaveOptimModel(&cfg, optimModelPath); SaveOptimModel(&cfg, optimModelPath);
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#include "paddle/fluid/inference/analysis/helper.h"
#include "paddle/fluid/inference/tests/api/tester_helper.h" #include "paddle/fluid/inference/tests/api/tester_helper.h"
namespace paddle { namespace paddle {
...@@ -36,7 +37,7 @@ TEST(Analyzer, save_model) { ...@@ -36,7 +37,7 @@ TEST(Analyzer, save_model) {
cfg.SetModel(FLAGS_infer_model + "/__model__", FLAGS_infer_model + "/param"); cfg.SetModel(FLAGS_infer_model + "/__model__", FLAGS_infer_model + "/param");
// ensure the path being unique // ensure the path being unique
std::string optimModelPath = FLAGS_infer_model + "/only_for_save_model_test"; std::string optimModelPath = FLAGS_infer_model + "/only_for_save_model_test";
mkdir(optimModelPath.c_str(), 0777); MKDIR(optimModelPath.c_str());
SaveOptimModel(&cfg, optimModelPath); SaveOptimModel(&cfg, optimModelPath);
// Each config can only be applied to one predictor. // Each config can only be applied to one predictor.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册