From ef67c8a825482e43180413c30dcc75c7a02eb78e Mon Sep 17 00:00:00 2001 From: risemeup1 <62429225+risemeup1@users.noreply.github.com> Date: Fri, 4 Nov 2022 19:23:17 +0800 Subject: [PATCH] Fix bug (#47621) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修改.gitigore文件,把ljd_sh文件忽略掉 * 取消ljd_sh文件忽略 * fix ci bug * fix windows ci bug * fix bug ci * fix bug test * fix bug test --- paddle/scripts/paddle_build.sh | 2 +- tools/get_pr_ut.py | 36 +++++++++++++++++----------------- tools/windows/run_unittests.sh | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 8b0bed07f6..ea49bbd581 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -2539,6 +2539,7 @@ set -x bash $PADDLE_ROOT/tools/check_added_ut.sh #check change of pr_unnitests and dev_unnitests check_approvals_of_unittest 2 + ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > ${PADDLE_ROOT}/build/all_ut_list if [ ${PRECISION_TEST:-OFF} == "ON" ]; then python3.7 $PADDLE_ROOT/tools/get_pr_ut.py fi @@ -2571,7 +2572,6 @@ set +x mkdir -p ${PADDLE_ROOT}/build/Testing/Temporary/ cp -r ${PADDLE_ROOT}/build/CTestCostData.txt ${PADDLE_ROOT}/build/Testing/Temporary/ - ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > all_ut_list get_quickly_disable_ut||disable_ut_quickly='disable_ut' # indicate whether the case was in quickly disable list test_cases=$(ctest -N -V) # get all test cases diff --git a/tools/get_pr_ut.py b/tools/get_pr_ut.py index 3fee302aa4..d3a1c41682 100644 --- a/tools/get_pr_ut.py +++ b/tools/get_pr_ut.py @@ -280,11 +280,12 @@ class PRChecker(object): def file_is_unnit_test(self, unittest_path): # get all testcases by ctest-N - all_ut_file = '%s/build/all_ut_file' % PADDLE_ROOT - os.system( - "cd %s/build && ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > %s" - % (PADDLE_ROOT, all_ut_file) - ) + all_ut_file = PADDLE_ROOT + 'build/all_ut_list' + # all_ut_file = '%s/build/all_ut_file' % PADDLE_ROOT + print("PADDLE_ROOT:", PADDLE_ROOT) + print("all_ut_file path:", all_ut_file) + build_path = PADDLE_ROOT + 'build/' + print("build_path:", build_path) (unittest_directory, unittest_name) = os.path.split(unittest_path) # determine whether filename is in all_ut_case with open(all_ut_file, 'r') as f: @@ -293,8 +294,7 @@ class PRChecker(object): test = test.replace('\n', '').strip() if test == unittest_name.split(".")[0]: return True - else: - return False + return False def get_pr_ut(self): """Get unit tests in pull request.""" @@ -410,17 +410,17 @@ class PRChecker(object): # determine whether the new added file is a member of added_ut if file_dict[f] in ['added']: f_judge_in_added_ut = False - with open( - '{}/added_ut'.format(PADDLE_ROOT) - ) as utfile: - (filepath, tempfilename) = os.path.split( - f_judge - ) - for f_file in utfile: - if ( - f_file.strip('\n') - == tempfilename.split(".")[0] - ): + path = PADDLE_ROOT + 'added_ut' + print("PADDLE_ROOT:", PADDLE_ROOT) + print("adde_ut path:", path) + (unittest_directory, unittest_name) = os.path.split( + f_judge + ) + with open(path, 'r') as f: + added_unittests = f.readlines() + for test in added_unittests: + test = test.replace('\n', '').strip() + if test == unittest_name.split(".")[0]: f_judge_in_added_ut = True if f_judge_in_added_ut: print( diff --git a/tools/windows/run_unittests.sh b/tools/windows/run_unittests.sh index ac70fc0b75..6f2e84f427 100644 --- a/tools/windows/run_unittests.sh +++ b/tools/windows/run_unittests.sh @@ -280,7 +280,7 @@ rm -rf $PADDLE_ROOT/tools/check_added_ut_win.sh if [ -f "$PADDLE_ROOT/added_ut" ];then added_uts=^$(awk BEGIN{RS=EOF}'{gsub(/\n/,"$|^");print}' $PADDLE_ROOT/added_ut)$ ctest -R "(${added_uts})" -E "${disable_win_inference_test}" --output-on-failure -C Release --repeat-until-fail 3;added_ut_error=$? - rm -f $PADDLE_ROOT/added_ut + #rm -f $PADDLE_ROOT/added_ut if [ "$added_ut_error" != 0 ];then echo "========================================" echo "Added UT should pass three additional executions" -- GitLab