Skip to content

Commit

Permalink
Fix overlapping results
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz committed May 20, 2020
1 parent 08b7866 commit a144008
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion test_runner/docs/ascii/flank.jar_-android-run.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Configuration is read from flank.yml
Keeps the full path of downloaded files. Required when file names are not unique.

*--output-style*=_<outputStyle>_::
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.

*--dump-shards*::
Dumps the shards to android_shards.json for debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Configuration is read from flank.yml
Keeps the full path of downloaded files. Required when file names are not unique.

*--output-style*=_<outputStyle>_::
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.

*--dump-shards*::
Dumps the shards to android_shards.json for debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Configuration is read from flank.yml
Keeps the full path of downloaded files. Required when file names are not unique.

*--output-style*=_<outputStyle>_::
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.

*--dump-shards*::
Dumps the shards to ios_shards.json for debugging
Expand Down
2 changes: 1 addition & 1 deletion test_runner/docs/ascii/flank.jar_-ios-run.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Configuration is read from flank.yml
Keeps the full path of downloaded files. Required when file names are not unique.

*--output-style*=_<outputStyle>_::
Output style of execution status. Maybe be one of [verbose, multi, single]For runs with only one test execution default value is 'verbose', in other cases'multi' is used as default. Output style 'multi' is not displayed correctly on consoleswhich not supports ansi codes, to avoid corrupted output use `single` or `verbose`.
Output style of execution status. May be one of [verbose, multi, single]. For runs with only one test execution the default value is 'verbose', in other cases 'multi' is used as the default. The output style 'multi' is not displayed correctly on consoles which don't support ansi codes, to avoid corrupted output use `single` or `verbose`.

