Browse Source

Generate allowed function file for coverage with filter options

Kajetan Johannes Hammerle 7 months ago
parent
commit
4456ac9787
3 changed files with 16 additions and 1 deletions
  1. 1 0
      coverageFunctions
  2. 2 0
      ignoredCoverageFunctions
  3. 13 1
      tasks

+ 1 - 0
coverageFunctions

@@ -0,0 +1 @@
+allowlist_fun:.*

+ 2 - 0
ignoredCoverageFunctions

@@ -0,0 +1,2 @@
+QueueCL
+QueueDataCL

+ 13 - 1
tasks

@@ -208,6 +208,17 @@ if $time; then
     done
     printf "$output" | sort -n
 fi
+
+generateCoverageFunctions() {
+    #allowlist_fun:.*
+    ignore=$(cat ./ignoredCoverageFunctions)
+    list=$(nm ./build_debug/libcore.a -j | grep "^[a-zA-Z]")
+    for file in $ignore; do
+	list=$(echo "$list" | grep -v $file)
+    done
+    echo "$list" | sed 's/^/allowlist_fun:/g' > build_debug/coverageFunctions
+}
+
 if $coverage; then
     if [ $compiler = "gcc" ]; then
         gcovr -r . build_debug -e test -e performance \
@@ -215,6 +226,7 @@ if $coverage; then
     else
         files=$(find build_debug -name *.profraw)
         llvm-profdata-16 merge -sparse $files -o build_debug/default.profdata
-	llvm-cov-16 show ./build_debug/test -instr-profile=build_debug/default.profdata --ignore-filename-regex="test/" -line-coverage-lt=100
+	generateCoverageFunctions
+	llvm-cov-16 show ./build_debug/test -instr-profile=build_debug/default.profdata --ignore-filename-regex="test/" -line-coverage-lt=100 --name-allowlist=build_debug/coverageFunctions
     fi
 fi