xcodebuild builds test target but cannot run xctest - xcodebuild

I run a command in terminal
sudo /usr/bin/xcodebuild -project awesome.xcodeproj -scheme "AwesomeTests"
-configuration Production test -derivedDataPath ~/Documents/buildData
-sdk "OS X 10.9"
last lines of output looks like
error: failed to launch '/Applications/Xcode.app/Contents/Developer/usr/bin/xctest'
-- error: Host::LaunchProcess (launch_info) => pid=0,
path='/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/Resources/debugserver'
err = Problems with launching via XPC. XPC error : Connection interrupted (0x00000005)
** TEST SUCCEEDED **
Before outputing these lines I'm prompted with: "xcodebuild is trying to take control of a root process. Type your password to allow this"
I'm using Xcode 5.0.2.

As #trojanfoe noted, the sudo was the cause of the error.
It seems like ~/Documents/buildData folder was created with root permissions and couldn't be accessed from xtest.

Related

How do I fix Something went wrong in #nrwl/run-commands - Command failed: detox build -c ios.sim.retail.debug

I am experiencing an issue with opening an app for the first time
detox[12987] ERROR: [cli.js] Command failed: export EXCLUDED_ARCHS=arm64 && ENVFILE=.env.dev.detox xcodebuild -workspace ./apps/retail-mobile/ios/app.xcworkspace -scheme app -configuration Debug -sdk iphonesimulator -derivedDataPath ./apps/retail-mobile/ios/build -quiet
ERROR: Something went wrong in #nrwl/run-commands - Command failed: detox build -c ios.sim.retail.debug
How do I fix this? I'm totally confused as it was working before.

Error when attempting to run detox test with xcodebuild created .app file

I'm trying to create a .app that I can then reference in my .detoxrc.json file but I'm running into 2 issues.
This is the command I'm using...
xcodebuild -workspace ios/Boomin.xcworkspace -scheme Boomin -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -UseModernBuildSystem=YES -arch x86_64
The only .app file I can see is created in the ios -> build -> Build -> Products -> Debug-iphonesimulator directory and it's called customer.app. It looks like customer comes from my terminal user account. How do I rename this?
When I try to run detox test --configuration ios I get the following...
detox[19353] ERROR: field CFBundleIdentifier not found inside Info.plist of app binary at /ios/build/Build/Products/Debug-iphonesimulator/customer.app
How do I resolve both these issues?
Thanks,

How can I fix "Symbol not found: _NSURLSessionTransferSizeUnknown" when running tests using Travis that work locally?

The command xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx works locally and all of the tests pass.
Using Travis I get the following error:
Failed to query the list of test cases in the test bundle: dlopen(/Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests, 2): Symbol not found: _NSURLSessionTransferSizeUnknown
Referenced from: /Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests
Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
in /Users/travis/Library/Developer/Xcode/DerivedData/Foo-bvxkmfrwzzvtxgaeoosknyzjovjc/Build/Products/Debug/OS X Tests.xctest/Contents/MacOS/OS X Tests
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
** TEST FAILED: 0 passed, 0 failed, 0 errored, 0 total ** (21121 ms)
The command "xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx" exited with 1.
My .travis.yml file is as follows:
language: objective-c
before_install:
- gem install cocoapods --no-ri --no-rdoc --no-document --quiet
- brew update
- brew uninstall xctool
- brew install xctool
script:
- xctool -workspace Foo.xcworkspace -scheme Foo -sdk macosx -configuration Debug test -test-sdk macosx
Why does this happen and how can I fix this?
Travis does not currently support Mavericks which is the root cause of the problem.
Support for 10.9 is being tracked in this issue on GitHub.

xcodebuild failed to launch '/Applications/Xcode.app/Contents/Developer/Tools/otest' via Jenkins

error: failed to launch '/Applications/Xcode.app/Contents/Developer/Tools/otest' -- failed to get the task for process 34796
Hi,
When I run the command:
/usr/bin/xcodebuild -scheme my_scheme_name -configuration Debug build test
I get the following error:
error: failed to launch '/Applications/Xcode.app/Contents/Developer/Tools/otest' -- failed to get the task for process 34796
This only happens when the command is executed via Jenkins. Doesn't happen when I execute it from command line.
Has anyone else run into something like this?
The build itself builds an objective c library and the tests are SenTestCases. It's not an iOS app - it's an objective c library to be used in various apps
I used sudo DevToolsSecurity -enable to get past this problem.

GHUnit CLI Build: Availability.h errors

I am trying to do a command line build of a GHUnit target which builds fine inside Xcode. I am running the following command to build:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.0 build
It gets along pretty nice, until it finds an error in Availability.h, an SDK header:
/Xcode4
GM/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/AvailabilityInternal.h:56:42:
error: operator '<' has no left
operand
Obviously, I haven't made any changes to Apple's stuff, why am I getting this error and how do I fix it?
The problem is that I wasn't specifying the correct SDK version:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.0 build
Needed to be:
GHUNIT_CLI=1 xcodebuild -target
BasicBrowserUnitTest -configuration
Debug -sdk iphonesimulator4.3
build
Or in this case, the latest SDK version.