OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
Paweł Hajdan Jr.
2017/04/28 11:15:37
nit: 2017
lpromero
2017/05/02 14:05:29
Done.
| |
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 ConfigureCoverageReportPath() { | |
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 | |
Paweł Hajdan Jr.
2017/04/28 11:15:37
nit: Add // !defined(NDEBUG) && BUILDFLAG(IOS_ENAB
lpromero
2017/05/02 14:05:29
Done.
| |
36 } | |
37 | |
38 } // namespace coverage_util | |
OLD | NEW |