SlatherOrg / slather

Generate test coverage reports for Xcode projects & hook it into CI.
MIT License
1.56k stars 238 forks source link

Operation not permitted - /System/Volumes/Data/private/var/db/lockdown #474

Open andrewclaus opened 3 years ago

andrewclaus commented 3 years ago

This error occurred on Xcode 12 in a fairly empty sample project with only the default unit tests (no code coverage). I was using this project to test my fastlane file and CI/CD setup in Azure DevOps Microsoft hosted Mac agent (10.15)

My fastlane lane:

  lane :test do |options|
    parameter_validation(options)

    project = options[:project_name]
    scheme = project + (options[:is_library] ? "Sample" : "")

    scan(
      scheme: scheme,
      output_directory: "./sonar-reports",
      output_types: "html,junit,json-compilation-database",
      output_files: "TEST-report.html,TEST-report.xml,compile_commands.json",
      code_coverage: true,
      clean: true,
      skip_build: true,
      derived_data_path: "Build"
    )

    coverage_files_to_ignore = [
      '../../*',
      'Pods/*',
      '*Sample/*',
      '*Tests.m',
    ]

    swiftlint(
      output_file: "./sonar-reports/swiftlint.json",
      reporter: "json",
      ignore_exit_status: true,
      config_file: '.swiftlint.yml'
    )

    slather(
      scheme: scheme,
      sonarqube_xml: true,
      output_directory: "sonar-reports",
      proj: project + ".xcodeproj",
      workspace: project + ".xcworkspace",
      ignore: coverage_files_to_ignore,
      build_directory: "/"
    )
  end
[07:41:51]: $ slather coverage --sonarqube-xml --build-directory / --output-directory sonar-reports --ignore ../../\* --ignore Pods/\* --ignore \*Sample/\* --ignore \*Tests.m --scheme SampleSwift --workspace SampleSwift.xcworkspace SampleSwift.xcodeproj
[07:41:53]: ▸ Slathering...
[07:43:12]: ▸ /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/project.rb:198:in `[]': Operation not permitted - /System/Volumes/Data/private/var/db/lockdown (Errno::EPERM)
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/project.rb:198:in `profdata_coverage_dir'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/project.rb:498:in `find_binary_files'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/project.rb:437:in `configure_binary_file'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/project.rb:317:in `configure'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/lib/slather/command/coverage_command.rb:59:in `execute'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/clamp-1.3.2/lib/clamp/subcommand/execution.rb:18:in `execute'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/clamp-1.3.2/lib/clamp/command.rb:66:in `run'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/clamp-1.3.2/lib/clamp/command.rb:140:in `run'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/gems/slather-2.6.1/bin/slather:17:in `<top (required)>'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/bin/slather:23:in `load'
[07:43:12]: ▸ from /usr/local/lib/ruby/gems/2.7.0/bin/slather:23:in `<main>'
[07:43:12]: ▸ Operation not permitted - /System/Volumes/Data/private/var/db/lockdown
[07:43:12]: ▸ Are you sure your project is generating coverage? Make sure you enable code coverage in the Test section of your Xcode scheme.
[07:43:12]: ▸ Did you specify your Xcode scheme? (--scheme or 'scheme' in .slather.yml)
[07:43:12]: ▸ If you're using a workspace, did you specify it? (--workspace or 'workspace' in .slather.yml)
[07:43:12]: ▸ If you use a different Xcode configuration, did you specify it? (--configuration or 'configuration' in .slather.yml)
+----------------------------+----------+
|             Lane Context              |
+----------------------------+----------+
| DEFAULT_PLATFORM           | ios      |
| PLATFORM_NAME              | ios      |
| LANE_NAME                  | ios test |
| SCAN_DERIVED_DATA_PATH     | Build    |
| SCAN_GENERATED_PLIST_FILES | []       |
| SCAN_GENERATED_PLIST_FILE  |          |
+----------------------------+----------+