diff options
| author | peter <peter@pmikkelsen.com> | 2026-08-20 16:04:41 +0000 |
|---|---|---|
| committer | peter <peter@pmikkelsen.com> | 2026-08-20 16:04:41 +0000 |
| commit | 3be992e3f45dcfd9f8a45fa447de3abb710819b7 (patch) | |
| tree | 6cf02c89acdb0fbf12c20f03ea190a0047221db9 /tools | |
| parent | 3a81615601bf37ffc4f7b570030709ac0782e2ed (diff) | |
Adapt a different coding style (no typedef'ed structs, C90...), and start working on a test setup.
FossilOrigin-Name: ebb73df5fc58859b6e985c5ec84196bdd09f639dbcdc69e706f6b17652a2d413
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/check | 15 | ||||
| -rwxr-xr-x | tools/checkcov | 70 | ||||
| -rwxr-xr-x | tools/tests | 8 |
3 files changed, 93 insertions, 0 deletions
diff --git a/tools/check b/tools/check new file mode 100755 index 0000000..a6c5d20 --- /dev/null +++ b/tools/check @@ -0,0 +1,15 @@ +#!/bin/sh + +types="Debug Release Coverage" + +mkdir build +cd build + +for type in $types +do + rm -rf $type + cmake .. -B $type -DCMAKE_BUILD_TYPE=$type +done + +cd .. +fossil ls | entr -c tools/tests $types diff --git a/tools/checkcov b/tools/checkcov new file mode 100755 index 0000000..6f2775a --- /dev/null +++ b/tools/checkcov @@ -0,0 +1,70 @@ +#!/bin/sh + +cd build/$1 + +case "$1" in + Coverage) + rm -rf CMakeFiles/aplwc.dir/src/* + ;; + *) + ;; +esac + +cmake --build . +ctest + +case "$1" in + Coverage) + ;; + *) + exit 0 + ;; +esac + +gcov -tg CMakeFiles/aplwc.dir/src/*.gcno | awk ' +BEGIN { + FS=":" +} + +function miss(t){ + printf("%c %s:%d %s\n", t, file, line, src) +} + +/^condition outcomes covered [0-9]+\/[1-9][0-9]*/ { + if($0 ~ /0\//) + skip_cond = 1 + else + skip_cond = 0 + next +} + +/^condition .* not covered/ { + if(!skip_cond){ + miss("C") + print $0 + } + next +} + +{ + hits = $1 + line = $2 + gsub(/ /, "", hits) + gsub(/ /, "", line) + + if(line == 0) + file=$NF + + src = "" + for(n = 3; n <= NF; n++) + src = src $n + + if(hits == "-") + next + if(hits ~ /^[1-9][0-9]*\*?$/) + next + + miss("L") + next +} +' diff --git a/tools/tests b/tools/tests new file mode 100755 index 0000000..66ac467 --- /dev/null +++ b/tools/tests @@ -0,0 +1,8 @@ +#!/bin/sh + +types=$* + +for type in $types +do + tools/checkcov $type +done |