1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
#!/bin/bash
# lambda function extents
set +x
source ../../common.tst
rm -rf *.txt* *.json dumper* report lambda *.gcda *.gcno *.info
clean_cover
if [[ 1 == "$CLEAN_ONLY" ]] ; then
exit 0
fi
LCOV_OPTS="--branch $PARALLEL $PROFILE"
# gcc/4.8.5 (and possibly other old versions) generate inconsistent line/function data
IFS='.' read -r -a VER <<< `${CC} -dumpversion`
if [ "${VER[0]}" -lt 5 ] ; then
IGNORE="--ignore inconsistent"
# and filter exception branches to avoid spurious differences for old compiler
FILTER='--filter branch'
# gcc older than 5 doesn't support lambda
echo "Compiler version is too old - skipping lambda test"
exit 0
fi
if ! type ${CXX} >/dev/null 2>&1 ; then
echo "Missing tool: ${CXX}" >&2
exit 2
fi
${CXX} -o lambda --coverage lambda.cpp -std=c++1y
./lambda
if [ 0 != $? ] ; then
echo "Error: 'lambda' returned error code"
if [ $KEEP_GOING == 0 ] ; then
exit 1
fi
fi
$COVER $LCOV_TOOL $LCOV_OPTS -o lambda.info --capture -d . --demangle --rc derive_function_end_line=0
if [ 0 != $? ] ; then
echo "Error: unexpected error code from lcov"
if [ $KEEP_GOING == 0 ] ; then
exit 1
fi
fi
$COVER $GENHTML_TOOL $LCOV_OPTS -o report lambda.info --show-proportion
if [ 0 != $? ] ; then
echo "Error: unexpected error code from genhtml"
if [ $KEEP_GOING == 0 ] ; then
exit 1
fi
fi
echo "Tests passed"
if [ "x$COVER" != "x" ] && [ $LOCAL_COVERAGE == 1 ]; then
cover
fi
|