未验证 提交 121658d2 编写于 作者: Y YUNSHEN XIE 提交者: GitHub

Support xpu ut coverage (#29892)

* add xpu_coverage function

* xpu coverage ipipe only deal with xpu files

* fix import error

* fix format error

* 'fix format error'

* fix format error

* fix error

* fix format error

* fix format error
上级 5a4e42ca
......@@ -1876,6 +1876,11 @@ function main() {
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
parallel_test
;;
check_xpu_coverage)
cmake_gen_and_build ${PYTHON_ABI:-""} ${parallel_number}
parallel_test
check_coverage
;;
cmake_gen)
cmake_gen ${PYTHON_ABI:-""}
;;
......
......@@ -60,7 +60,31 @@ function gen_full_html_report() {
mv -f coverage-full.tmp coverage-full.info
}
gen_full_html_report || true
function gen_full_html_report_xpu() {
lcov --extract coverage.info \
'/paddle/paddle/fluid/operators/*xpu*' \
-o coverage-full.tmp \
--rc lcov_branch_coverage=0
mv -f coverage-full.tmp coverage-full.info
lcov --remove coverage-full.info \
'/paddle/paddle/fluid/framework/*_test*' \
'/paddle/paddle/fluid/*/*test*' \
'/paddle/paddle/fluid/*/*/*test*' \
'/paddle/paddle/fluid/inference/tests/*' \
'/paddle/paddle/fluid/inference/api/demo_ci/*' \
-o coverage-full.tmp \
--rc lcov_branch_coverage=0
mv -f coverage-full.tmp coverage-full.info
}
if [ ${WITH_XPU:-OFF} == "ON" ]; then
gen_full_html_report_xpu || true
else
gen_full_html_report || true
fi
# diff html report
......@@ -154,7 +178,11 @@ python3.7 ${PADDLE_ROOT}/tools/coverage/coverage_lines.py coverage-diff.info 0.9
echo "Assert Python Diff Coverage"
python3.7 ${PADDLE_ROOT}/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9 || PYTHON_COVERAGE_LINES_ASSERT=1
if [ ${WITH_XPU:-OFF} == "ON" ]; then
echo "XPU has no python coverage!"
else
python3.7 ${PADDLE_ROOT}/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9 || PYTHON_COVERAGE_LINES_ASSERT=1
fi
if [ "$COVERAGE_LINES_ASSERT" = "1" ] || [ "$PYTHON_COVERAGE_LINES_ASSERT" = "1" ]; then
echo "exit 9" > /tmp/paddle_coverage.result
......
......@@ -21,6 +21,8 @@ import paddle
import paddle.fluid as fluid
import importlib
from six.moves import cStringIO
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
import static_mode_white_list
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册