Skip to content

Commit

Permalink
test not pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Bowen12992 committed Aug 23, 2024
1 parent ec8f361 commit d84ed2f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 17 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/python-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
pull_request:
branches: [ "master" ]

permissions:
pull-requests: write

jobs:
container-coverage-test:
runs-on: [self-hosted, docker]
Expand All @@ -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 }}
41 changes: 28 additions & 13 deletions tools/code_coverage/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
2 changes: 2 additions & 0 deletions tools/code_coverage/coverage_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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================================================================")

0 comments on commit d84ed2f

Please sign in to comment.