Skip to content

Commit b00633d

Browse files
committed
added script to detect missing --errorlist entries and test coverage
1 parent ceb87bf commit b00633d

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

tools/errorid.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
#set -x
4+
5+
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
6+
7+
# TODO: exclude testinternal.cpp
8+
echo 'no --errorlist entry:'
9+
grep -h -o -P '\[[a-zA-Z0-9_]+\]\\n\"' $SCRIPT_DIR/../test/*.cpp | tr -d '[]\"' | sed 's/\\n$//' | sort -u | \
10+
while read -r id; do
11+
if [ ${#id} -lt 4 ]; then
12+
continue
13+
fi
14+
$SCRIPT_DIR/../cppcheck --errorlist | grep "id=\"$id\"" > /dev/null
15+
if [ $? -ne 0 ]; then
16+
echo $id
17+
fi
18+
done
19+
20+
echo ''
21+
22+
echo 'no test coverage:'
23+
$SCRIPT_DIR/../cppcheck --errorlist | grep -h -o -P 'id=\"[a-zA-Z0-9_]*\"' | sed 's/\id=//' | tr -d '\"' | sort -u | \
24+
while read -r id; do
25+
grep -h -o -P "\[$id\]\\\\n\"" $SCRIPT_DIR/../test/*.cpp > /dev/null
26+
if [ $? -ne 0 ]; then
27+
echo $id
28+
fi
29+
done

tools/readme.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,8 @@ Script to compare result of working Cppcheck from your branch with main branch.
7878
This tool lets you comfortably look at Cppcheck analysis results for daca packages. It automatically
7979
downloads the package, extracts it and jumps to the corresponding source code for a Cppcheck
8080
message.
81+
82+
### * tools/errorid.sh
83+
84+
Script to compare the error IDs in the expected `testrunner` output (without executing it) with the `--errorlist` output.
85+
It will report missing test coverage for an ID and missing IDs in the `--errorlist` output.

0 commit comments

Comments
 (0)