Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
0c9605db
P
Paddle
项目概览
Crayon鑫
/
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看板
提交
0c9605db
编写于
5月 31, 2021
作者:
Z
zhangchunle
提交者:
GitHub
5月 31, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "update get_pr_ut.py (#33037)"
This reverts commit
9066b578
.
上级
9066b578
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
68 deletion
+21
-68
paddle/scripts/paddle_build.sh
paddle/scripts/paddle_build.sh
+1
-0
tools/get_pr_ut.py
tools/get_pr_ut.py
+20
-68
未找到文件。
paddle/scripts/paddle_build.sh
浏览文件 @
0c9605db
...
...
@@ -1578,6 +1578,7 @@ 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
浏览文件 @
0c9605db
...
...
@@ -124,34 +124,18 @@ class PRChecker(object):
def
get_pr_files
(
self
):
""" Get files in pull request. """
page
=
0
file_
dict
=
{}
file_
list
=
[]
while
True
:
files
=
self
.
pr
.
get_files
().
get_page
(
page
)
if
not
files
:
break
for
f
in
files
:
file_dict
[
PADDLE_ROOT
+
f
.
filename
]
=
f
.
status
if
f
.
status
==
'removed'
:
file_list
.
append
(
'removed'
)
else
:
file_list
.
append
(
PADDLE_ROOT
+
f
.
filename
)
page
+=
1
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
return
file_list
def
__get_comment_by_filetype
(
self
,
content
,
filetype
):
result
=
[]
...
...
@@ -263,41 +247,24 @@ 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
=
[]
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
)
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"
:
...
...
@@ -316,36 +283,24 @@ 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
:
hitMapFiles
[
f_judge
]
=
len
(
file_ut_map
[
f_judge
])
ut_list
.
extend
(
file_ut_map
.
get
(
f_judge
))
notHitMapFiles
.
append
(
f_judge
)
else
:
hitMapFiles
[
f_judge
]
=
len
(
file_ut_map
[
f_judge
])
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
)
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
:
...
...
@@ -363,7 +318,6 @@ 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
))
...
...
@@ -372,8 +326,6 @@ 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
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录