|
|
@ -5,7 +5,7 @@ set -xe
|
|
|
|
PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )"
|
|
|
|
PADDLE_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )"
|
|
|
|
|
|
|
|
|
|
|
|
# install lcov
|
|
|
|
# install lcov
|
|
|
|
curl -o /lcov-1.14.tar.gz -x "" -s https://paddle-ci.gz.bcebos.com/coverage/lcov-1.14.tar.gz
|
|
|
|
curl -o /lcov-1.14.tar.gz -s https://paddle-ci.gz.bcebos.com/coverage%2Flcov-1.14.tar.gz
|
|
|
|
tar -xf /lcov-1.14.tar.gz -C /
|
|
|
|
tar -xf /lcov-1.14.tar.gz -C /
|
|
|
|
cd /lcov-1.14
|
|
|
|
cd /lcov-1.14
|
|
|
|
make install
|
|
|
|
make install
|
|
|
@ -14,7 +14,7 @@ make install
|
|
|
|
|
|
|
|
|
|
|
|
cd /paddle/build
|
|
|
|
cd /paddle/build
|
|
|
|
|
|
|
|
|
|
|
|
python ${PADDLE_ROOT}/tools/coverage/gcda_clean.py ${GIT_PR_ID}
|
|
|
|
python3 ${PADDLE_ROOT}/tools/coverage/gcda_clean.py ${GIT_PR_ID}
|
|
|
|
|
|
|
|
|
|
|
|
lcov --capture -d ./ -o coverage.info --rc lcov_branch_coverage=0
|
|
|
|
lcov --capture -d ./ -o coverage.info --rc lcov_branch_coverage=0
|
|
|
|
|
|
|
|
|
|
|
@ -53,9 +53,9 @@ gen_full_html_report || true
|
|
|
|
function gen_diff_html_report() {
|
|
|
|
function gen_diff_html_report() {
|
|
|
|
if [ "${GIT_PR_ID}" != "" ]; then
|
|
|
|
if [ "${GIT_PR_ID}" != "" ]; then
|
|
|
|
|
|
|
|
|
|
|
|
COVERAGE_DIFF_PATTERN="`python ${PADDLE_ROOT}/tools/coverage/pull_request.py files ${GIT_PR_ID}`"
|
|
|
|
COVERAGE_DIFF_PATTERN="`python3 ${PADDLE_ROOT}/tools/coverage/pull_request.py files ${GIT_PR_ID}`"
|
|
|
|
|
|
|
|
|
|
|
|
python ${PADDLE_ROOT}/tools/coverage/pull_request.py diff ${GIT_PR_ID} > git-diff.out
|
|
|
|
python3 ${PADDLE_ROOT}/tools/coverage/pull_request.py diff ${GIT_PR_ID} > git-diff.out
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
lcov --extract coverage-full.info \
|
|
|
|
lcov --extract coverage-full.info \
|
|
|
@ -63,7 +63,7 @@ function gen_diff_html_report() {
|
|
|
|
-o coverage-diff.info \
|
|
|
|
-o coverage-diff.info \
|
|
|
|
--rc lcov_branch_coverage=0
|
|
|
|
--rc lcov_branch_coverage=0
|
|
|
|
|
|
|
|
|
|
|
|
python ${PADDLE_ROOT}/tools/coverage/coverage_diff.py coverage-diff.info git-diff.out > coverage-diff.tmp
|
|
|
|
python3 ${PADDLE_ROOT}/tools/coverage/coverage_diff.py coverage-diff.info git-diff.out > coverage-diff.tmp
|
|
|
|
|
|
|
|
|
|
|
|
mv -f coverage-diff.tmp coverage-diff.info
|
|
|
|
mv -f coverage-diff.tmp coverage-diff.info
|
|
|
|
|
|
|
|
|
|
|
@ -82,7 +82,7 @@ set -x
|
|
|
|
|
|
|
|
|
|
|
|
coverage xml -i -o python-coverage.xml
|
|
|
|
coverage xml -i -o python-coverage.xml
|
|
|
|
|
|
|
|
|
|
|
|
python ${PADDLE_ROOT}/tools/coverage/python_coverage.py > python-coverage.info
|
|
|
|
python3 ${PADDLE_ROOT}/tools/coverage/python_coverage.py > python-coverage.info
|
|
|
|
|
|
|
|
|
|
|
|
# python full html report
|
|
|
|
# python full html report
|
|
|
|
#
|
|
|
|
#
|
|
|
@ -143,5 +143,6 @@ echo "Assert Python Diff Coverage"
|
|
|
|
python ${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
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$COVERAGE_LINES_ASSERT" = "1" ] || [ "$PYTHON_COVERAGE_LINES_ASSERT" = "1" ]; then
|
|
|
|
if [ "$COVERAGE_LINES_ASSERT" = "1" ] || [ "$PYTHON_COVERAGE_LINES_ASSERT" = "1" ]; then
|
|
|
|
|
|
|
|
echo "exit 9" > /tmp/paddle_coverage.result
|
|
|
|
exit 9
|
|
|
|
exit 9
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|