Skip to content

Commit 9f0411f

Browse files
authored
fix for no python coverage found (#33848)
* fix error for no python coverage data
1 parent e22701c commit 9f0411f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tools/coverage/paddle_coverage.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,11 @@ gen_diff_html_report || true
119119

120120
export COVERAGE_FILE=/paddle/build/python-coverage.data
121121

122-
set +x
123-
coverage combine `ls python-coverage.data.*`
124-
set -x
122+
coverage combine `$(ls python-coverage.data.*)` || NO_PYTHON_COVERAGE_DATA=1
125123

126-
coverage xml -i -o python-coverage.xml
124+
`$(coverage xml -i -o python-coverage.xml)` || [[ "${NO_PYTHON_COVERAGE_DATA}" == "1" ]]
127125

128-
python3.7 ${PADDLE_ROOT}/tools/coverage/python_coverage.py > python-coverage.info
126+
`$(python3.7 ${PADDLE_ROOT}/tools/coverage/python_coverage.py > python-coverage.info)` || [[ "${NO_PYTHON_COVERAGE_DATA}" == "1" ]]
129127

130128
# python full html report
131129
#
@@ -186,7 +184,9 @@ echo "Assert Python Diff Coverage"
186184
if [ ${WITH_XPU:-OFF} == "ON" ]; then
187185
echo "XPU has no python coverage!"
188186
else
189-
python3.7 ${PADDLE_ROOT}/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9 || PYTHON_COVERAGE_LINES_ASSERT=1
187+
if [[ "${NO_PYTHON_COVERAGE_DATA}" != "1" ]];then
188+
python3.7 ${PADDLE_ROOT}/tools/coverage/coverage_lines.py python-coverage-diff.info 0.9 || PYTHON_COVERAGE_LINES_ASSERT=1
189+
fi
190190
fi
191191

192192
if [ "$COVERAGE_LINES_ASSERT" = "1" ] || [ "$PYTHON_COVERAGE_LINES_ASSERT" = "1" ]; then

0 commit comments

Comments
 (0)