Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coverage.profdata not found - Xcode 14.3 - Xcode 15.0 #541

Open
4 tasks done
salvatoreboemia opened this issue May 26, 2023 · 12 comments
Open
4 tasks done

Coverage.profdata not found - Xcode 14.3 - Xcode 15.0 #541

salvatoreboemia opened this issue May 26, 2023 · 12 comments

Comments

@salvatoreboemia
Copy link

salvatoreboemia commented May 26, 2023

Issue Description

I upadated on GitHub my pipeline in order to use latest version of macOS and Xcode (13 and 14.3), but the slather scan failed (only with new macOS and Xcode version)

Command executed
scan(
      workspace: MyWorkspace,
      clean: true,
      device: "iPhone 8",
      # devices: ["iPhone 8", "iPad Air"],
      #output_files: "TEST-report.xml",
      scheme: MyTarget,
      code_coverage: true,
      skip_build: true,
      skip_testing: "ProjectNameTargetAppUITests",
      output_directory: "./DerivedData/test-output/scan",
      derived_data_path: "./DerivedData")
    
    slather(
      build_directory: "./DerivedData",
      scheme: MyTarget,
      workspace: ProjectWorkspace,
      proj: MyProject,
      output_directory: "./DerivedData/test-output/slatherOutput", 
      cobertura_xml: true,
      verbose: true,
      ignore: ["Pods/*", "fastlane/*", "build/*", "DerivedData/*"])      
  end
Complete output when running fastlane, including the stack trace and command used
Exit status of command 'slather coverage --cobertura-xml --build-directory ./DerivedData --output-directory ./DerivedData/test-output/slatherOutput --ignore Pods/\* --ignore fastlane/\* --ignore build/\* --ignore DerivedData/\* --verbose --scheme ProjectName --workspace ProjectName.xcworkspace ./ProjectName.xcodeproj' was 1 instead of 0.

Slathering...
/usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.4/lib/slather/project.rb:239:in `profdata_coverage_dir': No coverage directory found. (StandardError)
	from /usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.4/lib/slather/project.rb:517:in `find_binary_files'
	from /usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.4/lib/slather/project.rb:336:in `configure'
	from /usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.4/lib/slather/command/coverage_command.rb:59:in `execute'
	from /usr/local/lib/ruby/gems/3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
	from /usr/local/lib/ruby/gems/3.0.0/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
	from /usr/local/lib/ruby/gems/3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
	from /usr/local/lib/ruby/gems/3.0.0/gems/clamp-1.3.2/lib/clamp/command.rb:140:in `run'
	from /usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.4/bin/slather:17:in `<top (required)>'
	from /usr/local/lib/ruby/gems/3.0.0/bin/slather:25:in `load'
	from /usr/local/lib/ruby/gems/3.0.0/bin/slather:25:in `<main>'
No coverage directory found.

	Are you sure your project is generating coverage? Make sure you enable code coverage in the Test section of your Xcode scheme.
	Did you specify your Xcode scheme? (--scheme or 'scheme' in .slather.yml)
	If you're using a workspace, did you specify it? (--workspace or 'workspace' in .slather.yml)
	If you use a different Xcode configuration, did you specify it? (--configuration or 'configuration' in .slather.yml)

Environment

GitHub Env

Do you have any suggestions in order to fix this issue on GitHub and fastlane?

Thanks a lot

@salvatoreboemia
Copy link
Author

News on this issue on Xcode 14.3 and 14.3.1?

thanks

@salvatoreboemia salvatoreboemia changed the title slather error on Azure Fastlane - Xcode 14.3 - macOS-13 slather error on Github Fastlane - Xcode 14.3 - Xcode 15.0 - macOS-13 Oct 3, 2023
@salvatoreboemia
Copy link
Author

News? I tried also on Xcode 15 and GitHub, but I got the same error

@salvatoreboemia salvatoreboemia changed the title slather error on Github Fastlane - Xcode 14.3 - Xcode 15.0 - macOS-13 Coverage.profdata not found - Xcode 14.3 - Xcode 15.0 Oct 6, 2023
@salvatoreboemia
Copy link
Author

salvatoreboemia commented Oct 6, 2023

With Xcode 14.2

Processing coverage file: /Users/runner/work/repo/repo/DerivedData/Build/ProfileData/
C9A-EA9C-4732-A6CD-ED50D/Coverage.profdata

With Xcode 14.3.x or Xcode 15

/usr/local/lib/ruby/gems/3.0.0/gems/slather-2.7.5/lib/slather/project.rb:239:in `
profdata_coverage_dir': No coverage directory found. (StandardError)

No one on this issue? @ksuther @marklarr

thanks

@evelynloo
Copy link

@salvatoreboemia I am having the same error, do you manage to solve it?

@salvatoreboemia
Copy link
Author

@salvatoreboemia I am having the same error, do you manage to solve it?

Not able to manage... I removed slather step

If you will find a fix please update this post.

Thanks

@vadimkrutovlv
Copy link

Before you do anything with your CI configuration please make sure that Xcode generates coverage report locally, in our case we didn't have this file generated, so it's not a surprise that slather did fail.

Please try to check build logs or test report (depending on the Xcode version you're using) if you can find similar error to this one

Showing All Messages
Failed to merge raw profiles in directory /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3 to destination /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3/Coverage.profdata: Aggregation tool '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/llvm-profdata' failed with exit code 1: warning: /{my project dir}/DerivedData/{my project name}/Build/ProfileData/A98EC493-3AB4-4B1C-B7FC-BC5D77B23EE3/997F01E3-3735-4897-AE00-31EBB0A9E8D3-57885.profraw: invalid instrumentation profile data (file header is corrupt)
error: no profile can be merged

If this is a case then solution described bellow might help you, I really hope it does.

We spent a lot of time debugging this problem, but none of the suggestions we found helped.

We tried to update our Podfile with these settings:

config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
config.build_settings['swiftc'] = '$(SRCROOT)/SWIFT_EXEC-no-coverage'

In our project Instrument Program Flow & Generate Legacy Test Coverage build settings were already set to NO

We also tried to change Mach-O type for our cocoa pods dependencies to **static library ** and many other things.

it appears that one of our dependencies was a binary (xcframework), most probably distributed via older version of the XCode, after updating it coverage was back.

@AlexCookeTrader
Copy link

I'm also facing this issue with Xcode 15.0 and 15.1. Would love to hear of a solution to this issue..

@jarrodlombardo-EventBase
Copy link
Contributor

The solution is to make sure ALL of your upstream dependencies have been built with XCode 14.3 or newer. If ANY of your deps is not built with XCode 14.3 or newer, the .profraw file will be corrupt, so lldb-profdata will be unable to create a .prodata file for slather to parse.
https://developer.apple.com/forums/thread/734611?answerId=775545022#775545022

@edward-sentongo
Copy link

I am currently facing the same issue. Any update on when this could get resolved?

@jarrodlombardo-EventBase
Copy link
Contributor

@edward-sentongo Are you 100% sure it's not #541 (comment) ?

Does XCode show coverage % for all of the files you care about?

@edward-sentongo
Copy link

@jarrodlombardo-EventBase Xcode does show code coverage percentages for those files.
I'll look into other solutions you suggested. Thanks

@edward-sentongo
Copy link

We decided to build everything ourselves without using Slather.
That's how we got it working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants