Skip to content

Commit f1589ab

Browse files
committed
Portability: some compiler versions don't put coverpoints on the std::initializer block
1 parent 3af5431 commit f1589ab

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

tests/lcov/initializer/initializer.sh

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,26 @@ if [ 0 != ${PIPESTATUS[0]} ] ; then
151151
fi
152152
fi
153153
154-
COUNT2=`grep -c "^DA:" filtered.info`
155-
if [ "$COUNT" -le $COUNT2 ] ; then
156-
echo "ERROR: expected to filter out 3 initializer-list lines"
157-
if [ $KEEP_GOING == 0 ] ; then
158-
exit 1
159-
fi
160-
fi
154+
# did the non-filtered capture command find linecov entried on line 8, 9, or 10?
155+
grep -E '^DA:\(8|9|10\)' initializer.info
156+
if [ $? == 0 ] ; then
157+
COUNT2=`grep -c "^DA:" filtered.info`
158+
if [ "$COUNT" -le $COUNT2 ] ; then
159+
echo "ERROR: expected to filter out 3 initializer-list lines"
160+
if [ $KEEP_GOING == 0 ] ; then
161+
exit 1
162+
fi
163+
fi
161164
162-
DIFF=`expr $COUNT - $COUNT2`
163-
if [ "$DIFF" != 3 ] ; then
164-
echo "ERROR: expected to filter out 3 initializer-list lines"
165-
if [ $KEEP_GOING == 0 ] ; then
166-
exit 1
167-
fi
165+
DIFF=`expr $COUNT - $COUNT2`
166+
if [ "$DIFF" != 3 ] ; then
167+
echo "ERROR: expected to filter out 3 initializer-list lines"
168+
if [ $KEEP_GOING == 0 ] ; then
169+
exit 1
170+
fi
171+
fi
172+
else
173+
echo "no linecov points on std::initializer lines"
168174
fi
169175
170176
echo "Tests passed"

0 commit comments

Comments
 (0)