SlatherOrg / slather

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

Argument list too long #431

Closed Tiny0529 closed 3 years ago

Tiny0529 commented 5 years ago

slather coverage -x --verbose --output-directory sonar-reports/cobertura.xml --source-files Classes/xx.m --scheme iLife --workspace xx.xcworkspace xx.xcodeproj Slathering...

Processing coverage file: /Users/xx/Library/Developer/Xcode/DerivedData/xx-bjvnokbuenhgoifyeirbwfwusokf/Build/ProfileData/4FFDFBE8-97B6-4AB0-9AF2-FF1078D2B40B/Coverage.profdata Against binary files: /Users/xx/Library/Developer/Xcode/DerivedData/xx-bjvnokbuenhgoifyeirbwfwusokf/Build/Products/Debug-iphonesimulator/xx.app/xx

sh: /usr/bin/xcrun: Argument list too long

weibel commented 4 years ago

This issue and issue https://github.com/SlatherOrg/slather/issues/442 and possibly https://github.com/SlatherOrg/slather/issues/441 seems a lot like issue https://github.com/SlatherOrg/slather/issues/243 which PR https://github.com/SlatherOrg/slather/pull/414 fixed long time ago. I suspect there's a change in MacOS Catalina which throws an error different from Errno::E2BIG (Edit: This seems unlikely). It might also be a completely different problem, but it's difficult to say without more info.

kapfab commented 4 years ago

We're encountering the same issue since about two months on one of our projects, for some builds only (but reproducible with these builds).

PR #414 actually catches the E2BIG error in most cases (I’ve seen it split the command line in two for other projects/branches), but in these specific cases, the error is not caught. But we still end up with the same /usr/bin/xcrun: Argument list too long message. So I also suspect another error than E2BIG to be thrown.

Note that in these cases, the total length of "xcrun llvm-cov" + llvm_cov_args + source_files is less than ARG_MAX (262144 bytes for Catalina), even if I add the 1802 bytes of env vars (I read they could count in ARG_MAX). And AFAIK, we have no filenames with non-latin characters that could use more than 1 byte.

mrdjtoto commented 4 years ago

Hello, I am facing the same problem on one of my code coverage calculation. I've performed the unit test in fastlane with scan (calling them all from Jenkins) and then I am using slather to get the code coverage in llcov format. This is the command and the following output:

slather coverage --jenkins --llvm-cov --build-directory ./DerivedData --binary-basename 'My App Mobile' --output-directory ./sonar-reports --scheme MYA_UAT --workspace MyApp.xcworkspace MyApp.xcodeproj /Users/vobadm/.rvm/gems/ruby-2.4.2/gems/slather-2.4.7/lib/slather.rb:26: warning: Insecure world writable dir /change in PATH, mode 040777 Slathering... sh: /usr/bin/xcrun: Argument list too long Slathered

Is there a way to get through this?

omarzl commented 4 years ago

I am having the same error, we are integrating it with sonar but even running manually it shows the same error:

+ slather coverage --verbose --cobertura-xml --output-directory /Users/vagrant/git/sonar-reports

Processing coverage file: /Users/vagrant/Library/Developer/Xcode/DerivedData/Name-fgsnqlaygdiojpeejbsurhqtiifh/Build/ProfileData/CB40CADF-1FE8-47B6-9C56-1B1D2EC2A1D9/Coverage.profdata
Against binary files:
    /Users/vagrant/Library/Developer/Xcode/DerivedData/Name-fgsnqlaygdiojpeejbsurhqtiifh/Build/Products/Debug-iphonesimulator/Name.app/Name
    /Users/vagrant/Library/Developer/Xcode/DerivedData/Name-fgsnqlaygdiojpeejbsurhqtiifh/Build/Products/Debug-iphonesimulator/Payments-Unit-UnitTests.xctest/Payments-Unit-UnitTests
    /Users/vagrant/Library/Developer/Xcode/DerivedData/Name-fgsnqlaygdiojpeejbsurhqtiifh/Build/Products/Debug-iphonesimulator/Network-Unit-NetworkTests.xctest/Network-Unit-NetworkTests
sh: /usr/bin/xcrun: Argument list too long
Slathered
yfujiki commented 3 years ago

And nope. Above doesn't fix it either 😵

ksuther commented 3 years ago

Fixed by #476.