Skip to content

Commit

Permalink
Resolved test coverage issue.
Browse files Browse the repository at this point in the history
I removed the instrumentation/coverage-generation flags from
Template Framework Project.

Then I setup the Podfile for the tests to respect a custom
"Coverage" build configuration, based on debug.

Then I added "Coverage" as a custom build configuration
(duplicated from "Debug") for both TestsProject and the
framework project settings. For these "Coverage" build
configurations, I set the instrumentation/coverage-generation
flags to YES and for the Release and Debug configurations I set
them to NO.

Finally, I made "Coverage" be the build configuration used for
the "Test" action on the TestsProject and framework schemes,
as well as the "Run" action on the TestsProject scheme.

This seems to have achieved the Template Framework Project
building okay in Debug and Release configurations and the
test coverage information still being generated during the
running of our unit tests on TestsProject.
  • Loading branch information
Kevin Conley committed Jan 10, 2015
1 parent eb2dae3 commit 7d01e0e
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'
workspace 'Tesseract-OCR-iOS'
xcodeproj 'TestsProject/TestsProject.xcodeproj/'
xcodeproj 'TestsProject/TestsProject.xcodeproj/', 'Coverage' => :debug

target 'TestsProjectTests' do

Expand Down
2 changes: 1 addition & 1 deletion Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ DEPENDENCIES:
SPEC CHECKSUMS:
Kiwi: 73e1400209055ee9c8ba78c6012b6b642d0fb9f7

COCOAPODS: 0.35.0
COCOAPODS: 0.36.0.beta.1
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
"$(inherited)",
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
);
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Template Framework Project/Template Framework Project-Prefix.pch";
INFOPLIST_FILE = "Template Framework Project/Template Framework Project-Info.plist";
Expand All @@ -327,7 +327,7 @@
"$(inherited)",
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
);
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Template Framework Project/Template Framework Project-Prefix.pch";
INFOPLIST_FILE = "Template Framework Project/Template Framework Project-Info.plist";
Expand Down
87 changes: 85 additions & 2 deletions Tesseract OCR iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,8 @@
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -716,13 +716,95 @@
};
name = Release;
};
F4EE1C791A612ADC007BB075 /* Coverage */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "compiler-default";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = 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 = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = "";
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"-ObjC",
"-lstdc++",
);
SDKROOT = iphoneos;
};
name = Coverage;
};
F4EE1C7A1A612ADC007BB075 /* Coverage */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
INFOPLIST_FILE = "TesseractOCR/TesseractOCR-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/TesseractOCR/lib",
);
MACH_O_TYPE = staticlib;
MTL_ENABLE_DEBUG_INFO = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Coverage;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
64F74CC4172FD75F0068E657 /* Build configuration list for PBXProject "Tesseract OCR iOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
64F74CD5172FD75F0068E657 /* Debug */,
F4EE1C791A612ADC007BB075 /* Coverage */,
64F74CD6172FD75F0068E657 /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand All @@ -732,6 +814,7 @@
isa = XCConfigurationList;
buildConfigurations = (
73C0A78F1A592C2B00D823D4 /* Debug */,
F4EE1C7A1A612ADC007BB075 /* Coverage */,
73C0A7901A592C2B00D823D4 /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
buildConfiguration = "Coverage">
<Testables>
<TestableReference
skipped = "NO">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,6 @@
ReferencedContainer = "container:TestsProject/TestsProject.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "64A0293917307C7E002B12E7"
BuildableName = "TesseractOCRAggregate"
BlueprintName = "TesseractOCRAggregate"
ReferencedContainer = "container:Tesseract OCR iOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand All @@ -54,7 +40,7 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
buildConfiguration = "Coverage">
<Testables>
<TestableReference
skipped = "NO">
Expand Down Expand Up @@ -82,7 +68,7 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
buildConfiguration = "Coverage"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
Expand Down
107 changes: 97 additions & 10 deletions TestsProject/TestsProject.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
73BE4C341A5BD324002C15F1 /* image_sample.hOCR */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = image_sample.hOCR; sourceTree = "<group>"; };
73BE4C431A5DADDD002C15F1 /* TesseractOCR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TesseractOCR.framework; path = "../build/Debug-iphoneos/TesseractOCR.framework"; sourceTree = "<group>"; };
73C0A7BC1A59561F00D823D4 /* TesseractOCR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = TesseractOCR.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8CA185A06F5E788CE0DC28EB /* Pods-TestsProjectTests.coverage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestsProjectTests.coverage.xcconfig"; path = "../Pods/Target Support Files/Pods-TestsProjectTests/Pods-TestsProjectTests.coverage.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -215,6 +216,7 @@
children = (
36B555C7AA77E5D05A50F31C /* Pods-TestsProjectTests.debug.xcconfig */,
0AFE52DB6EB8A535E8FC8DF5 /* Pods-TestsProjectTests.release.xcconfig */,
8CA185A06F5E788CE0DC28EB /* Pods-TestsProjectTests.coverage.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -414,8 +416,8 @@
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
Expand Down Expand Up @@ -529,10 +531,7 @@
INFOPLIST_FILE = TestsProjectTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-l\"Pods-TestsProjectTests-Kiwi\"",
"-framework",
"\"XCTest\"",
"$(inherited)",
"-lstdc++",
);
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -552,24 +551,110 @@
INFOPLIST_FILE = TestsProjectTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"-ObjC",
"-l\"Pods-TestsProjectTests-Kiwi\"",
"-framework",
"\"XCTest\"",
"$(inherited)",
"-lstdc++",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsProject.app/TestsProject";
};
name = Release;
};
F4EE1C761A612A1B007BB075 /* Coverage */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
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 = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Coverage;
};
F4EE1C771A612A1B007BB075 /* Coverage */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
);
INFOPLIST_FILE = TestsProject/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
OTHER_LDFLAGS = (
"-lstdc++",
"-ObjC",
);
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Coverage;
};
F4EE1C781A612A1B007BB075 /* Coverage */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8CA185A06F5E788CE0DC28EB /* Pods-TestsProjectTests.coverage.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
);
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = TestsProjectTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_LDFLAGS = (
"$(inherited)",
"-lstdc++",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsProject.app/TestsProject";
};
name = Coverage;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
4115B9561A3EF8E90004EC0A /* Build configuration list for PBXProject "TestsProject" */ = {
isa = XCConfigurationList;
buildConfigurations = (
4115B97C1A3EF8E90004EC0A /* Debug */,
F4EE1C761A612A1B007BB075 /* Coverage */,
4115B97D1A3EF8E90004EC0A /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand All @@ -579,6 +664,7 @@
isa = XCConfigurationList;
buildConfigurations = (
4115B97F1A3EF8E90004EC0A /* Debug */,
F4EE1C771A612A1B007BB075 /* Coverage */,
4115B9801A3EF8E90004EC0A /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand All @@ -588,6 +674,7 @@
isa = XCConfigurationList;
buildConfigurations = (
4115B9821A3EF8E90004EC0A /* Debug */,
F4EE1C781A612A1B007BB075 /* Coverage */,
4115B9831A3EF8E90004EC0A /* Release */,
);
defaultConfigurationIsVisible = 0;
Expand Down

0 comments on commit 7d01e0e

Please sign in to comment.