Skip to content

Commit 7d01e0e

Browse files
author
Kevin Conley
committed
Resolved test coverage issue.
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.
1 parent eb2dae3 commit 7d01e0e

File tree

7 files changed

+189
-33
lines changed

7 files changed

+189
-33
lines changed

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://github.com/CocoaPods/Specs.git'
22
workspace 'Tesseract-OCR-iOS'
3-
xcodeproj 'TestsProject/TestsProject.xcodeproj/'
3+
xcodeproj 'TestsProject/TestsProject.xcodeproj/', 'Coverage' => :debug
44

55
target 'TestsProjectTests' do
66

Podfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ DEPENDENCIES:
77
SPEC CHECKSUMS:
88
Kiwi: 73e1400209055ee9c8ba78c6012b6b642d0fb9f7
99

10-
COCOAPODS: 0.35.0
10+
COCOAPODS: 0.36.0.beta.1

Template Framework Project/Template Framework Project.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
"$(inherited)",
303303
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
304304
);
305-
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
305+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
306306
GCC_PRECOMPILE_PREFIX_HEADER = YES;
307307
GCC_PREFIX_HEADER = "Template Framework Project/Template Framework Project-Prefix.pch";
308308
INFOPLIST_FILE = "Template Framework Project/Template Framework Project-Info.plist";
@@ -327,7 +327,7 @@
327327
"$(inherited)",
328328
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
329329
);
330-
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
330+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
331331
GCC_PRECOMPILE_PREFIX_HEADER = YES;
332332
GCC_PREFIX_HEADER = "Template Framework Project/Template Framework Project-Prefix.pch";
333333
INFOPLIST_FILE = "Template Framework Project/Template Framework Project-Info.plist";

Tesseract OCR iOS.xcodeproj/project.pbxproj

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@
581581
COPY_PHASE_STRIP = NO;
582582
GCC_C_LANGUAGE_STANDARD = gnu99;
583583
GCC_DYNAMIC_NO_PIC = NO;
584-
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
585-
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
584+
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
585+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
586586
GCC_OPTIMIZATION_LEVEL = 0;
587587
GCC_PREPROCESSOR_DEFINITIONS = (
588588
"DEBUG=1",
@@ -716,13 +716,95 @@
716716
};
717717
name = Release;
718718
};
719+
F4EE1C791A612ADC007BB075 /* Coverage */ = {
720+
isa = XCBuildConfiguration;
721+
buildSettings = {
722+
ALWAYS_SEARCH_USER_PATHS = NO;
723+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
724+
CLANG_CXX_LIBRARY = "compiler-default";
725+
CLANG_ENABLE_OBJC_ARC = YES;
726+
CLANG_WARN_CONSTANT_CONVERSION = YES;
727+
CLANG_WARN_EMPTY_BODY = YES;
728+
CLANG_WARN_ENUM_CONVERSION = YES;
729+
CLANG_WARN_INT_CONVERSION = YES;
730+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
731+
COPY_PHASE_STRIP = NO;
732+
GCC_C_LANGUAGE_STANDARD = gnu99;
733+
GCC_DYNAMIC_NO_PIC = NO;
734+
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
735+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
736+
GCC_OPTIMIZATION_LEVEL = 0;
737+
GCC_PREPROCESSOR_DEFINITIONS = (
738+
"DEBUG=1",
739+
"$(inherited)",
740+
);
741+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
742+
GCC_WARN_ABOUT_RETURN_TYPE = YES;
743+
GCC_WARN_UNINITIALIZED_AUTOS = YES;
744+
GCC_WARN_UNUSED_VARIABLE = YES;
745+
INFOPLIST_FILE = "";
746+
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
747+
ONLY_ACTIVE_ARCH = YES;
748+
OTHER_LDFLAGS = (
749+
"-ObjC",
750+
"-lstdc++",
751+
);
752+
SDKROOT = iphoneos;
753+
};
754+
name = Coverage;
755+
};
756+
F4EE1C7A1A612ADC007BB075 /* Coverage */ = {
757+
isa = XCBuildConfiguration;
758+
buildSettings = {
759+
CLANG_CXX_LIBRARY = "libc++";
760+
CLANG_ENABLE_MODULES = YES;
761+
CLANG_WARN_BOOL_CONVERSION = YES;
762+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
763+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
764+
CLANG_WARN_UNREACHABLE_CODE = YES;
765+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
766+
CURRENT_PROJECT_VERSION = 1;
767+
DEFINES_MODULE = YES;
768+
DYLIB_COMPATIBILITY_VERSION = 1;
769+
DYLIB_CURRENT_VERSION = 1;
770+
DYLIB_INSTALL_NAME_BASE = "@rpath";
771+
ENABLE_STRICT_OBJC_MSGSEND = YES;
772+
GCC_PREPROCESSOR_DEFINITIONS = (
773+
"DEBUG=1",
774+
"$(inherited)",
775+
);
776+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
777+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
778+
GCC_WARN_UNDECLARED_SELECTOR = YES;
779+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
780+
GCC_WARN_UNUSED_FUNCTION = YES;
781+
INFOPLIST_FILE = "TesseractOCR/TesseractOCR-Info.plist";
782+
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
783+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
784+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
785+
LIBRARY_SEARCH_PATHS = (
786+
"$(inherited)",
787+
"$(PROJECT_DIR)/TesseractOCR/lib",
788+
);
789+
MACH_O_TYPE = staticlib;
790+
MTL_ENABLE_DEBUG_INFO = YES;
791+
PRODUCT_NAME = "$(TARGET_NAME)";
792+
SKIP_INSTALL = YES;
793+
TARGETED_DEVICE_FAMILY = "1,2";
794+
VALID_ARCHS = "arm64 armv7 armv7s i386 x86_64";
795+
VERSIONING_SYSTEM = "apple-generic";
796+
VERSION_INFO_PREFIX = "";
797+
};
798+
name = Coverage;
799+
};
719800
/* End XCBuildConfiguration section */
720801

