mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-01-01 10:50:51 +00:00
Add code coverage
Yeah, coverage is poor right now. I know I know...
This commit is contained in:
committed by
Stephan Diederich
parent
413cbb4fc7
commit
05dcca8ead
@@ -594,6 +594,7 @@
|
||||
1E5954CC15B6F24A00A03429 /* Sources */,
|
||||
1E5954DB15B6F24A00A03429 /* Frameworks */,
|
||||
1E59558B15B6FD8800A03429 /* Headers */,
|
||||
1EE9071A16F6871F003DDE1D /* ShellScript */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -771,6 +772,19 @@
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "/usr/local/bin/appledoc \\\n --output \"${SOURCE_ROOT}/../documentation\" \\\n --ignore Vendor \\\n --ignore Products \\\n --ignore .m \\\n --create-html \\\n --create-docset \\\n --install-docset \\\n --keep-intermediate-files \\\n --project-name \"${HOCKEYSDK_DOCSET_NAME} ${VERSION_STRING}\" \\\n --project-version \"${VERSION_STRING}\" \\\n --project-company \"BitStadium GmbH\" \\\n --company-id \"de.bitstadium\" \\\n --docset-bundle-name \"${HOCKEYSDK_DOCSET_NAME} ${VERSION_STRING}\" \\\n --docset-feed-name \"${HOCKEYSDK_DOCSET_NAME}\" \\\n --docset-desc \"\" \\\n --docset-platform-family \"iphoneos\" \\\n --index-desc \"${SOURCE_ROOT}/../docs/index.md\" \\\n --include \"${SOURCE_ROOT}/../docs/index.html\" \\\n --include \"${SOURCE_ROOT}/../docs/\" \\\n --merge-categories \\\n --no-repeat-first-par \\\n --warn-undocumented-object \\\n --warn-undocumented-member \\\n --warn-empty-description \\\n --warn-unknown-directive \\\n --warn-invalid-crossref \\\n --warn-missing-arg \\\n --logformat xcode \\\n --exit-threshold 2 \\\n \"${SOURCE_ROOT}/../\"\n";
|
||||
};
|
||||
1EE9071A16F6871F003DDE1D /* ShellScript */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"${SRCROOT}/../Vendor/XcodeCoverage/exportenv.sh\"";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
@@ -1039,6 +1053,8 @@
|
||||
DEAD_CODE_STRIPPING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
|
||||
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"BITHOCKEY_STATIC_LIBRARY=1",
|
||||
|
||||
2
Vendor/XcodeCoverage/.gitignore
vendored
Executable file
2
Vendor/XcodeCoverage/.gitignore
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
env.sh
|
||||
lcov-*
|
||||
21
Vendor/XcodeCoverage/LICENSE.txt
vendored
Executable file
21
Vendor/XcodeCoverage/LICENSE.txt
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
Copyright 2012 Jonathan M. Reid
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
(MIT License)
|
||||
62
Vendor/XcodeCoverage/README.md
vendored
Executable file
62
Vendor/XcodeCoverage/README.md
vendored
Executable file
@@ -0,0 +1,62 @@
|
||||
These scripts provide a simple way to generate HTML reports of the code coverage
|
||||
of your Xcode 4.5 project.
|
||||
For a detailed blog post, see http://qualitycoding.org/xcode-code-coverage/
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
1. Fork this repository; you're probably going to want to make your own
|
||||
modifications.
|
||||
2. Place the XcodeCoverage folder in the same folder as your Xcode project.
|
||||
3. [Dowload lcov-1.10](http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz).
|
||||
Place the lcov-1.10 folder inside the XcodeCoverage folder.
|
||||
4. Get Xcode's coverage instrumentation by going to Xcode Preferences, into Downloads, and installing Command Line Tools.
|
||||
5. In your Xcode project, enable these two build settings at the project level
|
||||
for your Debug configuration only:
|
||||
* Instrument Program Flow
|
||||
* Generate Test Coverage Files
|
||||
6. In your main target, add a Run Script build phase to execute
|
||||
``XcodeCoverage/exportenv.sh``
|
||||
|
||||
A few people have been tripped up by the last step: Make sure you add the
|
||||
script to your main target (your app or library), not your test target.
|
||||
|
||||
|
||||
Execution
|
||||
=========
|
||||
|
||||
1. Run your unit tests
|
||||
2. In Terminal, cd to your project's XcodeCoverage folder, then
|
||||
|
||||
$ ./getcov
|
||||
|
||||
If you make changes to your test code without changing the production code and
|
||||
want a clean slate, use the ``cleancov`` script:
|
||||
|
||||
$ ./cleancov
|
||||
|
||||
If you make changes to your production code, you should clear out all build
|
||||
artifacts before measuring code coverage again. "Clean Build Folder" by holding
|
||||
down the Option key in Xcode's "Product" menu.
|
||||
|
||||
|
||||
Modification
|
||||
============
|
||||
|
||||
There are two places you may want to modify:
|
||||
|
||||
1. In envcov.sh, ``LCOV_INFO`` determines the name shown in the report.
|
||||
2. In getcov, edit ``exclude_data()`` to specify which files to exclude, for
|
||||
example, third-party libraries.
|
||||
|
||||
|
||||
More resources
|
||||
==============
|
||||
|
||||
* [Sources](https://github.com/jonreid/XcodeCoverage)
|
||||
* Testing tools: [OCHamcrest](https://github.com/hamcrest/OCHamcrest),
|
||||
[OCMockito](https://github.com/jonreid/OCMockito),
|
||||
[JMRTestTools](https://github.com/jonreid/JMRTestTools)
|
||||
* [Quality Coding](http://qualitycoding.org/) blog - Tools, tips & techniques
|
||||
for _building quality in_ to iOS development
|
||||
10
Vendor/XcodeCoverage/cleancov
vendored
Executable file
10
Vendor/XcodeCoverage/cleancov
vendored
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source envcov.sh
|
||||
|
||||
"${LCOV}" --zerocounters -d "${OBJ_DIR}"
|
||||
14
Vendor/XcodeCoverage/envcov.sh
vendored
Executable file
14
Vendor/XcodeCoverage/envcov.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source env.sh
|
||||
|
||||
# Change the report name if you like:
|
||||
LCOV_INFO=Coverage.info
|
||||
|
||||
LCOV_PATH=${SRCROOT}/../Vendor/XcodeCoverage/lcov-1.10/bin
|
||||
LCOV=${LCOV_PATH}/lcov
|
||||
OBJ_DIR=${OBJECT_FILE_DIR_normal}/${CURRENT_ARCH}
|
||||
7
Vendor/XcodeCoverage/exportenv.sh
vendored
Executable file
7
Vendor/XcodeCoverage/exportenv.sh
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
export | egrep '( BUILT_PRODUCTS_DIR)|(CURRENT_ARCH)|(OBJECT_FILE_DIR_normal)|(SRCROOT)|(OBJROOT)' > ../Vendor/XcodeCoverage/env.sh
|
||||
48
Vendor/XcodeCoverage/getcov
vendored
Executable file
48
Vendor/XcodeCoverage/getcov
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2012 Jonathan M. Reid. See LICENSE.txt
|
||||
# Created by: Jon Reid, http://qualitycoding.org/
|
||||
# Source: https://github.com/jonreid/XcodeCoverage
|
||||
#
|
||||
|
||||
source 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 -b "${SRCROOT}" -d "${OBJ_DIR}" -o ${LCOV_INFO}
|
||||
}
|
||||
|
||||
exclude_data()
|
||||
{
|
||||
"${LCOV}" --remove ${LCOV_INFO} "/Applications/Xcode.app/*" -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
|
||||
Reference in New Issue
Block a user