#!/bin/bash

# This script run gcov after test execution to check coverage

# 1st argument: test procedure name (asw_main)
# 2nd argument: tested C filename   (asw_main.c)

# find the input file for gcov
FILE=`find ./ -iname tp.c.gcno | head -1`

# run gcov
gcov -bc -o $FILE tp.c > $1.gcov

# save coverage status
cat $1.gcov | grep -A3 "/$1.c" | tail -3 > $1.cov.sum

#cat $2.gcov | grep -v -e "-"
#cat $2.gcov | grep -e "#" | grep -v -e "-"
tail -n+6 $2.gcov > $1.cov.log

#eof