update cov

This commit is contained in:
blueloveTH 2025-12-02 21:37:47 +08:00
parent ef9b4779f4
commit ab513822b3
2 changed files with 15 additions and 2 deletions

View File

@ -64,6 +64,10 @@ jobs:
bash build_g.sh
bash run_tests.sh
rm -rf ./main
- name: Run Script Check
run: |
python scripts/check_pragma_once.py include
python scripts/check_undef.py src
- name: Unit Test with Coverage
run: bash run_tests.sh
- name: Upload coverage reports to Codecov

View File

@ -4,7 +4,7 @@ python prebuild.py
SRC=$(find src/ -name "*.c")
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -DPK_ENABLE_PROFILER=1 -lm -ldl -DNDEBUG
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -lm -ldl -DNDEBUG
python scripts/run_tests.py
@ -16,8 +16,17 @@ fi
rm -rf .coverage
mkdir .coverage
# remove .gcno files if the 1st line contains "Source:src/debugger/"
find . -type f -name "*.gcno" | while read -r file; do
first_line=$(head -n 1 "$file")
if [[ "$first_line" == *"Source:src/debugger/"* ]]; then
echo "Deleting: $file"
rm -f "$file"
fi
done
UNITS=$(find ./ -name "*.gcno")
llvm-cov-15 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
llvm-cov-17 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
mv *.gcov .coverage
rm *.gcda