@@ -62,6 +62,7 @@ class TestRootFactory(
62
62
if (! device.pushFolder(testApp, remoteTestApp)) {
63
63
throw DeviceSetupException (" failed to push app under test to remote device" )
64
64
}
65
+ ensureApplicationBinaryIsExecutable(remoteFileManager, bundle)
65
66
val runnerPlugins = when (device.sdk) {
66
67
Sdk .IPHONEOS , Sdk .IPHONESIMULATOR -> remoteFileManager.joinPath(testRunnerApp, " PlugIns" )
67
68
Sdk .MACOS -> remoteFileManager.joinPath(testRunnerApp, " Contents" , " PlugIns" )
@@ -150,6 +151,7 @@ class TestRootFactory(
150
151
if (! device.pushFolder(testApp, remoteTestApp)) {
151
152
throw DeviceSetupException (" failed to push app under test to remote device" )
152
153
}
154
+ ensureApplicationBinaryIsExecutable(remoteFileManager, bundle)
153
155
154
156
/* *
155
157
* A common scenario is to place xctest for unit tests inside the app's PlugIns.
@@ -163,6 +165,7 @@ class TestRootFactory(
163
165
if (! device.pushFolder(bundle.testApplication, remoteXctest)) {
164
166
throw DeviceSetupException (" failed to push xctest to remote device" )
165
167
}
168
+ ensureApplicationBinaryIsExecutable(remoteFileManager, bundle)
166
169
}
167
170
168
171
if (device.sdk == Sdk .IPHONEOS ) {
@@ -234,23 +237,37 @@ class TestRootFactory(
234
237
)
235
238
}
236
239
240
+ private suspend fun ensureApplicationBinaryIsExecutable (
241
+ remoteFileManager : RemoteFileManager ,
242
+ bundle : AppleTestBundle
243
+ ) {
244
+ bundle.applicationBinary?.let {
245
+ val remoteApplicationBinary = joinPath(
246
+ remoteFileManager.remoteApplication(),
247
+ * bundle.relativeBinaryPath,
248
+ it.name
249
+ )
250
+ device.binaryEnvironment.chmod.makeExecutable(remoteApplicationBinary)
251
+ }
252
+ }
253
+
237
254
private suspend fun generateTestRunnerApp (
238
255
testRoot : String ,
239
256
platformLibraryPath : String ,
240
257
bundle : AppleTestBundle ,
241
258
): String {
242
259
val remoteTestBinary = joinPath(
243
260
device.remoteFileManager.remoteXctestFile(),
244
- * bundle.relativeTestBinaryPath ,
261
+ * bundle.relativeBinaryPath ,
245
262
bundle.testBinary.nameWithoutExtension
246
263
)
247
264
val baseApp = joinPath(platformLibraryPath, " Xcode" , " Agents" , " XCTRunner.app" )
248
265
val runnerBinaryName = " ${bundle.testBundleId} -Runner"
249
266
val testRunnerApp = joinPath(testRoot, " $runnerBinaryName .app" )
250
267
device.remoteFileManager.copy(baseApp, testRunnerApp)
251
268
252
- val baseTestRunnerBinary = joinPath(testRunnerApp, * bundle.relativeTestBinaryPath , " XCTRunner" )
253
- val testRunnerBinary = joinPath(testRunnerApp, * bundle.relativeTestBinaryPath , runnerBinaryName)
269
+ val baseTestRunnerBinary = joinPath(testRunnerApp, * bundle.relativeBinaryPath , " XCTRunner" )
270
+ val testRunnerBinary = joinPath(testRunnerApp, * bundle.relativeBinaryPath , runnerBinaryName)
254
271
device.remoteFileManager.copy(baseTestRunnerBinary, testRunnerBinary)
255
272
256
273
matchArchitectures(remoteTestBinary, testRunnerBinary)
0 commit comments