721802
/* Begin XCConfigurationList section */
722803
64F74CC4172FD75F0068E657 /* Build configuration list for PBXProject "Tesseract OCR iOS" */ = {
723804
isa = XCConfigurationList;
724805
buildConfigurations = (
725806
64F74CD5172FD75F0068E657 /* Debug */,
807+
F4EE1C791A612ADC007BB075 /* Coverage */,
726808
64F74CD6172FD75F0068E657 /* Release */,
727809
);
728810
defaultConfigurationIsVisible = 0;
@@ -732,6 +814,7 @@
732814
isa = XCConfigurationList;
733815
buildConfigurations = (
734816
73C0A78F1A592C2B00D823D4 /* Debug */,
817+
F4EE1C7A1A612ADC007BB075 /* Coverage */,
735818
73C0A7901A592C2B00D823D4 /* Release */,
736819
);
737820
defaultConfigurationIsVisible = 0;

Tesseract OCR iOS.xcodeproj/xcshareddata/xcschemes/TesseractOCR.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4141
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
4242
shouldUseLaunchSchemeArgsEnv = "YES"
43-
buildConfiguration = "Debug">
43+
buildConfiguration = "Coverage">
4444
<Testables>
4545
<TestableReference
4646
skipped = "NO">

Tesseract-OCR-iOS.xcworkspace/xcshareddata/xcschemes/TestsProject.xcscheme

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,6 @@
2020
ReferencedContainer = "container:TestsProject/TestsProject.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
23-
<BuildActionEntry
24-
buildForTesting = "YES"
25-
buildForRunning = "YES"
26-
buildForProfiling = "YES"
27-
buildForArchiving = "YES"
28-
buildForAnalyzing = "YES">
29-
<BuildableReference
30-
BuildableIdentifier = "primary"
31-
BlueprintIdentifier = "64A0293917307C7E002B12E7"
32-
BuildableName = "TesseractOCRAggregate"
33-
BlueprintName = "TesseractOCRAggregate"
34-
ReferencedContainer = "container:Tesseract OCR iOS.xcodeproj">
35-
</BuildableReference>
36-
</BuildActionEntry>
3723
<BuildActionEntry
3824
buildForTesting = "YES"
3925
buildForRunning = "YES"
@@ -54,7 +40,7 @@
5440
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
5541
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
5642
shouldUseLaunchSchemeArgsEnv = "YES"
57-
buildConfiguration = "Debug">
43+
buildConfiguration = "Coverage">
5844
<Testables>
5945
<TestableReference
6046
skipped = "NO">
@@ -82,7 +68,7 @@
8268
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
8369
launchStyle = "0"
8470
useCustomWorkingDirectory = "NO"
85-
buildConfiguration = "Debug"
71+
buildConfiguration = "Coverage"
8672
ignoresPersistentStateOnLaunch = "NO"
8773
debugDocumentVersioning = "YES"
8874
allowLocationSimulation = "YES">

TestsProject/TestsProject.xcodeproj/project.pbxproj

Lines changed: 97 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
73BE4C341A5BD324002C15F1 /* image_sample.hOCR */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = image_sample.hOCR; sourceTree = "<group>"; };
8585
73BE4C431A5DADDD002C15F1 /* TesseractOCR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TesseractOCR.framework; path = "../build/Debug-iphoneos/TesseractOCR.framework"; sourceTree = "<group>"; };
8686
73C0A7BC1A59561F00D823D4 /* TesseractOCR.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = TesseractOCR.framework; sourceTree = BUILT_PRODUCTS_DIR; };
87+
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>"; };
8788
/* End PBXFileReference section */
8889

