Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Error when running the tests #4

Open
zaidkazi opened this issue Dec 3, 2016 · 17 comments
Open

Error when running the tests #4

zaidkazi opened this issue Dec 3, 2016 · 17 comments

Comments

@zaidkazi
Copy link

zaidkazi commented Dec 3, 2016

After running pxctest run-tests the simulators launch but before the app is loaded

Error Domain=com.facebook.FBSimulatorControl Code=0 "Failed start test manager" UserInfo={NSLocalizedDescription=Failed start test manager, NSUnderlyingError=0x7fafc1d1d3a0 {Error Domain=com.facebook.XCTestBootstrap Code=0 "Failed to determine test runner process PID" UserInfo={NSLocalizedDescription=Failed to determine test runner process PID}}}

i get the above issue.

Using iphone 6 and 7 iOS 10.1 Simulators

@plu
Copy link
Owner

plu commented Dec 4, 2016

Just looking at this error message it's hard to tell what exactly went wrong. Is it possible that you share the products generated by xcodebuild ... build-for-testing? I understand that this is a lot to ask :). But otherwise I'm not sure how I can help, without reproducing the issue.

@tinder-ayu
Copy link

I am running into exact same problem.

source code on fbsimcontrol:

  pid_t testRunnerProcessID = [self.iosTarget.deviceOperator processIDWithBundleID:configuration.testRunner.bundleID error:error];
  if (testRunnerProcessID < 1) {
    return [[XCTestBootstrapError
      describe:@"Failed to determine test runner process PID"]
      fail:error];
  }

So it apparently failed to retrieve the PID of current simulators while simulator was up... But ps -A shows a ton of PIDs associated with iphonesimulator.

This could be FBSimulator issue also...

May I ask what part of product are you asking to see?

@plu
Copy link
Owner

plu commented Jan 20, 2017

It's really tough to help here without any further information.

It is by the way not trying to find the PID of the simulator, it is trying to find the PID of the test runner process. This is either the application under test, or, for the UI Test case, the UI Test Runner application.

@tinder-ayu
Copy link

Yes but what information do you need @plu to debug, can you be specific

@plu
Copy link
Owner

plu commented Jan 21, 2017

One possible root cause can be that your app is built for a higher deployment target than the Simulator you want to use.

Example:

screen shot 2017-01-21 at 08 54 09

When I try to run this on a 9.3 Simulator, I get the same error: Failed to determine test runner process PID

$ pxctest run-tests \
    --testrun build/Build/Products/Test_iphonesimulator10.2-x86_64.xctestrun \
    --destination 'os=iOS 9.3'

Error Domain=com.facebook.FBSimulatorControl Code=0 "Failed start test manager" UserInfo={NSLocalizedDescription=Failed start test manager, NSUnderlyingError=0x7f88226276a0 {Error Domain=com.facebook.XCTestBootstrap Code=0 "Failed to determine test runner process PID" UserInfo={NSLocalizedDescription=Failed to determine test runner process PID}}}

This is because the app requires iOS 10.2, so it cannot run on 9.3.

You can find log files per Simulator in this directory: ~/Library/Logs/CoreSimulator/

If I check the log file for the scenario described before, I can see this in the logs:

Jan 21 08:54:44 plubook assertiond[96771]: assertion failed: 16C67 13E233: assertiond + 15801 [3C808658-78EC-3950-A264-79A64E0E463B]: 0x1
Jan 21 08:54:44 plubook com.apple.CoreSimulator.SimDevice.788CB20A-8430-444B-A052-0D7D503B48FF.launchd_sim[96749] (UIKitApplication:com.plunien.Test[0x77f9][98668]): Service exited due to signal: Trace/BPT trap: 5
Jan 21 08:54:44 plubook assertiond[96771]: assertion failed: 16C67 13E233: assertiond + 15801 [3C808658-78EC-3950-A264-79A64E0E463B]: 0x1
Jan 21 08:54:44 plubook SpringBoard[98660]: Application 'UIKitApplication:com.plunien.Test[0x77f9]' crashed.

Next step is to figure out why it crashed. Crash log are placed here: ~/Library/Logs/DiagnosticReports

@tinder-ayu
Copy link

Thank you @plu for helping investigating, let me double check my simulator and will let you know in a couple of days.

@andrewcrawford44
Copy link

Were you able to get this working?

