pxctest icon indicating copy to clipboard operation
pxctest copied to clipboard

Error when running the tests

Open zaidkazi opened this issue 7 years ago • 17 comments

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

zaidkazi avatar Dec 03 '16 21:12 zaidkazi

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.

plu avatar Dec 04 '16 02:12 plu

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?

tinder-ayu avatar Jan 20 '17 01:01 tinder-ayu

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.

plu avatar Jan 20 '17 03:01 plu

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

tinder-ayu avatar Jan 20 '17 19:01 tinder-ayu

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

plu avatar Jan 21 '17 05:01 plu

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

tinder-ayu avatar Jan 24 '17 19:01 tinder-ayu

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

andrewcrawford44 avatar Mar 21 '17 14:03 andrewcrawford44

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

ollieatkinson avatar Mar 23 '17 16:03 ollieatkinson

@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>: 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}}}

andrewcrawford44 avatar Mar 23 '17 17:03 andrewcrawford44

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

SamuelZhaoY avatar Apr 03 '17 03:04 SamuelZhaoY

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).

plu avatar Apr 03 '17 04:04 plu

@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'

andrewcrawford44 avatar Apr 10 '17 09:04 andrewcrawford44

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

plu avatar Apr 10 '17 10:04 plu

@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.

andrewcrawford44 avatar Apr 10 '17 10:04 andrewcrawford44

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

plu avatar Apr 10 '17 11:04 plu

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"}}

Shashikant86 avatar Apr 10 '17 14:04 Shashikant86

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).

plu avatar Apr 11 '17 03:04 plu