未验证 提交 7e27b5aa 编写于 作者: Z zhangchunle 提交者: GitHub

handle remove files in pr (#32940)

上级 14949521
...@@ -130,7 +130,10 @@ class PRChecker(object): ...@@ -130,7 +130,10 @@ class PRChecker(object):
if not files: if not files:
break break
for f in files: for f in files:
file_list.append(PADDLE_ROOT + f.filename) if f.status == 'removed':
file_list.append('removed')
else:
file_list.append(PADDLE_ROOT + f.filename)
page += 1 page += 1
return file_list return file_list
...@@ -257,66 +260,73 @@ class PRChecker(object): ...@@ -257,66 +260,73 @@ class PRChecker(object):
notHitMapFiles = [] notHitMapFiles = []
hitMapFiles = [] hitMapFiles = []
onlyCommentsFilesOrXpu = [] onlyCommentsFilesOrXpu = []
for f in self.get_pr_files(): file_list = self.get_pr_files()
if current_system == "Darwin" or current_system == "Windows" or self.suffix == ".py3": if 'removed' in file_list:
f_judge = f.replace(PADDLE_ROOT, '/paddle/', 1) print("ipipe_log_param_PRECISION_TEST: false")
f_judge = f_judge.replace('//', '/') print("notHitMapFiles: [rm file]")
else: return ''
f_judge = f else:
if f_judge not in file_ut_map: for f in file_list:
if f_judge.endswith('.md'): if current_system == "Darwin" or current_system == "Windows" or self.suffix == ".py3":
ut_list.append('md_placeholder') f_judge = f.replace(PADDLE_ROOT, '/paddle/', 1)
onlyCommentsFilesOrXpu.append(f_judge) f_judge = f_judge.replace('//', '/')
elif 'tests/unittests/xpu' in f_judge or 'tests/unittests/npu' in f_judge: else:
ut_list.append('xpu_npu_placeholder') f_judge = f
onlyCommentsFilesOrXpu.append(f_judge) if f_judge not in file_ut_map:
elif f_judge.endswith(('.h', '.cu', '.cc', 'py')): if f_judge.endswith('.md'):
if f_judge.find('test_') != -1 or f_judge.find( ut_list.append('md_placeholder')
'_test') != -1:
check_added_ut = True
if self.is_only_comment(f):
ut_list.append('comment_placeholder')
onlyCommentsFilesOrXpu.append(f_judge) onlyCommentsFilesOrXpu.append(f_judge)
elif 'tests/unittests/xpu' in f_judge or 'tests/unittests/npu' in f_judge:
ut_list.append('xpu_npu_placeholder')
onlyCommentsFilesOrXpu.append(f_judge)
elif f_judge.endswith(('.h', '.cu', '.cc', 'py')):
if f_judge.find('test_') != -1 or f_judge.find(
'_test') != -1:
check_added_ut = True
if self.is_only_comment(f):
ut_list.append('comment_placeholder')
onlyCommentsFilesOrXpu.append(f_judge)
else:
notHitMapFiles.append(f_judge)
else: else:
notHitMapFiles.append(f_judge) notHitMapFiles.append(f_judge)
else: else:
notHitMapFiles.append(f_judge) if self.is_only_comment(f):
ut_list.append('comment_placeholder')
onlyCommentsFilesOrXpu.append(f_judge)
else:
hitMapFiles.append(f_judge)
ut_list.extend(file_ut_map.get(f_judge))
ut_list = list(set(ut_list))
if len(notHitMapFiles) != 0:
print("ipipe_log_param_PRECISION_TEST: false")
print("notHitMapFiles: %s" % notHitMapFiles)
return ''
else: else:
if self.is_only_comment(f): if check_added_ut:
ut_list.append('comment_placeholder') with open('{}/added_ut'.format(PADDLE_ROOT)) as utfile:
onlyCommentsFilesOrXpu.append(f_judge) for ut in utfile:
else:
hitMapFiles.append(f_judge)
ut_list.extend(file_ut_map.get(f_judge))
ut_list = list(set(ut_list))
if len(notHitMapFiles) != 0:
print("ipipe_log_param_PRECISION_TEST: false")
print("notHitMapFiles: %s" % notHitMapFiles)
return ''
else:
if check_added_ut:
with open('{}/added_ut'.format(PADDLE_ROOT)) as utfile:
for ut in utfile:
ut_list.append(ut.rstrip('\r\n'))
if ut_list:
ret = self.__urlretrieve(
'https://paddle-docker-tar.bj.bcebos.com/pre_test/prec_delta',
'prec_delta')
if ret:
with open('prec_delta') as delta:
for ut in delta:
ut_list.append(ut.rstrip('\r\n')) ut_list.append(ut.rstrip('\r\n'))
else: if ut_list:
print('PREC download prec_delta failed') ret = self.__urlretrieve(
exit(1) 'https://paddle-docker-tar.bj.bcebos.com/pre_test/prec_delta',
print("ipipe_log_param_PRECISION_TEST: true") 'prec_delta')
print("ipipe_log_param_PRECISION_TEST_Cases_count: %s" % if ret:
len(ut_list)) with open('prec_delta') as delta:
PRECISION_TEST_Cases_ratio = format( for ut in delta:
float(len(ut_list)) / float(self.get_all_count()), '.2f') ut_list.append(ut.rstrip('\r\n'))
print("ipipe_log_param_PRECISION_TEST_Cases_ratio: %s" % else:
PRECISION_TEST_Cases_ratio) print('PREC download prec_delta failed')
return '\n'.join(ut_list) exit(1)
print("ipipe_log_param_PRECISION_TEST: true")
print("ipipe_log_param_PRECISION_TEST_Cases_count: %s" %
len(ut_list))
PRECISION_TEST_Cases_ratio = format(
float(len(ut_list)) / float(self.get_all_count()),
'.2f')
print("ipipe_log_param_PRECISION_TEST_Cases_ratio: %s" %
PRECISION_TEST_Cases_ratio)
return '\n'.join(ut_list)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册