-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cleanup device script #61
Conversation
6aba66b
to
b60c35b
Compare
@@ -4,7 +4,7 @@ object Versions { | |||
val coroutines = "1.7.3" | |||
val ktor = "2.0.3" | |||
|
|||
val ddmlib = "31.0.2" | |||
val ddmlib = "31.4.2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use ddmlib similar to our AGP version
info.instrumentationPackage, | ||
info.testRunnerClass, | ||
device.ddmsDevice, | ||
StatusReporterMode.PROTO_STD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StatusReporterMode.TEXT is deprecated from API 26 and used by default in 3 arguments constructor. StatusReporterMode.PROTO_STD should be better as it will use less data because of binary format rather than text.
import com.malinskiy.marathon.log.MarathonLogConfigurator | ||
import com.malinskiy.marathon.report.logs.LogsProvider | ||
import org.koin.dsl.module | ||
|
||
val androidModule = module { | ||
single<TestParser?> { AndroidTestParser() } | ||
single<ComponentInfoExtractor?> { AndroidComponentInfoExtractor() } | ||
single<ComponentCacheKeyProvider?> { AndroidComponentCacheKeyProvider(CachedFileHasher(ApkFileHasher())) } | ||
single<ComponentCacheKeyProvider?> { AndroidComponentCacheKeyProvider(CachedFileHasher(Md5FileHasher())) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use MD5 in AndroidAppInstaller.isApkInstalled
and in AndroidAppInstaller.getHashOnDevice
, so ApkFileHasher is doing nothing. Checking MD5 is really fast and I don't see that it takes even more than a second on the build. We also have a hashmap so it is calculated only once.
logger.info("Installing $appPackage, ${appApk.absolutePath} to ${device.serialNumber}") | ||
val installationStarted = Instant.now() | ||
val installMessage = device.safeInstallPackage(appApk.absolutePath, true, optionalParams(device)) | ||
installMessage?.let { logger.debug { it } } | ||
installMessage?.let { logger.info { it } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to see as much as we can in the logs related to installation
@@ -55,6 +55,8 @@ open class MarathonExtension { | |||
//Android specific for now | |||
var autoGrantPermission: Boolean? = null | |||
var instrumentationArgs: MutableMap<String, String> = mutableMapOf() | |||
var cleanupDeviceScript: String? = null | |||
val usedStorageThresholdInPercents: Int? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a var
?
@@ -96,6 +97,8 @@ private fun createAndroidConfiguration( | |||
} | |||
} | |||
?: SerialStrategy.AUTOMATIC | |||
val cleanupDeviceScript = extension.cleanupDeviceScript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this have to be customisable? or is nullability a way to disable the cleanup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can put default variant here which will remove all test apks
It will launch if amount of space on device will be less than specified percentage