I am getting the same error. I see the simulator starting, it tries to open the app then fails with the Failed to determine test runner process PID error. Deployment target is set at 9.3 and I'm running on Simulator 10.2

@ollieatkinson
Copy link
Contributor

@andrewcrawfordstv can you provide logs for the simulator (~/Library/Logs/CoreSimulator/) and crash logs from the diagnostic reports (~/Library/Logs/DiagnosticReports)?

@andrewcrawford44
Copy link

@ollieatkinson Weird I'm not getting any logs for the times I'm running the tests...

The only thing is this in Core Simulator a few minutes before the tests ran: CoreSimulatorService[424] : Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={NSLocalizedDescription=Invalid request: Invalid port UUID specified.}

The run command I'm using is this after build for testing: pxctest run-tests --destination 'name=iPhone 7,os=iOS 10.2' --testrun build/Products/UITests_iphonesimulator10.2-x86_64.xctestrun

This results in the error when running the tests:

Error Domain=com.facebook.FBSimulatorControl Code=0 "Failed start test manager" UserInfo={NSLocalizedDescription=Failed start test manager, NSUnderlyingError=0x7fd03d7bb250 {Error Domain=com.facebook.XCTestBootstrap Code=0 "Failed to determine test runner process PID" UserInfo={NSLocalizedDescription=Failed to determine test runner process PID}}}

@SamuelZhaoY
Copy link

I also meet the same problem, my deployment target is 7.0 and base SDK is iphoneos9.0. Which makes me feel quite frustrated

@plu
Copy link
Owner

plu commented Apr 3, 2017

It might also be a 32 Bit vs. 64 Bit Simulator issue. For example iPhone 5 is 32 Bit and iPhone 5s is 64 Bit. If the test target was only compiled for x86_64, they will only run on a 64 Bit Simulator.

It's always a good idea to check the log files here: ~/Library/Logs/CoreSimulator

And the Crashes in Console.app (User Reports).

@andrewcrawford44
Copy link

@plu I'm running the tests on an iPhone 7 Simulator which is 64 bit.

I'm building for testing using this:

xcodebuild build-for-testing -IDEBuildLocationStyle=Custom -IDECustomBuildLocationType=Absolute -IDECustomBuildProductsPath="$PWD/build/Products" -workspace xx.xcworkspace -scheme xxUITests -destination 'platform=iOS Simulator,name=iPhone 7,OS=10.2'

@plu
Copy link
Owner

plu commented Apr 10, 2017

@andrewcrawfordstv please check the logs here: ~/Library/Logs/CoreSimulator

@andrewcrawford44
Copy link

@plu Only thing that gets updated is CoreSimulator.log but the last entry was about 30 mins before I ran the tests.

Something that might be worth mentioning. I just tried it there with KIF tests and it worked. Although running tests that use import XCTest fail.

@plu
Copy link
Owner

plu commented Apr 10, 2017

If your test target does not have a Host Application, then I have to disappoint you - this is not supported by pxctest.

@Shashikant86
Copy link

I can also confirm that with Xcode 8.3.1 it's not possible to run tests. Tests fails with error even we have test target with host application attached.

Error Domain=com.facebook.FBSimulatorControl Code=0 "Failed start test manager" UserInfo={NSLocalizedDescription=Failed start test manager, NSUnderlyingError=0x7fa927ef6530 {Error Domain=com.facebook.XCTestBootstrap Code=0 "Failed to determine test runner process PID" UserInfo={NSLocalizedDescription=Failed to determine test runner process PID}}}

Simulator logs are too noisy and one of the error is

com.apple.CallKit.CallDirectoryMaintenance[46748]: [Default] Error performing migrations: Error Domain=NSCocoaErrorDomain Code=513 "You don’t have permission to save the file “CallDirectory” in the folder “Library”." UserInfo={NSFilePath=/var/mobile/Library/CallDirectory, NSUnderlyingError=0x7fb05dd08530 {Error Domain=NSPOSIXErrorDomain Code=13 "Permission denied"}}

@plu
Copy link
Owner

plu commented Apr 11, 2017

Simulator logs are too noisy and one of the error is

I understand that there's a lot to digest when looking at these logs. But that's the best way to figure out what is going wrong. If you want you can upload the logs and I can have a look. Please make sure that you're providing the logs of the correct Simulator (the UDID must match).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants