3 #==================================================================================
4 # Copyright (c) 2018-2019 AT&T Intellectual Property.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #==================================================================================
21 # Mnemonic: show_coverage.ksh
22 # Abstract: This script parses the coverage file associated with the .c file
23 # listed on the command line and displays a more readable summary.
25 # Date: 10 December 2019
26 # Author: E. Scott Daniels
27 # -------------------------------------------------------------------------
36 gcov -f $1 | sed "s/'//g" | awk \
38 -v show_all=$show_all \
39 -v ignore_list="$iflist" \
40 -v module_cov_target=$module_cov_target \
45 nignore = split( ignore_list, ignore, " " )
46 for( i = 1; i <= nignore; i++ ) {
50 exit_code = 0 # assume good
60 /File.*_test/ || /File.*test_/ { # dont report on test files
78 fname = "skipped: " fname # should never see and make it smell if we do
93 if( announce_target ) { # announce default once at start
95 printf( "\n[INFO] default target coverage for modules is %d%%\n", module_cov_target )
102 mct = module_cov_target
105 if( announce_target ) { # annoucne for module if different from default
106 printf( "[INFO] target coverage for %s is %d%%\n", fname, mct )
110 printf( "[%s] %3d%% %s\n", cfail, pct, fname ) # CAUTION: write only 3 things here
113 printf( "[PASS] %3d%% %s\n", pct, fname )
119 printf( "[LOW] %3d%% %s\n", pct, fname )
122 printf( "[MARG] %3d%% %s\n", pct, fname )
125 printf( "[OK] %3d%% %s\n", pct, fname )