8990
/* Begin PBXFrameworksBuildPhase section */
@@ -215,6 +216,7 @@
215216
children = (
216217
36B555C7AA77E5D05A50F31C /* Pods-TestsProjectTests.debug.xcconfig */,
217218
0AFE52DB6EB8A535E8FC8DF5 /* Pods-TestsProjectTests.release.xcconfig */,
219+
8CA185A06F5E788CE0DC28EB /* Pods-TestsProjectTests.coverage.xcconfig */,
218220
);
219221
name = Pods;
220222
sourceTree = "<group>";
@@ -414,8 +416,8 @@
414416
ENABLE_STRICT_OBJC_MSGSEND = YES;
415417
GCC_C_LANGUAGE_STANDARD = gnu99;
416418
GCC_DYNAMIC_NO_PIC = NO;
417-
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
418-
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
419+
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
420+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO;
419421
GCC_OPTIMIZATION_LEVEL = 0;
420422
GCC_PREPROCESSOR_DEFINITIONS = (
421423
"DEBUG=1",
@@ -529,10 +531,7 @@
529531
INFOPLIST_FILE = TestsProjectTests/Info.plist;
530532
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
531533
OTHER_LDFLAGS = (
532-
"-ObjC",
533-
"-l\"Pods-TestsProjectTests-Kiwi\"",
534-
"-framework",
535-
"\"XCTest\"",
534+
"$(inherited)",
536535
"-lstdc++",
537536
);
538537
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -552,24 +551,110 @@
552551
INFOPLIST_FILE = TestsProjectTests/Info.plist;
553552
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
554553
OTHER_LDFLAGS = (
555-
"-ObjC",
556-
"-l\"Pods-TestsProjectTests-Kiwi\"",
557-
"-framework",
558-
"\"XCTest\"",
554+
"$(inherited)",
559555
"-lstdc++",
560556
);
561557
PRODUCT_NAME = "$(TARGET_NAME)";
562558
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsProject.app/TestsProject";
563559
};
564560
name = Release;
565561
};
562+
F4EE1C761A612A1B007BB075 /* Coverage */ = {
563+
isa = XCBuildConfiguration;
564+
buildSettings = {
565+
ALWAYS_SEARCH_USER_PATHS = NO;
566+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
567+
CLANG_CXX_LIBRARY = "libc++";
568+
CLANG_ENABLE_MODULES = YES;
569+
CLANG_ENABLE_OBJC_ARC = YES;
570+
CLANG_WARN_BOOL_CONVERSION = YES;
571+
CLANG_WARN_CONSTANT_CONVERSION = YES;
572+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
573+
CLANG_WARN_EMPTY_BODY = YES;
574+
CLANG_WARN_ENUM_CONVERSION = YES;
575+
CLANG_WARN_INT_CONVERSION = YES;
576+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
577+
CLANG_WARN_UNREACHABLE_CODE = YES;
578+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
579+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
580+
COPY_PHASE_STRIP = NO;
581+
ENABLE_STRICT_OBJC_MSGSEND = YES;
582+
GCC_C_LANGUAGE_STANDARD = gnu99;
583+
GCC_DYNAMIC_NO_PIC = NO;
584+
GCC_GENERATE_TEST_COVERAGE_FILES = YES;
585+
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES;
586+
GCC_OPTIMIZATION_LEVEL = 0;
587+
GCC_PREPROCESSOR_DEFINITIONS = (
588+
"DEBUG=1",
589+
"$(inherited)",
590+
);
591+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
592+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
593+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
594+
GCC_WARN_UNDECLARED_SELECTOR = YES;
595+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
596+
GCC_WARN_UNUSED_FUNCTION = YES;
597+
GCC_WARN_UNUSED_VARIABLE = YES;
598+
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
599+
MTL_ENABLE_DEBUG_INFO = YES;
600+
ONLY_ACTIVE_ARCH = YES;
601+
SDKROOT = iphoneos;
602+
TARGETED_DEVICE_FAMILY = "1,2";
603+
};
604+
name = Coverage;
605+
};
606+
F4EE1C771A612A1B007BB075 /* Coverage */ = {
607+
isa = XCBuildConfiguration;
608+
buildSettings = {
609+
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
610+
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
611+
FRAMEWORK_SEARCH_PATHS = (
612+
"$(inherited)",
613+
"$(PROJECT_TEMP_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
614+
);
615+
INFOPLIST_FILE = TestsProject/Info.plist;
616+
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
617+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
618+
OTHER_LDFLAGS = (
619+
"-lstdc++",
620+
"-ObjC",
621+
);
622+
PRODUCT_NAME = "$(TARGET_NAME)";
623+
};
624+
name = Coverage;
625+
};
626+
F4EE1C781A612A1B007BB075 /* Coverage */ = {
627+
isa = XCBuildConfiguration;
628+
baseConfigurationReference = 8CA185A06F5E788CE0DC28EB /* Pods-TestsProjectTests.coverage.xcconfig */;
629+
buildSettings = {
630+
BUNDLE_LOADER = "$(TEST_HOST)";
631+
FRAMEWORK_SEARCH_PATHS = (
632+
"$(SDKROOT)/Developer/Library/Frameworks",
633+
"$(inherited)",
634+
);
635+
GCC_PREPROCESSOR_DEFINITIONS = (
636+
"DEBUG=1",
637+
"$(inherited)",
638+
);
639+
INFOPLIST_FILE = TestsProjectTests/Info.plist;
640+
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
641+
OTHER_LDFLAGS = (
642+
"$(inherited)",
643+
"-lstdc++",
644+
);
645+
PRODUCT_NAME = "$(TARGET_NAME)";
646+
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestsProject.app/TestsProject";
647+
};
648+
name = Coverage;
649+
};
566650
/* End XCBuildConfiguration section */
567651

