diff --git a/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt b/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt index 757bc1b96b..69c6932f99 100644 --- a/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt +++ b/test_runner/src/main/kotlin/ftl/gc/GcIosTestMatrix.kt @@ -15,6 +15,7 @@ import com.google.api.services.testing.model.TestSpecification import com.google.api.services.testing.model.ToolResultsHistory import ftl.args.IosArgs import ftl.ios.Xctestrun +import ftl.ios.Xctestrun.toByteArray import ftl.util.ShardCounter import ftl.util.Utils.fatalError import ftl.util.Utils.join @@ -41,7 +42,13 @@ object GcIosTestMatrix { val matrixGcsPath = join(gcsBucket, matrixGcsSuffix) val methods = args.testShardChunks.elementAt(testShardsIndex) - val generatedXctestrun = Xctestrun.rewrite(xcTestParsed, methods) + // Parameterized tests on iOS don't shard correctly. + // Avoid changing Xctestrun file when test shards is 1. + val generatedXctestrun = if (args.testShards == 1) { + xcTestParsed.toByteArray() + } else { + Xctestrun.rewrite(xcTestParsed, methods) + } val xctestrunFileGcsPath = GcStorage.uploadXCTestFile(args, gcsBucket, matrixGcsSuffix, generatedXctestrun) val iOSXCTest = IosXcTest() diff --git a/test_runner/src/main/kotlin/ftl/ios/Xctestrun.kt b/test_runner/src/main/kotlin/ftl/ios/Xctestrun.kt index f7e015bfda..ff2f68db73 100644 --- a/test_runner/src/main/kotlin/ftl/ios/Xctestrun.kt +++ b/test_runner/src/main/kotlin/ftl/ios/Xctestrun.kt @@ -106,8 +106,12 @@ object Xctestrun { setOnlyTestIdentifiers(testDictionary, methods) } + return rootClone.toByteArray() + } + + fun NSDictionary.toByteArray(): ByteArray { val out = ByteArrayOutputStream() - PropertyListParser.saveAsXML(rootClone, out) + PropertyListParser.saveAsXML(this, out) return out.toByteArray() } } diff --git a/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt b/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt index 38e26645e8..b5623dded7 100644 --- a/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/AndroidTestRunner.kt @@ -26,13 +26,13 @@ object AndroidTestRunner { val apks = resolveApks(androidArgs, runGcsPath) val jobs = arrayListOf>() val runCount = androidArgs.repeatTests - val deviceCount = androidArgs.testShardChunks.size + val shardCount = androidArgs.testShardChunks.size val shardCounter = ShardCounter() val history = GcToolResults.createToolResultsHistory(androidArgs) println(GenericTestRunner.beforeRunMessage(androidArgs)) repeat(runCount) { - repeat(deviceCount) { testShardsIndex -> + repeat(shardCount) { testShardsIndex -> jobs += async { GcAndroidTestMatrix.build( appApkGcsPath = apks.first, diff --git a/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt b/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt index e509869425..250071e41c 100644 --- a/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt +++ b/test_runner/src/main/kotlin/ftl/run/IosTestRunner.kt @@ -35,13 +35,13 @@ object IosTestRunner { val jobs = arrayListOf>() val runCount = iosArgs.repeatTests - val deviceCount = iosArgs.testShardChunks.size + val shardCount = iosArgs.testShardChunks.size val shardCounter = ShardCounter() val history = GcToolResults.createToolResultsHistory(iosArgs) println(beforeRunMessage(iosArgs)) repeat(runCount) { - repeat(deviceCount) { testShardsIndex -> + repeat(shardCount) { testShardsIndex -> jobs += async { GcIosTestMatrix.build( iosDeviceList = iosDeviceList,