You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright 2018 The WebRTC Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #import <Foundation/Foundation.h>
  11. #ifdef WEBRTC_IOS_ENABLE_COVERAGE
  12. extern "C" void __llvm_profile_set_filename(const char* name);
  13. #endif
  14. namespace rtc {
  15. namespace test {
  16. void ConfigureCoverageReportPath() {
  17. #ifdef WEBRTC_IOS_ENABLE_COVERAGE
  18. static dispatch_once_t once_token;
  19. dispatch_once(&once_token, ^{
  20. // Writes the profraw file to the Documents directory, where the app has
  21. // write rights.
  22. NSArray* paths =
  23. NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
  24. NSString* documents_directory = [paths firstObject];
  25. NSString* file_name = [documents_directory stringByAppendingPathComponent:@"coverage.profraw"];
  26. // For documentation, see:
  27. // http://clang.llvm.org/docs/SourceBasedCodeCoverage.html
  28. __llvm_profile_set_filename([file_name cStringUsingEncoding:NSUTF8StringEncoding]);
  29. // Print the path for easier retrieval.
  30. NSLog(@"Coverage data at %@.", file_name);
  31. });
  32. #endif // ifdef WEBRTC_IOS_ENABLE_COVERAGE
  33. }
  34. } // namespace test
  35. } // namespace rtc