Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
afd8cc42
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
afd8cc42
编写于
2月 22, 2023
作者:
Y
YUNSHEN XIE
提交者:
GitHub
2月 22, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix coverage combine bug (#50544)
* fix coverage combine bug * update
上级
7d077000
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
23 deletion
+26
-23
tools/coverage/paddle_coverage_new.sh
tools/coverage/paddle_coverage_new.sh
+26
-23
未找到文件。
tools/coverage/paddle_coverage_new.sh
浏览文件 @
afd8cc42
...
...
@@ -29,12 +29,13 @@ function lcov_init(){
tar
-xf
/home/lcov-1.14.tar.gz
-C
/
cd
/lcov-1.14
make
install
cd
-
}
function
gen_cpp_covinfo
(){
# run paddle coverage
cd
/paddle/build
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/gcda_clean.py
${
GIT_PR_ID
}
||
exit
101
python
${
PADDLE_ROOT
}
/tools/coverage/gcda_clean.py
${
GIT_PR_ID
}
||
exit
101
lcov
--capture
-d
./
-o
coverage.info
--rc
lcov_branch_coverage
=
0
}
...
...
@@ -126,9 +127,9 @@ function gen_full_html_report_npu() {
function
gen_diff_html_report
()
{
if
[
"
${
GIT_PR_ID
}
"
!=
""
]
;
then
COVERAGE_DIFF_PATTERN
=
"
`
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py files
${
GIT_PR_ID
}
`
"
COVERAGE_DIFF_PATTERN
=
"
`
python
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py files
${
GIT_PR_ID
}
`
"
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py diff
${
GIT_PR_ID
}
>
git-diff.out
python
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py diff
${
GIT_PR_ID
}
>
git-diff.out
fi
lcov
--extract
coverage-full.info
\
...
...
@@ -136,7 +137,7 @@ function gen_diff_html_report() {
-o
coverage-diff.info
\
--rc
lcov_branch_coverage
=
0
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/coverage_diff.py coverage-diff.info git-diff.out
>
coverage-diff.tmp
python
${
PADDLE_ROOT
}
/tools/coverage/coverage_diff.py coverage-diff.info git-diff.out
>
coverage-diff.tmp
mv
-f
coverage-diff.tmp coverage-diff.info
...
...
@@ -149,10 +150,10 @@ function gen_py_covinfo(){
# python coverage
export
COVERAGE_FILE
=
/paddle/build/python-coverage.data
coverage combine
`
$(
ls
python-coverage.data.
*
)
`
||
NO_PYTHON_COVERAGE_DATA
=
1
`
$(
coverage xml
-i
-o
python-coverage.xml
)
`
||
[[
"
${
NO_PYTHON_COVERAGE_DATA
}
"
==
"1"
]]
coverage combine
$(
ls
python-coverage.data.
*
)
||
NO_PYTHON_COVERAGE_DATA
=
1
$(
coverage xml
-i
-o
python-coverage.xml
)
||
[[
"
${
NO_PYTHON_COVERAGE_DATA
}
"
==
"1"
]]
sed
-i
's/mnt\/paddle/paddle/g'
python-coverage.xml
`
$(
python
${
PADDLE_ROOT
}
/tools/coverage/python_coverage.py
>
python-coverage.info
)
`
||
[[
"
${
NO_PYTHON_COVERAGE_DATA
}
"
==
"1"
]]
$(
python
${
PADDLE_ROOT
}
/tools/coverage/python_coverage.py
>
python-coverage.info
)
||
[[
"
${
NO_PYTHON_COVERAGE_DATA
}
"
==
"1"
]]
}
...
...
@@ -180,9 +181,9 @@ function gen_python_full_html_report() {
function
gen_python_diff_html_report
()
{
if
[
"
${
GIT_PR_ID
}
"
!=
""
]
;
then
COVERAGE_DIFF_PATTERN
=
"
`
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py files
${
GIT_PR_ID
}
`
"
COVERAGE_DIFF_PATTERN
=
"
`
python
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py files
${
GIT_PR_ID
}
`
"
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py diff
${
GIT_PR_ID
}
>
python-git-diff.out
python
${
PADDLE_ROOT
}
/tools/coverage/pull_request.py diff
${
GIT_PR_ID
}
>
python-git-diff.out
fi
lcov
--extract
python-coverage-full.info
\
...
...
@@ -190,7 +191,7 @@ function gen_python_diff_html_report() {
-o
python-coverage-diff.info
\
--rc
lcov_branch_coverage
=
0
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/coverage_diff.py python-coverage-diff.info python-git-diff.out
>
python-coverage-diff.tmp
python
${
PADDLE_ROOT
}
/tools/coverage/coverage_diff.py python-coverage-diff.info python-git-diff.out
>
python-coverage-diff.tmp
mv
-f
python-coverage-diff.tmp python-coverage-diff.info
...
...
@@ -207,34 +208,36 @@ function gen_python_diff_html_report() {
# assert coverage lines
function
covinfo_combine_full
(){
if
[
-f
"other-coverage.info"
]
;
then
if
[
-f
"infer-coverage.info"
]
;
then
if
[
-f
"other-coverage.info"
]
&&
[
-s
"other-coverage.info"
]
;
then
if
[
-f
"infer-coverage.info"
]
&&
[
-s
"infer-coverage.info"
]
;
then
lcov
-a
other-coverage.info
-a
infer-coverage.info
-o
coverage.info
else
mv
other-coverage.info coverage.info
fi
elif
[
-f
"infer-coverage.info"
]
;
then
elif
[
-f
"infer-coverage.info"
]
&&
[
-s
"infer-coverage.info"
]
;
then
mv
infer-coverage.info coverage.info
else
echo
"Cannot found coverage.info"
fi
if
[
-f
"other-python-coverage
-full
.info"
]
;
then
if
[
-f
"infer-python-coverage
-full
.info"
]
;
then
lcov
-a
other-python-coverage
-full.info
-a
infer-python-coverage-full.info
-o
python-coverage-full
.info
if
[
-f
"other-python-coverage
.info"
]
&&
[
-s
"other-python-coverage
.info"
]
;
then
if
[
-f
"infer-python-coverage
.info"
]
&&
[
-s
"other-python-coverage
.info"
]
;
then
lcov
-a
other-python-coverage
.info
-a
infer-python-coverage.info
-o
python-coverage
.info
else
mv
other-python-coverage
-full.info python-coverage-full
.info
mv
other-python-coverage
.info python-coverage
.info
fi
elif
[
-f
"infer-coverage.info"
]
;
then
mv
infer-python-coverage
-full.info python-coverage-full
.info
elif
[
-f
"infer-
python-coverage.info"
]
&&
[
-s
"infer-python-
coverage.info"
]
;
then
mv
infer-python-coverage
.info python-coverage
.info
else
echo
"Cannot found python coverage.info"
fi
gen_python_full_html_report
||
true
gen_full_html_report
||
true
}
function
cov_rate_judge
(){
echo
"Assert CPP Diff Coverage"
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/coverage_lines.py coverage-diff.info 0.9
||
COVERAGE_LINES_ASSERT
=
1
python
${
PADDLE_ROOT
}
/tools/coverage/coverage_lines.py coverage-diff.info 0.9
||
COVERAGE_LINES_ASSERT
=
1
echo
"Assert Python Diff Coverage"
...
...
@@ -244,7 +247,7 @@ function cov_rate_judge(){
echo
"NPU has no python coverage!"
else
if
[[
python-coverage-diff.info
]]
;
then
python
3.7
${
PADDLE_ROOT
}
/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9
||
PYTHON_COVERAGE_LINES_ASSERT
=
1
python
${
PADDLE_ROOT
}
/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9
||
PYTHON_COVERAGE_LINES_ASSERT
=
1
fi
fi
if
[
"
$COVERAGE_LINES_ASSERT
"
=
"1"
]
||
[
"
$PYTHON_COVERAGE_LINES_ASSERT
"
=
"1"
]
;
then
...
...
@@ -273,8 +276,8 @@ function main () {
;;
combine_cov_info
)
covinfo_combine_full
gen_diff_html_report
gen_python_diff_html_report
gen_diff_html_report
||
true
gen_python_diff_html_report
||
true
cov_rate_judge
;;
*
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录