@@ -137,8 +137,14 @@ ${CXX} --coverage TEST.cpp
137137echo ` which gcov`
138138echo ` which lcov`
139139
140- echo lcov $LCOV_OPTS --capture --directory . --output-file baseline.info
141- $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file baseline.info --no-external
140+ # old gcc version generates inconsistent line/function data
141+ IFS=' .' read -r -a VER <<< ` gcc -dumpversion`
142+ if [ " ${VER[0]} " -lt 5 ] ; then
143+ IGNORE=" --ignore inconsistent"
144+ fi
145+
146+ echo lcov $LCOV_OPTS --capture --directory . --output-file baseline.info $IGNORE
147+ $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file baseline.info --no-external $IGNORE
142148if [ 0 != $? ] ; then
143149 echo " ERROR: lcov --capture failed"
144150 if [ 0 == $KEEP_GOING ] ; then
@@ -200,8 +206,8 @@ rm -f TEST.cpp *.gcno *.gcda a.out
200206ln -s ../simple/simple2.cpp TeSt.cpp
201207${CXX} --coverage -DADD_CODE -DREMOVE_CODE TeSt.cpp
202208./a.out
203- echo lcov $LCOV_OPTS --capture --directory . --output-file current.info
204- $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file current.info
209+ echo lcov $LCOV_OPTS --capture --directory . --output-file current.info $IGNORE
210+ $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file current.info $IGNORE
205211if [ 0 != $? ] ; then
206212 echo " ERROR: lcov --capture TeSt failed"
207213 if [ 0 == $KEEP_GOING ] ; then
217223ln -s ../simple/simple2.cpp.annotated TEst.cpp.annotated
218224
219225# check that this works with test names
220- echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script ` pwd` /annotate.sh --show-owners all --show-noncode -o differential ./current.info --rc case_insensitive=1 --ignore-annotate,source
221- $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script ` pwd` /annotate.sh --show-owners all --show-noncode -o differential ./current.info --rc case_insensitive=1 $GENHTML_PORT --ignore annotate,source
226+ echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script ` pwd` /annotate.sh --show-owners all --show-noncode -o differential ./current.info --rc case_insensitive=1 --ignore-annotate,source $IGNORE
227+ $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script ` pwd` /annotate.sh --show-owners all --show-noncode -o differential ./current.info --rc case_insensitive=1 $GENHTML_PORT --ignore annotate,source $IGNORE
222228if [ 0 != $? ] ; then
223229 echo " ERROR: genhtml differential failed"
224230 if [ 0 == $KEEP_GOING ] ; then
@@ -227,8 +233,8 @@ if [ 0 != $? ] ; then
227233fi
228234
229235# check warning
230- echo lcov $LCOV_OPTS --capture --directory . --output-file current.info --substitute ' s/test/TEST/g'
231- $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file current.info --substitute ' s/test\b/TEST/' --rc case_insensitive=1 --ignore unused,source 2>&1 | tee warn.log
236+ echo lcov $LCOV_OPTS --capture --directory . --output-file current.info --substitute ' s/test/TEST/g' $IGNORE
237+ $COVER $LCOV_HOME /bin/lcov $LCOV_OPTS --capture --directory . --output-file current.info --substitute ' s/test\b/TEST/' --rc case_insensitive=1 --ignore unused,source $IGNORE 2>&1 | tee warn.log
232238if [ 0 != $? ] ; then
233239 echo " ERROR: lcov --capture TeSt failed"
234240 if [ 0 == $KEEP_GOING ] ; then
245251
246252rm -f TeSt.cpp
247253
248- # check annotateion failure message...
254+ # check annotation failure message...
249255# check that this works with test names
250- echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore- source
251- $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source 2>&1 | tee fail.log
256+ echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore source $IGNORE
257+ $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source $IGNORE 2>&1 | tee fail.log
252258if [ 0 == ${PIPESTATUS[0]} ] ; then
253259 echo " ERROR: expected annotation error but didn't find"
254260 if [ 0 == $KEEP_GOING ] ; then
@@ -261,8 +267,8 @@ if [ 0 != $? ] ; then
261267 exit 1
262268fi
263269
264- echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore-source,annotate
265- $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source,annotate 2>&1 | tee fail2.log
270+ echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore-source,annotate $IGNORE
271+ $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source,annotate $IGNORE 2>&1 | tee fail2.log
266272if [ 0 == ${PIPESTATUS[0]} ] ; then
267273 echo " ERROR: expected synthesize error but didn't find"
268274 if [ 0 == $KEEP_GOING ] ; then
@@ -280,8 +286,8 @@ if [ 0 != $? ] ; then
280286 exit 1
281287fi
282288
283- echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore-source,annotate --synthesize
284- $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source,annotate --synthesize 2>&1 | tee fail3.log
289+ echo ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATATE --show-owners all --show-noncode -o differential ./current.info --ignore-source,annotate --synthesize $IGNORE
290+ $COVER ${LCOV_HOME} /bin/genhtml $DIFFCOV_OPTS --baseline-file ./baseline.info --diff-file diff.txt --annotate-script $ANNOTATE --show-owners all --show-noncode -o differential ./current.info $GENHTML_PORT --ignore source,annotate --synthesize $IGNORE 2>&1 | tee fail3.log
285291if [ 0 != ${PIPESTATUS[0]} ] ; then
286292 echo " ERROR: unexpected synthesize error"
287293 if [ 0 == $KEEP_GOING ] ; then
0 commit comments