Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #import <Foundation/Foundation.h> | |
| 6 | |
| 7 #import "testing/gtest/ios_enable_coverage.h" | |
| 8 | |
| 9 #if !defined(NDEBUG) && BUILDFLAG(IOS_ENABLE_COVERAGE) | |
| 10 extern "C" void __llvm_profile_set_filename(const char* name); | |
| 11 #endif | |
| 12 | |
| 13 namespace coverage_util { | |
| 14 | |
| 15 void SetupIfNecessary() { | |
|
lpromero
2017/04/27 15:34:28
Maybe name this "ConfigureOutputPathIfCoverageEnab
lpromero
2017/04/27 15:44:26
Seems like this describes more the implementation
sdefresne
2017/04/28 08:06:25
I agree. I think "ConfigureCoverageReportPath" is
lpromero
2017/04/28 08:46:14
Done. Thanks!
| |
| 16 #if !defined(NDEBUG) && BUILDFLAG(IOS_ENABLE_COVERAGE) | |
| 17 static dispatch_once_t once_token; | |
| 18 dispatch_once(&once_token, ^{ | |
| 19 // Writes the profraw file to the Documents directory, where the app has | |
| 20 // write rights. | |
| 21 NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, | |
| 22 NSUserDomainMask, YES); | |
| 23 NSString* documents_directory = [paths firstObject]; | |
| 24 NSString* file_name = [documents_directory | |
| 25 stringByAppendingPathComponent:@"coverage.profraw"]; | |
| 26 | |
| 27 // For documentation, see: | |
| 28 // http://clang.llvm.org/docs/SourceBasedCodeCoverage.html | |
| 29 __llvm_profile_set_filename( | |
| 30 [file_name cStringUsingEncoding:NSUTF8StringEncoding]); | |
| 31 | |
| 32 // Print the path for easier retrieval. | |
| 33 NSLog(@"Coverage data at %@.", file_name); | |
| 34 }); | |
| 35 #endif | |
| 36 } | |
| 37 | |
| 38 } // namespace coverage_util | |
| OLD | NEW |