568652
/* Begin XCConfigurationList section */
569653
4115B9561A3EF8E90004EC0A /* Build configuration list for PBXProject "TestsProject" */ = {
570654
isa = XCConfigurationList;
571655
buildConfigurations = (
572656
4115B97C1A3EF8E90004EC0A /* Debug */,
657+
F4EE1C761A612A1B007BB075 /* Coverage */,
573658
4115B97D1A3EF8E90004EC0A /* Release */,
574659
);
575660
defaultConfigurationIsVisible = 0;
@@ -579,6 +664,7 @@
579664
isa = XCConfigurationList;
580665
buildConfigurations = (
581666
4115B97F1A3EF8E90004EC0A /* Debug */,
667+
F4EE1C771A612A1B007BB075 /* Coverage */,
582668
4115B9801A3EF8E90004EC0A /* Release */,
583669
);
584670
defaultConfigurationIsVisible = 0;
@@ -588,6 +674,7 @@
588674
isa = XCConfigurationList;
589675
buildConfigurations = (
590676
4115B9821A3EF8E90004EC0A /* Debug */,
677+
F4EE1C781A612A1B007BB075 /* Coverage */,
591678
4115B9831A3EF8E90004EC0A /* Release */,
592679
);
593680
defaultConfigurationIsVisible = 0;

0 commit comments

Comments
 (0)