Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
7e27b5aa
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
7e27b5aa
编写于
5月 20, 2021
作者:
Z
zhangchunle
提交者:
GitHub
5月 20, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
handle remove files in pr (#32940)
上级
14949521
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
65 addition
and
55 deletion
+65
-55
tools/get_pr_ut.py
tools/get_pr_ut.py
+65
-55
未找到文件。
tools/get_pr_ut.py
浏览文件 @
7e27b5aa
...
...
@@ -130,7 +130,10 @@ class PRChecker(object):
if
not
files
:
break
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
return
file_list
...
...
@@ -257,66 +260,73 @@ class PRChecker(object):
notHitMapFiles
=
[]
hitMapFiles
=
[]
onlyCommentsFilesOrXpu
=
[]
for
f
in
self
.
get_pr_files
():
if
current_system
==
"Darwin"
or
current_system
==
"Windows"
or
self
.
suffix
==
".py3"
:
f_judge
=
f
.
replace
(
PADDLE_ROOT
,
'/paddle/'
,
1
)
f_judge
=
f_judge
.
replace
(
'//'
,
'/'
)
else
:
f_judge
=
f
if
f_judge
not
in
file_ut_map
:
if
f_judge
.
endswith
(
'.md'
):
ut_list
.
append
(
'md_placeholder'
)
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'
)
file_list
=
self
.
get_pr_files
()
if
'removed'
in
file_list
:
print
(
"ipipe_log_param_PRECISION_TEST: false"
)
print
(
"notHitMapFiles: [rm file]"
)
return
''
else
:
for
f
in
file_list
:
if
current_system
==
"Darwin"
or
current_system
==
"Windows"
or
self
.
suffix
==
".py3"
:
f_judge
=
f
.
replace
(
PADDLE_ROOT
,
'/paddle/'
,
1
)
f_judge
=
f_judge
.
replace
(
'//'
,
'/'
)
else
:
f_judge
=
f
if
f_judge
not
in
file_ut_map
:
if
f_judge
.
endswith
(
'.md'
):
ut_list
.
append
(
'md_placeholder'
)
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
:
notHitMapFiles
.
append
(
f_judge
)
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
:
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
:
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
:
if
check_added_ut
:
with
open
(
'{}/added_ut'
.
format
(
PADDLE_ROOT
))
as
utfile
:
for
ut
in
utfile
:
ut_list
.
append
(
ut
.
rstrip
(
'
\r\n
'
))
else
:
print
(
'PREC download prec_delta failed'
)
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
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
'
))
else
:
print
(
'PREC download prec_delta failed'
)
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__'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录