Flank: Flank fails on scanning .xctest for iOS test names

Created on 28 Jan 2021  ·  2Comments  ·  Source: Flank/flank

Describe the bug

A clear and concise description of what the bug is.

Running flank on Xcode 12 / bitrise causing Flank Error.
Flank fails on searching test names in a .xctest.

To Reproduce

Steps to reproduce the behavior:

Xcode 12 and bitrise

  1. Run 'flank ios run'
  2. See error
RunTests
Found xctest: /Users/vagrant/deploy/Debug-iphoneos/UITests-Runner.app/PlugIns/UITests.xctest
isMacOS = true (mac os x)
nm -U “/Users/vagrant/deploy/Debug-iphoneos/UITests-Runner.app/PlugIns/UITests.xctest/UITests”
nm -gU “/Users/vagrant/deploy/Debug-iphoneos/UITests-Runner.app/PlugIns/UITests.xctest/UITests” | xargs -s 262144 xcrun swift-demangle
Error: xargs: xcrun: Argument list too long
Command failed: nm -gU “/Users/vagrant/deploy/Debug-iphoneos/UITests-Runner.app/PlugIns/UITests.xctest/UITests” | xargs -s 262144 xcrun swift-demangle
[33;1mFlank exited with status code `1`: A general failure occurred. Possible causes include: a filename that does not exist or an HTTP/network error.[0m

Expected behavior

A clear and concise description of what you expected to happen.

Flank shouldn't fail why searching .xctest for test names.

Details (please complete the following information):

Have you tested on the latest Flank snapshot?

Post the output of flank --version.

21.01.1

Additional context

Add any other context about the problem here.
Error occurs in parseSwiftTests() method.

val cmd = if (isMacOS) {
    "nm -gU ${binary.quote()} | xargs -s $argMax xcrun swift-demangle"
} else {
    "export LD_LIBRARY_PATH=~/.flank; export PATH=~/.flank:\$PATH; nm -gU ${binary.quote()} | xargs -s $argMax swift-demangle"
}
Bug P0 Research Tiger 🐯 iOS

Most helpful comment

As a temporary workaround, I just changed xargs -s $argMax xcrun swift-demangle to xargs -n1 xcrun swift-demangle. Obviously, this slows it down by a couple mins but it was a quick patch to make it work

All 2 comments

We should be able to reproduce this by faking a very long argument list.

Ideally there's a way to refactor the code so it works with infinitely large amounts of arguments.

Possibly we could build a custom version of swift-demangle from source that operates on input from disk instead of args? There may be better ideas.

As a temporary workaround, I just changed xargs -s $argMax xcrun swift-demangle to xargs -n1 xcrun swift-demangle. Obviously, this slows it down by a couple mins but it was a quick patch to make it work

Was this page helpful?
0 / 5 - 0 ratings