forked from libxsmm/libxsmm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.codecov.env
50 lines (48 loc) · 1.87 KB
/
.codecov.env
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
#!/bin/sh
#
# This script is supposed to be source'd prior to building the library and samples using GNU GCC.
# Executing "eval ${COVERAGE} (after building/running a case) yields code coverage information.
# Prerequisite: source .travis.env
#
MKDIR=$(which mkdir 2> /dev/null)
FIND=$(which find 2> /dev/null)
GCOV=$(which gcov 2> /dev/null)
SED=$(which sed 2> /dev/null)
CAT=$(which cat 2> /dev/null)
if [ "${CODECOV_ENABLED}" = "" ] || [ "${CODECOV_ENABLED}" != "0" ]; then
if [ "${TRAVIS_BUILD_DIR}" != "" ] && [ "${MKDIR}" != "" ] && [ "${FIND}" != "" ] && \
[ "${GCOV}" != "" ] && [ "${SED}" != "" ] && [ "${CAT}" != "" ]; \
then
# count number of times the script got source'd
if [ "${COVID}" != "" ]; then
export COVID=$((COVID+1))
else
export COVID=1
fi
if [ "$1" = "1" ]; then
export ELDFLAGS="--coverage"
export EFLAGS="--coverage"
export RUNGCOV="(CWD=\${PWD} && export COVLOG=codecov-\${COVID}.txt && ${CAT} /dev/null > \${COVLOG} && \
for FILE in \$(${FIND} ${TRAVIS_BUILD_DIR} -type f -name '*.gcno'); do \
FILENAME=\$(basename \${FILE} .gcno).o && \
FILEPATH=\$(echo \${FILE} | ${SED} -e 's/\(.\+\)build.\+/\1/g') && \
BUILD=\$(dirname \${FILE} | ${SED} -e 's/^.\+\(build.*\)/\1/g') && \
cd \${FILEPATH} && \
${GCOV} -o \${BUILD} -pb \${FILENAME} >> \${COVLOG}; \
done && \
cd \${CWD})"
export RUNXCOV="(eval \${RUNGCOV} && \
${MKDIR} -p ${TRAVIS_BUILD_DIR}/codecov/${COVID} && \
${FIND} ${TRAVIS_BUILD_DIR} -not \( -path ${TRAVIS_BUILD_DIR}/codecov -prune \) -type f -name '*.gcov' \
-exec mv {} ${TRAVIS_BUILD_DIR}/codecov/${COVID} \;)"
export CODECOV="codecov"
else
unset ELDFLAGS
unset EFLAGS
unset RUNGCOV
unset CODECOV
fi
else
>&2 echo "Please run \"source .travis.env\" first!"
fi
fi