Fuzzer icon indicating copy to clipboard operation
Fuzzer copied to clipboard

[ios] [carthage]unit tests do not run when Fuzzer's framework binary from carthage is linked to the test target

Open dodikk opened this issue 7 years ago • 5 comments

Might be a bug of xcode. 

I'm getting the error below :

11:08:46.732 Xcode[2770:165018] DD23BA8F-6178-4475-973C-C4DAA7813BD0: Launched app with identifier: *****CENSORED****** (pid = 5976)
11:08:46.732 Xcode[2770:165018] Tracking pid 5976 for simulator <DVTiPhoneSimulator: 0x7fcaa80d5070> {
		SimDevice: SimDevice : iPhone SE (DD23BA8F-6178-4475-973C-C4DAA7813BD0) : state={ Booted } deviceType={ SimDeviceType : com.apple.CoreSimulator.SimDeviceType.iPhone-SE } runtime={ SimRuntime : 10.2 (14C89) - com.apple.CoreSimulator.SimRuntime.iOS-10-2 }
}
11:08:46.732 Xcode[2770:165018] Checking to see if pid 5976 is valid: kill(pid, 0) = 0 (YES, it's still running)
11:08:46.732 Xcode[2770:165018] Setting up DVTNotifyOnProcDeath for pid 5976
11:08:46.733 Xcode[2770:123883] Test process runnable PID is 5976.
11:08:49.528 Xcode[2770:123883] Launch session finished initial intensive file IO.
11:08:49.528 Xcode[2770:123883] Waiting for test process to check in..., will wait up to 120s
11:08:50.406 Xcode[2770:123883] Got death notice for pid 5976, removing from SimulatorSessionMap
11:08:50.444 Xcode[2770:123883] Launch session expired.
11:08:50.471 Xcode[2770:123883] Test operation failure: Launch session expired before checking in.
11:08:50.472 Xcode[2770:123883] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=4 "Launch session expired before checking in." UserInfo={NSLocalizedDescription=Launch session expired before checking in.} didCancel: 1

The tests run properly when Fuzzer is added as a sub-project and built from source.

2-works

dodikk avatar Mar 22 '17 09:03 dodikk

In my configuration the entire app is linked to the test target. Unfortunately, I cannot change this for this particular project. Some users might face the same issue so I've put it down here.

dodikk avatar Mar 22 '17 09:03 dodikk

We also need to check if the "binary from carthage" approach works for library tests.

In this case the test target has a dependency on

  • Fuzzer.framework dynamic iOS binary from Carthage
  • A library or a framework with the code to be tested

dodikk avatar Mar 22 '17 09:03 dodikk

I've just stumbled upon this and found something that might be a culprit.

$ otool -L Carthage/Build/iOS/Fuzzer.framework/Fuzzer
Carthage/Build/iOS/Fuzzer.framework/Fuzzer:
	/Library/Frameworks/Fuzzer.framework/Fuzzer (compatibility version 0.0.0, current version 0.0.0)
...
$ otool -L Carthage/Build/iOS/Cuckoo.framework/Cuckoo 
Carthage/Build/iOS/Cuckoo.framework/Cuckoo:
	@rpath/Cuckoo.framework/Cuckoo (compatibility version 1.0.0, current version 1.0.0)
...

Note that Fuzzer has an absolute install name, while Cuckoo (used just as an example of a Carthage-built framework that works) uses @rpath.

nikolaykasyanov avatar Mar 18 '18 20:03 nikolaykasyanov

@dodikk could you please check whether this PR fixes your issue?

nikolaykasyanov avatar Mar 18 '18 20:03 nikolaykasyanov

@nikolaykasyanov , sure. I'll try these days.

dodikk avatar Mar 19 '18 10:03 dodikk