Skip to content

Commit

Permalink
check python-coverage-diff.info empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Bowen12992 committed Aug 22, 2024
1 parent b5c3231 commit ec8f361
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions tools/code_coverage/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -ex
set -e

echo " Usage: $0 pull_request_id "
echo "PR_ID: $1"
Expand All @@ -13,16 +13,16 @@ FlagGemsROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )"
echo ${FlagGemsROOT}

cmds=(
"CUDA_VISIBLE_DEVICES=0 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests,./tools/code_coverage -m pytest -s tests/test_unary_pointwise_ops.py::test_accuracy_abs &"
# "CUDA_VISIBLE_DEVICES=0 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_pointwise_type_promotion.py &"
# "CUDA_VISIBLE_DEVICES=1 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_binary_pointwise_ops.py &"
# "CUDA_VISIBLE_DEVICES=1 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_tensor_constructor_ops.py &"
# "CUDA_VISIBLE_DEVICES=1 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_distribution_ops.py &"
# "CUDA_VISIBLE_DEVICES=2 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_blas_ops.py &"
# "CUDA_VISIBLE_DEVICES=3 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_reduction_ops.py &"
# "CUDA_VISIBLE_DEVICES=4 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_special_ops.py &"
# "CUDA_VISIBLE_DEVICES=5 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_libentry.py &"
# "CUDA_VISIBLE_DEVICES=5 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s examples/model_bert_test.py &"
"CUDA_VISIBLE_DEVICES=3 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_unary_pointwise_ops.py::test_accuracy_abs &"
"CUDA_VISIBLE_DEVICES=3 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_pointwise_type_promotion.py &"
"CUDA_VISIBLE_DEVICES=2 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_binary_pointwise_ops.py &"
"CUDA_VISIBLE_DEVICES=2 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_tensor_constructor_ops.py &"
"CUDA_VISIBLE_DEVICES=2 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_distribution_ops.py &"
"CUDA_VISIBLE_DEVICES=6 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_blas_ops.py &"
"CUDA_VISIBLE_DEVICES=7 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_reduction_ops.py &"
"CUDA_VISIBLE_DEVICES=4 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_special_ops.py &"
"CUDA_VISIBLE_DEVICES=4 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_libentry.py &"
"CUDA_VISIBLE_DEVICES=5 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s examples/model_bert_test.py &"
)

declare -a exit_statuses
Expand Down Expand Up @@ -68,6 +68,15 @@ lcov --extract python-coverage-full.info \
-o python-coverage-diff.info \
--rc lcov_branch_coverage=0

if [ -s "python-coverage-diff.info" ]; then
echo "python-coverage-diff.info is NOT Empty"
else
echo "python-coverage-diff.info is Empty!"
echo "PR coverage rate: 100%, which means the files modified in your PR are not tested by python coverage!"
echo "expected >= 90.0 %, actual 100%, pass"
exit
fi

${PYTHON_BIN} ${FlagGemsROOT}/tools/code_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

Expand Down

0 comments on commit ec8f361

Please sign in to comment.