*--dump-shards*::
Dumps the shards to ios_shards.json for debugging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ internal fun getDownloadPath(args: IArgs, blobPath: String): Path {
return Paths.get(
localDir,
if (args.useLocalResultDir().not()) p.objName else "",
p.matrixName,
p.shardName,
p.deviceName,
if (args.keepFilePath) p.filePathName else "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
val history = GcToolResults.createToolResultsHistory(args)
val otherGcsFiles = args.uploadOtherFiles(runGcsPath)

args.resolveApks().forEach { apks: ResolvedApks ->
args.resolveApks().forEachIndexed { index: Int, apks: ResolvedApks ->
val testShards = apks.test?.let { test ->
AndroidTestShard.getTestShardChunks(args, test)
}
Expand All @@ -47,7 +47,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
val shardsWithAtLeastOneTest = testShards.filterAtLeastOneTest()
if (shardsWithAtLeastOneTest.isEmpty()) {
// No tests to run, skipping the execution.
return@forEach
return@forEachIndexed
}
allTestShardChunks += shardsWithAtLeastOneTest
}
Expand All @@ -67,7 +67,7 @@ internal suspend fun runAndroidTests(args: AndroidArgs): TestResult = coroutineS
testMatrices += executeAndroidTestMatrix(runCount = args.repeatTests) {
GcAndroidTestMatrix.build(
androidTestConfig = androidTestConfig,
runGcsPath = runGcsPath,
runGcsPath = "$runGcsPath/matrix_$index/",
additionalApkGcsPaths = uploadedApks.additionalApks,
androidDeviceList = androidDeviceList,
args = args,
Expand Down
16 changes: 10 additions & 6 deletions test_runner/src/main/kotlin/ftl/util/ObjPath.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,31 @@ data class ObjPath(
val objName: String,
val shardName: String,
val deviceName: String,
val filePathName: String
val filePathName: String,
val matrixName: String
) {
companion object {
fun parse(path: String): ObjPath {
val parsed = Paths.get(path)

val fileName = parsed.fileName.toString()
val objName = parsed.getName(0).toString()
val (deviceName, shardNumber) = parsed.getName(1).toString().split("-shard_").run {
val matrixName = parsed.getName(1).toString()
val (deviceName, shardNumber) = parsed.getName(2).toString().split("-shard_").run {
first() to getOrElse(1) { "0" }
}
val shardName = "shard_$shardNumber"
val filePathName = if (parsed.nameCount > 3) {
parsed.parent.drop(2).joinToString("/")
val filePathName = if (parsed.nameCount > 4) {
parsed.parent.drop(3).joinToString("/")
} else { "" }

return ObjPath(
fileName = fileName,
objName = objName,
shardName = shardName,
deviceName = deviceName,
filePathName = filePathName
filePathName = filePathName,
matrixName = matrixName
)
}

Expand All @@ -48,7 +51,8 @@ data class ObjPath(
objName = objName,
shardName = shardName,
deviceName = deviceName,
filePathName = filePathName
filePathName = filePathName,
matrixName = ""
)
}
}
Expand Down
2 changes: 0 additions & 2 deletions test_runner/src/main/kotlin/ftl/util/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ fun uniqueObjectName(): String {
bucketName.append(letter)
}

bucketName.append("/")

return bucketName.toString()
}

Expand Down
4 changes: 3 additions & 1 deletion test_runner/src/test/kotlin/ftl/run/TestRunnerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class TestRunnerTest {
private val gcsIosPath =
"2019-03-22_15-30-02.189000_frjt/shard_0/iphone8-12.0-en-portrait/TestLogs/Test-Transient Testing-2019.03.22_08-29-41--0700.xcresult/1_Test/Diagnostics/EarlGreyExampleSwiftTests-C6803D8C-4BDB-4C84-8945-9AC64056FBA4/EarlGreyExampleSwiftTests-EDBFF942-A88A-46A5-87CA-A1E29555C2CA/StandardOutputAndStandardError.txt"
private val gcsAndroidPath =
"2019-03-22_15-30-02.189000_frjt/iphone8-12.0-en-portrait-shard_0/StandardOutputAndStandardError.txt"
"2019-03-22_15-30-02.189000_frjt/matrix_1/iphone8-12.0-en-portrait-shard_0/StandardOutputAndStandardError.txt"
private val localResultDir = "results"
private val iosArgs = mockk<IosArgs>()
private val androidArgs = mockk<AndroidArgs>()
Expand Down Expand Up @@ -138,6 +138,7 @@ class TestRunnerTest {
assertThat(downloadFile).isEqualTo(
Paths.get(
localResultDir,
parsed.matrixName,
parsed.shardName,
parsed.deviceName,
parsed.filePathName,
Expand All @@ -159,6 +160,7 @@ class TestRunnerTest {
Paths.get(
localResultDir,
parsed.objName,
parsed.matrixName,
parsed.shardName,
parsed.deviceName,
parsed.filePathName,
Expand Down
6 changes: 2 additions & 4 deletions test_runner/src/test/kotlin/ftl/util/ObjPathTest.kt
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
package ftl.util

import com.google.common.truth.Truth.assertThat
import ftl.test.util.FlankTestRunner
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(FlankTestRunner::class)
class ObjPathTest {

@Test
fun parse() {
val path = "2019-03-22_15-39-20.400000_ESdl/NexusLowRes-28-en-portrait-shard_0/com/package/name/b.txt"
val path = "2019-03-22_15-39-20.400000_ESdl/matrix_1/NexusLowRes-28-en-portrait-shard_0/com/package/name/b.txt"
val parsed = ObjPath.parse(path)

assertThat(parsed.objName).isEqualTo("2019-03-22_15-39-20.400000_ESdl")
assertThat(parsed.fileName).isEqualTo("b.txt")
assertThat(parsed.shardName).isEqualTo("shard_0")
assertThat(parsed.deviceName).isEqualTo("NexusLowRes-28-en-portrait")
assertThat(parsed.filePathName).isEqualTo("com/package/name")
assertThat(parsed.matrixName).isEqualTo("matrix_1")
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion test_runner/src/test/kotlin/ftl/util/UtilsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class UtilsTest {
@Test
fun `uniqueObjectName verifyPattern`() {
val randomName = uniqueObjectName()
assertThat(randomName.length).isEqualTo(32)
assertThat(randomName.length).isEqualTo(31)
assertThat(randomName[4]).isEqualTo('-')
assertThat(randomName[7]).isEqualTo('-')
assertThat(randomName[10]).isEqualTo('_')
Expand Down

0 comments on commit a144008

Please sign in to comment.