diff --git a/tools/code_coverage/coverage.sh b/tools/code_coverage/coverage.sh index 01809fe0..5fb73edf 100755 --- a/tools/code_coverage/coverage.sh +++ b/tools/code_coverage/coverage.sh @@ -1,6 +1,6 @@ #!/bin/bash -set -ex +set -e echo " Usage: $0 pull_request_id " echo "PR_ID: $1" @@ -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 @@ -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