diff --git a/.github/workflows/python-coverage.yaml b/.github/workflows/python-coverage.yaml index 780fc679..8c509d05 100644 --- a/.github/workflows/python-coverage.yaml +++ b/.github/workflows/python-coverage.yaml @@ -8,9 +8,6 @@ on: pull_request: branches: [ "master" ] -permissions: - pull-requests: write - jobs: container-coverage-test: runs-on: [self-hosted, docker] @@ -27,4 +24,4 @@ jobs: - name: run-pytest shell: bash - run: tools/code_coverage/coverage.sh ${{ github.event.pull_request.number }} + run: tools/code_coverage/coverage.sh 168 # ${{ github.event.pull_request.number }} diff --git a/tools/code_coverage/coverage.sh b/tools/code_coverage/coverage.sh index 5fb73edf..19cef820 100755 --- a/tools/code_coverage/coverage.sh +++ b/tools/code_coverage/coverage.sh @@ -11,18 +11,28 @@ PYTHON_BIN=/usr/bin/python3.11 FlagGemsROOT="$( cd "$( dirname "${BASH_SOURCE[0]}")/../../" && pwd )" echo ${FlagGemsROOT} - +exit cmds=( + +# 168 pass +# "CUDA_VISIBLE_DEVICES=1 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_binary_pointwise_ops.py::test_accuracy_trunc_div &" +# "CUDA_VISIBLE_DEVICES=1 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_binary_pointwise_ops.py::test_accuracy_floor_div &" +# "CUDA_VISIBLE_DEVICES=2 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_tensor_constructor_ops.py &" + +# 168 not pass "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 &" + +# all +# "CUDA_VISIBLE_DEVICES=3 coverage run --parallel-mode --omit "*/.flaggems/*","*/usr/lib/*" --source=./src,./tests -m pytest -s tests/test_unary_pointwise_ops.py &" +# "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 @@ -71,9 +81,11 @@ lcov --extract python-coverage-full.info \ 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" + echo -e "==================== Python Coverage Result ====================\n" + echo "python-coverage-diff.info is Empty!" + echo "This means the files modified in your PR are not tested by python coverage!" + echo "Pass! Please check carefully if you need add test for your files!" + echo -e "\n================================================================" exit fi @@ -97,4 +109,7 @@ genhtml -o python-coverage-diff-discard \ --ignore-errors source \ python-coverage-discard-diff.info +lcov --list python-coverage-discard-diff.info + +echo -e "\n==================== Python Coverage Result ====================\n" ${PYTHON_BIN} ${FlagGemsROOT}/tools/code_coverage/coverage_lines.py python-coverage-discard-diff.info 0.9 diff --git a/tools/code_coverage/coverage_lines.py b/tools/code_coverage/coverage_lines.py index 52741c9d..d4bb0014 100644 --- a/tools/code_coverage/coverage_lines.py +++ b/tools/code_coverage/coverage_lines.py @@ -36,8 +36,10 @@ def get_lines(info_file): print( f"expected >= {round(expected * 100, 1)} %, actual {round(actual * 100, 1)} %, failed" ) + print("\n================================================================") sys.exit(1) print( f"expected >= {round(expected * 100, 1)} %, actual {round(actual * 100, 1)} %, passed" ) + print("\n================================================================")