未验证 提交 ef67c8a8 编写于 作者: R risemeup1 提交者: GitHub

Fix bug (#47621)

* 修改.gitigore文件,把ljd_sh文件忽略掉

* 取消ljd_sh文件忽略

* fix ci bug

* fix windows ci bug

* fix bug ci

* fix bug test

* fix bug test
上级 1568d64f
...@@ -2539,6 +2539,7 @@ set -x ...@@ -2539,6 +2539,7 @@ set -x
bash $PADDLE_ROOT/tools/check_added_ut.sh bash $PADDLE_ROOT/tools/check_added_ut.sh
#check change of pr_unnitests and dev_unnitests #check change of pr_unnitests and dev_unnitests
check_approvals_of_unittest 2 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 if [ ${PRECISION_TEST:-OFF} == "ON" ]; then
python3.7 $PADDLE_ROOT/tools/get_pr_ut.py python3.7 $PADDLE_ROOT/tools/get_pr_ut.py
fi fi
...@@ -2571,7 +2572,6 @@ set +x ...@@ -2571,7 +2572,6 @@ set +x
mkdir -p ${PADDLE_ROOT}/build/Testing/Temporary/ mkdir -p ${PADDLE_ROOT}/build/Testing/Temporary/
cp -r ${PADDLE_ROOT}/build/CTestCostData.txt ${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 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 test_cases=$(ctest -N -V) # get all test cases
......
...@@ -280,11 +280,12 @@ class PRChecker(object): ...@@ -280,11 +280,12 @@ class PRChecker(object):
def file_is_unnit_test(self, unittest_path): def file_is_unnit_test(self, unittest_path):
# get all testcases by ctest-N # get all testcases by ctest-N
all_ut_file = '%s/build/all_ut_file' % PADDLE_ROOT all_ut_file = PADDLE_ROOT + 'build/all_ut_list'
os.system( # all_ut_file = '%s/build/all_ut_file' % PADDLE_ROOT
"cd %s/build && ctest -N | awk -F ': ' '{print $2}' | sed '/^$/d' | sed '$d' > %s" print("PADDLE_ROOT:", PADDLE_ROOT)
% (PADDLE_ROOT, all_ut_file) 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) (unittest_directory, unittest_name) = os.path.split(unittest_path)
# determine whether filename is in all_ut_case # determine whether filename is in all_ut_case
with open(all_ut_file, 'r') as f: with open(all_ut_file, 'r') as f:
...@@ -293,8 +294,7 @@ class PRChecker(object): ...@@ -293,8 +294,7 @@ class PRChecker(object):
test = test.replace('\n', '').strip() test = test.replace('\n', '').strip()
if test == unittest_name.split(".")[0]: if test == unittest_name.split(".")[0]:
return True return True
else: return False
return False
def get_pr_ut(self): def get_pr_ut(self):
"""Get unit tests in pull request.""" """Get unit tests in pull request."""
...@@ -410,17 +410,17 @@ class PRChecker(object): ...@@ -410,17 +410,17 @@ class PRChecker(object):
# determine whether the new added file is a member of added_ut # determine whether the new added file is a member of added_ut
if file_dict[f] in ['added']: if file_dict[f] in ['added']:
f_judge_in_added_ut = False f_judge_in_added_ut = False
with open( path = PADDLE_ROOT + 'added_ut'
'{}/added_ut'.format(PADDLE_ROOT) print("PADDLE_ROOT:", PADDLE_ROOT)
) as utfile: print("adde_ut path:", path)
(filepath, tempfilename) = os.path.split( (unittest_directory, unittest_name) = os.path.split(
f_judge f_judge
) )
for f_file in utfile: with open(path, 'r') as f:
if ( added_unittests = f.readlines()
f_file.strip('\n') for test in added_unittests:
== tempfilename.split(".")[0] test = test.replace('\n', '').strip()
): if test == unittest_name.split(".")[0]:
f_judge_in_added_ut = True f_judge_in_added_ut = True
if f_judge_in_added_ut: if f_judge_in_added_ut:
print( print(
......
...@@ -280,7 +280,7 @@ rm -rf $PADDLE_ROOT/tools/check_added_ut_win.sh ...@@ -280,7 +280,7 @@ rm -rf $PADDLE_ROOT/tools/check_added_ut_win.sh
if [ -f "$PADDLE_ROOT/added_ut" ];then if [ -f "$PADDLE_ROOT/added_ut" ];then
added_uts=^$(awk BEGIN{RS=EOF}'{gsub(/\n/,"$|^");print}' $PADDLE_ROOT/added_ut)$ 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=$? 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 if [ "$added_ut_error" != 0 ];then
echo "========================================" echo "========================================"
echo "Added UT should pass three additional executions" echo "Added UT should pass three additional executions"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册