made codecov optional, enable it with -c or --cov (#1322)

Co-authored-by: Tingfeng Yu <tingfeng.yu@anu.edu.au>
pull/1320/head
Tingfeng Yu 3 years ago committed by GitHub
parent bb3a7bfcb5
commit 61ad340d25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -37,7 +37,7 @@ jobs:
run: |
mkdir .cov
sudo sysctl -w kernel.yama.ptrace_scope=0
PWNDBG_GITHUB_ACTIONS_TEST_RUN=1 ./tests.sh
PWNDBG_GITHUB_ACTIONS_TEST_RUN=1 ./tests.sh --cov
- name: Process coverage data
if: matrix.os == 'ubuntu-22.04'

@ -5,18 +5,20 @@ GDB_INIT_PATH="$ROOT_DIR/gdbinit.py"
COVERAGERC_PATH="$ROOT_DIR/pyproject.toml"
help_and_exit() {
echo "Usage: ./tests.sh [-p|--pdb] [<test-name-filter>]"
echo "Usage: ./tests.sh [-p|--pdb] [-c|--cov] [<test-name-filter>]"
echo " -p, --pdb enable pdb (Python debugger) post mortem debugger on failed tests"
echo " -c, --cov enable codecov"
echo " <test-name-filter> run only tests that match the regex"
exit 1
}
if [[ $# -gt 2 ]]; then
if [[ $# -gt 3 ]]; then
help_and_exit
fi
USE_PDB=0
TEST_NAME_FILTER=""
RUN_CODECOV=0
while [[ $# -gt 0 ]]; do
case $1 in
@ -25,6 +27,11 @@ while [[ $# -gt 0 ]]; do
echo "Will run tests with Python debugger"
shift
;;
-c | --cov)
echo "Will run codecov"
RUN_CODECOV=1
shift
;;
-h | --help)
help_and_exit
;;
@ -67,7 +74,10 @@ tests_passed_or_skipped=0
tests_failed=0
for test_case in ${TESTS_LIST}; do
gdb_args=(-ex 'py import coverage;coverage.process_startup()' --command $GDB_INIT_PATH --command pytests_launcher.py)
gdb_args=(--command $GDB_INIT_PATH --command pytests_launcher.py)
if [ ${RUN_CODECOV} -ne 0 ]; then
gdb_args=(-ex 'py import coverage;coverage.process_startup()' "${gdb_args[@]}")
fi
SRC_DIR=$ROOT_DIR \
COVERAGE_FILE=$ROOT_DIR/.cov/coverage \
COVERAGE_PROCESS_START=$COVERAGERC_PATH \

Loading…
Cancel
Save