forked from jonreid/XcodeCoverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getcov
executable file
·49 lines (42 loc) · 950 Bytes
/
getcov
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
#
# Copyright 2014 Jonathan M. Reid. See LICENSE.txt
# Created by: Jon Reid, http://qualitycoding.org/
# Source: https://github.com/jonreid/XcodeCoverage
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source ${DIR}/envcov.sh
remove_old_report()
{
pushd ${BUILT_PRODUCTS_DIR}
if [ -e lcov ]; then
rm -r lcov
fi
popd
}
enter_lcov_dir()
{
cd ${BUILT_PRODUCTS_DIR}
mkdir lcov
cd lcov
}
gather_coverage()
{
LCOV --capture --derive-func-data -b "${SRCROOT}" -d "${OBJ_DIR}" -o ${LCOV_INFO}
}
exclude_data()
{
LCOV --remove ${LCOV_INFO} "Developer/SDKs/*" -d "${OBJ_DIR}" -o ${LCOV_INFO}
LCOV --remove ${LCOV_INFO} "main.m" -d "${OBJ_DIR}" -o ${LCOV_INFO}
# Remove other patterns here...
}
generate_report()
{
"${LCOV_PATH}/genhtml" --output-directory . ${LCOV_INFO}
open index.html
}
remove_old_report
enter_lcov_dir
gather_coverage
exclude_data
generate_report