#!/bin/bash

# SPQR, Copyright (c) 2008-2022, Timothy A Davis. All Rights Reserved.
# SPDX-License-Identifier: GPL-2.0+

echo "Test coverage summary" > cov.out
echo '=================================================================' >> cov.out

for file in ../Source/*
do
	gcov -o . $file >& /dev/null
done

for file in ../SPQRGPU/*
do
	gcov -o . $file >& /dev/null
done

for file in ../../SuiteSparse_GPURuntime/Source/*
do
	gcov -o . $file >& /dev/null
done

for file in ../../GPUQREngine/Source/*p
do
	gcov -o . $file >& /dev/null
done

for file in ../../GPUQREngine/Source/*/*p
do
	gcov -o . $file >& /dev/null
done

for file in *.?cov
do
	echo $file >> cov.out
	grep "#####" $file | grep -v "__dev" | grep -v "__major" | \
	    grep -v "#####:[ ]*[0-9]*:[{}]" | grep -v DEAD >> cov.out
	echo '=================================================================' >> cov.out
done

echo -n "statements not tested: "
grep "\#\#\#\#\#:" *v | grep -v DEAD | wc -l

set status=0

