SlatherOrg / slather

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

Fixed 'Argument list too long' when running 'xcrun llvm-cov' #476

Closed samuelsainz closed 3 years ago

samuelsainz commented 3 years ago

Description

POSIX systems have an ARG_MAX for the maximum total length of the command line, so the command may fail with an error message of "Argument list too long". This is happening in some cases when running Slather, as reported in #431.

This error is happening when executing xcrun llvm-cov for a large list of source files.

Solution

The solution is to use xargs. Using this command we can break the list of source_files into sublists small enough to be acceptable. xargs uses spaces as delimiters for params. To avoid issues with paths containing spaces xargs is used with -0 argument:

printf '%s\\0' #{source_files.shelljoin} | xargs -0 xcrun llvm-cov #{llvm_cov_args.shelljoin}
coveralls commented 3 years ago

Coverage Status

Coverage remained the same at 95.558% when pulling fb0622c58f0dfaf3a88beb28a62c424197410783 on samuelsainz:fix/xcrun-e2big-argument-list-too-long into d3c862b93074b1877750e651c2c70bc59fd1498c on SlatherOrg:master.

ksuther commented 3 years ago

Thanks for the contribution!

samuelsainz commented 3 years ago

@ksuther my pleasure! Do you think you could release this fix soon? I would appreciate it

ksuther commented 3 years ago

Going to wait a bit to see if #477 can go in but then I'll make a release. Thanks for the nudge!