Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
Pass ms to spoon runner
Browse files Browse the repository at this point in the history
Also uses -1 as a default timeout value.
  • Loading branch information
Roman Mazur committed Mar 4, 2015
1 parent 24b7dbe commit 3cadd80
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/main/groovy/com/stanfy/spoon/gradle/SpoonExtension.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ class SpoonExtension {
/** Devices to run the tests on (specified with serial numbers). */
Set<String> devices

/** Whether or not animations are enabled, useful for slow machines or projects with many screenshots */
/** Whether or not animations are enabled, useful for slow machines or projects with many screenshots. */
boolean noAnimations

/** Output directory for the spoon report files. If empty, the default dir will be used */
/** Output directory for the spoon report files. If empty, the default dir will be used. */
File baseOutputDir

/** adbTimeout (in second) */
int adbTimeout
/** ADB timeout (in seconds). */
// Since negative timeouts do not make sense, -1 seems to be a good value to indicate timeout is not set.
int adbTimeout = -1

}
5 changes: 4 additions & 1 deletion src/main/groovy/com/stanfy/spoon/gradle/SpoonPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ class SpoonPlugin implements Plugin<Project> {
allDevices = !config.devices
noAnimations = config.noAnimations
failIfNoDeviceConnected = config.failIfNoDeviceConnected
adbTimeout = config.adbTimeout
if (config.adbTimeout != -1) {
// Timeout is defined in seconds in the config.
adbTimeout = config.adbTimeout * 1000
}

testSize = SpoonRunTask.TEST_SIZE_ALL

Expand Down
8 changes: 4 additions & 4 deletions src/main/groovy/com/stanfy/spoon/gradle/SpoonRunTask.groovy
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.stanfy.spoon.gradle

import com.android.build.gradle.AppPlugin
import com.android.ddmlib.testrunner.IRemoteAndroidTestRunner
import com.squareup.spoon.SpoonRunner
import groovy.transform.PackageScope
Expand Down Expand Up @@ -42,8 +41,8 @@ class SpoonRunTask extends DefaultTask implements VerificationTask {
/** Debug logging switcher. */
boolean debug

/** adbTimeout */
int adbTimeout
/** ADB timeout in ms. */
int adbTimeout = -1

/** Name of the one test to run. */
String className
Expand Down Expand Up @@ -119,7 +118,8 @@ class SpoonRunTask extends DefaultTask implements VerificationTask {
runBuilder.setTestSize(IRemoteAndroidTestRunner.TestSize.getTestSize(testSize))
}

if (adbTimeout.toString().isInteger()) {
if (adbTimeout != -1) {
LOG.info("ADB timeout $adbTimeout")
runBuilder.setAdbTimeout(adbTimeout)
}

Expand Down

0 comments on commit 3cadd80

Please sign in to comment.