Skip to content

Commit 6aaccdb

Browse files
author
Jon Reid
committed
Fix for Xcode 5.1 and include lcov scripts
1 parent af14a9d commit 6aaccdb

File tree

12 files changed

+14132
-19
lines changed

12 files changed

+14132
-19
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
env.sh
2-
lcov-*

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2012 Jonathan M. Reid
1+
Copyright 2014 Jonathan M. Reid
22
All rights reserved.
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
These scripts provide a simple way to generate HTML reports of the code coverage
22
of your Xcode project.
3-
For a detailed blog post, see http://qualitycoding.org/xcode-code-coverage/
4-
For additional steps needed to get code coverage in iOS 7, see http://qualitycoding.org/ios-7-code-coverage/
53

64

75
Installation
@@ -10,14 +8,14 @@ Installation
108
1. Fork this repository; you're probably going to want to make your own
119
modifications.
1210
2. Place the XcodeCoverage folder in the same folder as your Xcode project.
13-
3. [Dowload lcov-1.10](http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz).
14-
Place the lcov-1.10 folder inside the XcodeCoverage folder.
15-
4. Get Xcode's coverage instrumentation by going to Xcode Preferences, into Downloads, and installing Command Line Tools.
16-
5. In your Xcode project, enable these two build settings at the project level
11+
3. Depending on your version of Xcode, you may need to get Xcode's coverage
12+
instrumentation by going to Xcode Preferences, into Downloads, and installing
13+
Command Line Tools.
14+
4. In your Xcode project, enable these two build settings at the project level
1715
for your Debug configuration only:
1816
* Instrument Program Flow
1917
* Generate Test Coverage Files
20-
6. In your main target, add a Run Script build phase to execute
18+
5. In your main target, add a Run Script build phase to execute
2119
``XcodeCoverage/exportenv.sh``
2220

2321
A few people have been tripped up by the last step: Make sure you add the

cleancov

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/sh
22
#
3-
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
3+
# Copyright 2014 Jonathan M. Reid. See LICENSE.txt
44
# Created by: Jon Reid, http://qualitycoding.org/
55
# Source: https://github.com/jonreid/XcodeCoverage
66
#
77

88
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
99
source ${DIR}/envcov.sh
1010

11-
"${LCOV}" --zerocounters -d "${OBJ_DIR}"
11+
LCOV --zerocounters -d "${OBJ_DIR}"

envcov.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
2+
# Copyright 2014 Jonathan M. Reid. See LICENSE.txt
33
# Created by: Jon Reid, http://qualitycoding.org/
44
# Source: https://github.com/jonreid/XcodeCoverage
55
#
@@ -10,6 +10,11 @@ source ${DIR}/env.sh
1010
# Change the report name if you like:
1111
LCOV_INFO=Coverage.info
1212

13-
LCOV_PATH=${SRCROOT}/XcodeCoverage/lcov-1.10/bin
14-
LCOV=${LCOV_PATH}/lcov
13+
XCODECOVERAGE_PATH="${SRCROOT}/XcodeCoverage"
14+
LCOV_PATH="${XCODECOVERAGE_PATH}/lcov-1.10/bin"
1515
OBJ_DIR=${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}
16+
17+
# Fix for the new LLVM-COV that requires gcov to have a -v paramter
18+
LCOV() {
19+
${LCOV_PATH}/lcov $* --gcov-tool ${XCODECOVERAGE_PATH}/llvm-cov-wrapper
20+
}

exportenv.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
2+
# Copyright 2014 Jonathan M. Reid. See LICENSE.txt
33
# Created by: Jon Reid, http://qualitycoding.org/
44
# Source: https://github.com/jonreid/XcodeCoverage
55
#

getcov

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/sh
22
#
3-
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
3+
# Copyright 2014 Jonathan M. Reid. See LICENSE.txt
44
# Created by: Jon Reid, http://qualitycoding.org/
55
# Source: https://github.com/jonreid/XcodeCoverage
66
#
@@ -26,13 +26,13 @@ enter_lcov_dir()
2626

2727
gather_coverage()
2828
{
29-
"${LCOV}" --capture -b "${SRCROOT}" -d "${OBJ_DIR}" -o ${LCOV_INFO}
29+
LCOV --capture -b "${SRCROOT}" -d "${OBJ_DIR}" -o ${LCOV_INFO}
3030
}
3131

3232
exclude_data()
3333
{
34-
"${LCOV}" --remove ${LCOV_INFO} "/Applications/Xcode.app/*" -d "${OBJ_DIR}" -o ${LCOV_INFO}
35-
"${LCOV}" --remove ${LCOV_INFO} "main.m" -d "${OBJ_DIR}" -o ${LCOV_INFO}
34+
LCOV --remove ${LCOV_INFO} "Applications/Xcode.app/*" -d "${OBJ_DIR}" -o ${LCOV_INFO}
35+
LCOV --remove ${LCOV_INFO} "main.m" -d "${OBJ_DIR}" -o ${LCOV_INFO}
3636
# Remove other patterns here...
3737
}
3838

lcov-1.10/COPYING

Lines changed: 339 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)