Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9066b578
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9066b578
编写于
5月 31, 2021
作者:
Z
zhangchunle
提交者:
GitHub
5月 31, 2021
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update get_pr_ut.py (#33037)
上级
2a771c06
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
68 addition
and
21 deletion
+68
-21
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+0
-1
tools/get_pr_ut.py
tools/get_pr_ut.py
+68
-20
未找到文件。
paddle/scripts/paddle_build.sh
浏览文件 @
9066b578
...
...
@@ -1578,7 +1578,6 @@ set -x
#analy h/cu to Map file
python
${
PADDLE_ROOT
}
/tools/handle_h_cu_file.py
'analy_h_cu_file'
$tmp_dir
${
PADDLE_ROOT
}
#generate ut map
python
${
PADDLE_ROOT
}
/tools/get_ut_file_map.py
'get_ut_map'
${
PADDLE_ROOT
}
wait
;
...
...
tools/get_pr_ut.py
浏览文件 @
9066b578
...
...
@@ -124,18 +124,34 @@ class PRChecker(object):
def
get_pr_files
(
self
):
""" Get files in pull request. """
page
=
0
file_
list
=
[]
file_
dict
=
{}
while
True
:
files
=
self
.
pr
.
get_files
().
get_page
(
page
)
if
not
files
:
break
for
f
in
files
:
if
f
.
status
==
'removed'
:
file_list
.
append
(
'removed'
)
else
:
file_list
.
append
(
PADDLE_ROOT
+
f
.
filename
)
file_dict
[
PADDLE_ROOT
+
f
.
filename
]
=
f
.
status
page
+=
1
return
file_list
print
(
"pr modify files: %s"
%
file_dict
)
return
file_dict
def
get_is_white_file
(
self
,
filename
):
""" judge is white file in pr's files. """
isWhiteFile
=
False
white_files
=
(
PADDLE_ROOT
+
'cmake/'
,
PADDLE_ROOT
+
'patches/'
,
PADDLE_ROOT
+
'tools/dockerfile/'
,
PADDLE_ROOT
+
'tools/windows/'
,
PADDLE_ROOT
+
'tools/test_runner.py'
,
PADDLE_ROOT
+
'tools/parallel_UT_rule.py'
,
PADDLE_ROOT
+
'paddle/scripts/paddle_build.sh'
,
PADDLE_ROOT
+
'paddle/scripts/paddle_build.bat'
)
if
'cmakelist'
in
filename
.
lower
():
isWhiteFile
=
False
elif
filename
.
startswith
((
white_files
)):
isWhiteFile
=
False
else
:
isWhiteFile
=
True
return
isWhiteFile
def
__get_comment_by_filetype
(
self
,
content
,
filetype
):
result
=
[]
...
...
@@ -247,24 +263,41 @@ class PRChecker(object):
check_added_ut
=
False
ut_list
=
[]
file_ut_map
=
None
ret
=
self
.
__urlretrieve
(
'https://paddle-docker-tar.bj.bcebos.com/pre_test/ut_file_map.json'
,
'ut_file_map.json'
)
if
not
ret
:
print
(
'PREC download file_ut.json failed'
)
exit
(
1
)
with
open
(
'ut_file_map.json'
)
as
jsonfile
:
file_ut_map
=
json
.
load
(
jsonfile
)
current_system
=
platform
.
system
()
notHitMapFiles
=
[]
hitMapFiles
=
[]
hitMapFiles
=
{}
onlyCommentsFilesOrXpu
=
[]
file_list
=
self
.
get_pr_files
()
if
'removed'
in
file_list
:
print
(
"ipipe_log_param_PRECISION_TEST: false"
)
print
(
"notHitMapFiles: [rm file]"
)
return
''
filterFiles
=
[]
file_list
=
[]
file_dict
=
self
.
get_pr_files
()
for
filename
in
file_dict
:
if
filename
.
startswith
(
(
PADDLE_ROOT
+
'python/'
,
PADDLE_ROOT
+
'paddle/fluid/'
)):
file_list
.
append
(
filename
)
else
:
isWhiteFile
=
self
.
get_is_white_file
(
filename
)
if
isWhiteFile
==
False
:
file_list
.
append
(
filename
)
else
:
filterFiles
.
append
(
filename
)
if
len
(
file_list
)
==
0
:
ut_list
.
append
(
'filterfiles_placeholder'
)
print
(
"filterFiles: %s"
%
filterFiles
)
print
(
"ipipe_log_param_PRECISION_TEST: true"
)
print
(
"ipipe_log_param_PRECISION_TEST_Cases_count: 0"
)
print
(
"ipipe_log_param_PRECISION_TEST_Cases_ratio: 0"
)
return
'
\n
'
.
join
(
ut_list
)
else
:
for
f
in
file_list
:
if
current_system
==
"Darwin"
or
current_system
==
"Windows"
or
self
.
suffix
==
".py3"
:
...
...
@@ -283,24 +316,36 @@ class PRChecker(object):
if
f_judge
.
find
(
'test_'
)
!=
-
1
or
f_judge
.
find
(
'_test'
)
!=
-
1
:
check_added_ut
=
True
if
file_dict
[
f
]
not
in
[
'removed'
]:
if
self
.
is_only_comment
(
f
):
ut_list
.
append
(
'comment_placeholder'
)
onlyCommentsFilesOrXpu
.
append
(
f_judge
)
else
:
notHitMapFiles
.
append
(
f_judge
)
else
:
print
(
"remove file not hit mapFiles: %s"
%
f_judge
)
else
:
notHitMapFiles
.
append
(
f_judge
)
if
file_dict
[
f
]
!=
'removed'
else
print
(
"remove file not hit mapFiles: %s"
%
f_judge
)
else
:
if
file_dict
[
f
]
not
in
[
'removed'
]:
if
self
.
is_only_comment
(
f
):
ut_list
.
append
(
'comment_placeholder'
)
onlyCommentsFilesOrXpu
.
append
(
f_judge
)
else
:
notHitMapFiles
.
append
(
f_judge
)
hitMapFiles
[
f_judge
]
=
len
(
file_ut_map
[
f_judge
])
ut_list
.
extend
(
file_ut_map
.
get
(
f_judge
))
else
:
notHitMapFiles
.
append
(
f_judge
)
else
:
if
self
.
is_only_comment
(
f
):
ut_list
.
append
(
'comment_placeholder'
)
onlyCommentsFilesOrXpu
.
append
(
f_judge
)
else
:
hitMapFiles
.
append
(
f_judge
)
hitMapFiles
[
f_judge
]
=
len
(
file_ut_map
[
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
)
if
len
(
filterFiles
)
!=
0
:
print
(
"filterFiles: %s"
%
filterFiles
)
return
''
else
:
if
check_added_ut
:
...
...
@@ -318,6 +363,7 @@ class PRChecker(object):
else
:
print
(
'PREC download prec_delta failed'
)
exit
(
1
)
print
(
"hitMapFiles: %s"
%
hitMapFiles
)
print
(
"ipipe_log_param_PRECISION_TEST: true"
)
print
(
"ipipe_log_param_PRECISION_TEST_Cases_count: %s"
%
len
(
ut_list
))
...
...
@@ -326,6 +372,8 @@ class PRChecker(object):
'.2f'
)
print
(
"ipipe_log_param_PRECISION_TEST_Cases_ratio: %s"
%
PRECISION_TEST_Cases_ratio
)
if
len
(
filterFiles
)
!=
0
:
print
(
"filterFiles: %s"
%
filterFiles
)
return
'
\n
'
.
join
(
ut_list
)
...
...
saxon_zh
@saxon_zh
mentioned in commit
0c9605db
·
6月 01, 2021
mentioned in commit
0c9605db
mentioned in commit 0c9605dbf005bc35450cda330510362d8f459587
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录