summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2024-09-07 22:16:00 +0200
committermzuenni <michi.zuendorf@gmail.com>2024-09-07 22:16:12 +0200
commitfe54314b7b57fc703c2b3e3e6e2cd1f8ce9f5b83 (patch)
treed1d15e7f8bd99d921f2bd0a159a40f48fdad901a
parent6ae1d00fca78145c73f826c5490452726b9bf161 (diff)
coverage
-rw-r--r--.github/workflows/list_missing.yml1
-rwxr-xr-xtest/test.sh24
2 files changed, 23 insertions, 2 deletions
diff --git a/.github/workflows/list_missing.yml b/.github/workflows/list_missing.yml
index c27c2ba..5e660ae 100644
--- a/.github/workflows/list_missing.yml
+++ b/.github/workflows/list_missing.yml
@@ -7,6 +7,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: ./test/test.sh --missing
+ - run: ./test/test.sh --coverage >> $GITHUB_ENV
- uses: schneegans/dynamic-badges-action@v1.7.0
with:
auth: ${{ secrets.GIST_COVERAGE_SECRET }}
diff --git a/test/test.sh b/test/test.sh
index e4eecee..52ffcc1 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -3,6 +3,7 @@ set -e
cd "$(dirname "$0")"
ulimit -s 4000000
export MALLOC_PERTURB_="$((2#01011001))"
+shopt -s lastpipe
declare -A cppstandard
cppstandard["string/suffixArray.cpp"]="gnu++20"
@@ -43,14 +44,31 @@ list_missing() {
ignore["tests/precision.cpp"]=1
ignore["tests/whitespace.cpp"]=1
- echo "missing tests:"
+ total=0
+ missing=0
+
+ if [[ ! -v $1 ]]; then
+ echo "missing tests:"
+ fi
find ../content/ -type f -name '*.cpp' -print0 | sort -z | while read -d $'\0' file
do
+ total=$((total+1))
file=${file#../content/}
if [ ! -f "$file" ] && [[ ! -v ignore["$file"] ]]; then
- echo " $file"
+ missing=$((missing+1))
+ if [[ ! -v $1 ]]; then
+ echo " $file"
+ fi
fi
done
+ if [[ -v $1 ]]; then
+ coverage=$((100*(total-missing)/total))
+ echo "COVERAGE=$coverage"
+ fi
+}
+
+coverage() {
+ list_missing 1
}
rm -rf ./awk/
@@ -66,6 +84,8 @@ if [ "$#" -ne 0 ]; then
echo "processed all awk files"
elif [[ $arg == "--missing" ]]; then
list_missing
+ elif [[ $arg == "--coverage" ]]; then
+ coverage
elif [[ $arg == --seed=* ]]; then
seedmacro="-DSEED=${arg:7}ll"
elif [ -d "$arg" ]; then