Skip to content

Commit 5220eb3

Browse files
ajsecordwilllarche
authored andcommitted
Enable test code coverage reports in Xcode and in Travis CI. (#1115)
1 parent b17ec99 commit 5220eb3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

catalog/MDCCatalog.xcodeproj/xcshareddata/xcschemes/MDCCatalog.xcscheme

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
buildConfiguration = "Debug"
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29-
shouldUseLaunchSchemeArgsEnv = "YES">
29+
shouldUseLaunchSchemeArgsEnv = "YES"
30+
codeCoverageEnabled = "YES">
3031
<Testables>
3132
<TestableReference
3233
skipped = "NO">

scripts/test_all

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
readonly SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1818
readonly ROOT_DIR="$(dirname $SCRIPTS_DIR)"
19-
readonly DESTINATION='platform=iOS Simulator,name=iPhone 7,OS=10.1'
19+
readonly DESTINATION="platform=iOS Simulator,name=iPhone 7,OS=10.1"
20+
readonly COVERAGE_OPTIONS="GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES -enableCodeCoverage YES"
2021

2122
# Given a path to an Xcode log file in $1, print a guess at what caused the
2223
# failure.
@@ -40,7 +41,8 @@ for workspace_scheme in $WORKSPACE_SCHEMES; do
4041
fi
4142
echo $workspace $scheme
4243
log_file=$(dirname "$workspace")/"test_log_for_scheme_${scheme}.txt"
43-
if xcodebuild test -workspace "$workspace" -scheme "$scheme" -destination "$DESTINATION" $1 >"$log_file" 2>&1; then
44+
options="-workspace $workspace -scheme $scheme"
45+
if xcodebuild test $options $COVERAGE_OPTIONS -destination "$DESTINATION" >"$log_file" 2>&1; then
4446
rm "$log_file"
4547
else
4648
all_tests_ok=0

0 commit comments

Comments
 (0)