pocketpy/run_tests.sh
copilot-swe-agent[bot] 5d246dff53 Add Python binding return value checker tool
Co-authored-by: blueloveTH <28104173+blueloveTH@users.noreply.github.com>
2025-12-03 08:20:28 +00:00

38 lines
906 B
Bash

set -e
python prebuild.py
# Run static analysis checks
echo "Running static analysis checks..."
python scripts/check_binding_retval.py || { echo "Binding return value check failed"; exit 1; }
SRC=$(find src/ -name "*.c")
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
# if prev error exit
if [ $? -ne 0 ]; then
exit 1
fi
rm -rf .coverage
mkdir .coverage
UNITS=$(find ./ -name "*.gcno")
llvm-cov-17 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
mv *.gcov .coverage
rm *.gcda
rm *.gcno
# remove .gcno files if the 1st line contains "Source:src/debugger/"
find .coverage/ -type f -name "*.gcov" | while read -r file; do
first_line=$(head -n 1 "$file")
if [[ "$first_line" == *"Source:src/debugger/"* ]]; then
echo "Removing: $file"
rm "$file"
fi
done