Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

#125 Report Path sanitization #126

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sarmadali20
Copy link

@sarmadali20 sarmadali20 commented Feb 13, 2018

#125
fix the report paths when : is part of device id connected to adb replace with -

@sarmadali20
Copy link
Author

quick fix may need cleanup

@sarmadali20
Copy link
Author

@artem-zinnatullin have a look when u get a chance

@@ -38,6 +42,8 @@ data class AdbDeviceTest(
}
}

fun AdbDevice.sanitizedId() = id.replace(":","-")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it would be great to create simple data class for id with an extension sanitized() to avoid duplication of those methods here and in Main.kt. Or even having separate val sanitized for storing sanitized path. WDYT?

Copy link
Collaborator

@artem-zinnatullin artem-zinnatullin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, somehow it went below my radar, just noticed it

@@ -90,7 +90,7 @@ fun main(rawArgs: Array<String>) {
.flatMap { adbDeviceTestRun ->
writeJunit4Report(
suite = adbDeviceTestRun.toSuite(args.testPackage),
outputFile = File(File(args.outputDirectory, "junit4-reports"), "${device.id}.xml")
outputFile = File(File(args.outputDirectory, "junit4-reports"), "${device.sanitizedId()}.xml")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, this might break someones report parsing, we should emphasize this in release notes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also an edge case when filenames for multiple devices will be equal after sanitization e.g. both 123:456 and 123-456.

@@ -190,7 +190,9 @@ data class Device(
val id: String,
val logcat: File,
val instrumentationOutput: File
)
){
fun sanitizedId() = id.replace(":","-")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a property would look better, but I don't have strong opinion :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests btw :)

@@ -38,6 +42,8 @@ data class AdbDeviceTest(
}
}

fun AdbDevice.sanitizedId() = id.replace(":","-")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not good, we shouldn't duplicate implementation, it'll be easy to de-sync them

@sarmadali20
Copy link
Author

I will work on the feedback once I find some time, just busy with building new infra so might not need this anymore cuz my Jenkins master is now a Linux machine :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants