From 6ef81aa11edbc435f9ab1eb2c1d6f47b1a93fa46 Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Tue, 26 Nov 2013 16:00:18 +0000 Subject: - Add gcov flushes that will happen within the test bundles to also capture the coverage data there. Needed if you link some of your code directly into the test bundles or if you have code in headers (inlines, c++ templates, etc.) - Add a preprocessor gate to only bring in the coverage support when enabled, lets you add the source, and then use a Xcode Configuration to control when it is needed, otherwise you can end up linking coverage into your Release builds. DELTA=28 (28 added, 0 deleted, 0 changed) --- UnitTesting/GTMCodeCoverageTestsST.m | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'UnitTesting/GTMCodeCoverageTestsST.m') diff --git a/UnitTesting/GTMCodeCoverageTestsST.m b/UnitTesting/GTMCodeCoverageTestsST.m index a73fdad..0159a53 100644 --- a/UnitTesting/GTMCodeCoverageTestsST.m +++ b/UnitTesting/GTMCodeCoverageTestsST.m @@ -28,6 +28,12 @@ #import "GTMCodeCoverageApp.h" +// Add GTM_IS_COVERAGE_BUILD to your GCC_PREPROCESSOR_DEFINITIONS for the +// Xcode Configuration that wants CodeCoverage support. +#if GTM_IS_COVERAGE_BUILD + +extern void __gcov_flush(); + static int gSuiteCount = 0; @interface GTMCodeCoverageTests : NSObject @@ -63,7 +69,12 @@ static int gSuiteCount = 0; if ([application respondsToSelector:@selector(gtm_gcov_flush)]) { [application performSelector:@selector(gtm_gcov_flush)]; } + + // Call flush for this executable unit. + __gcov_flush(); } } @end + +#endif // GTM_IS_COVERAGE_BUILD -- cgit v1.2.3