• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.tradefed.command;
18 
19 import com.android.tradefed.device.metric.AutoLogCollector;
20 import com.android.tradefed.util.UniqueMultiMap;
21 
22 import java.util.Set;
23 
24 /**
25  *  Container for execution options for commands.
26  */
27 public interface ICommandOptions {
28 
29     /**
30      * Returns <code>true</code> if abbreviated help mode has been requested
31      */
isHelpMode()32     public boolean isHelpMode();
33 
34     /**
35      * Returns <code>true</code> if full detailed help mode has been requested
36      */
isFullHelpMode()37     public boolean isFullHelpMode();
38 
39     /**
40      * Returns <code>true</code> if full json help mode has been requested
41      */
isJsonHelpMode()42     public boolean isJsonHelpMode();
43 
44     /**
45      * Return <code>true</code> if we should <emph>skip</emph> adding this command to the queue.
46      */
isDryRunMode()47     public boolean isDryRunMode();
48 
49     /**
50      * Return <code>true</code> if we should print the command out to the console before we
51      * <emph>skip</emph> adding it to the queue.
52      */
isNoisyDryRunMode()53     public boolean isNoisyDryRunMode();
54 
55     /**
56      * Return the loop mode for the config.
57      */
isLoopMode()58     public boolean isLoopMode();
59 
60     /**
61      * Get the min loop time for the config.
62      *
63      * @deprecated use {@link #getLoopTime()} instead
64      */
65     @Deprecated
getMinLoopTime()66     public long getMinLoopTime();
67 
68     /**
69      * Get the time to wait before re-scheduling this command.
70      * @return time in ms
71      */
getLoopTime()72     public long getLoopTime();
73 
74     /**
75      * Sets the loop mode for the command
76      *
77      * @param loopMode
78      */
setLoopMode(boolean loopMode)79     public void setLoopMode(boolean loopMode);
80 
81     /**
82      * Return the test-tag for the invocation. Default is 'stub' if unspecified.
83      */
getTestTag()84     public String getTestTag();
85 
86     /**
87      * Sets the test-tag for the invocation.
88      *
89      * @param testTag
90      */
setTestTag(String testTag)91     public void setTestTag(String testTag);
92 
93     /**
94      * Return the test-tag suffix, appended to test-tag to represents some variants of one test.
95      */
getTestTagSuffix()96     public String getTestTagSuffix();
97 
98     /**
99      * Creates a copy of the {@link ICommandOptions} object.
100      */
clone()101     public ICommandOptions clone();
102 
103     /**
104      * Return true if command should run on all devices.
105      */
runOnAllDevices()106     public boolean runOnAllDevices();
107 
108     /**
109      * Return true if a bugreport should be taken when the test invocation has ended.
110      */
takeBugreportOnInvocationEnded()111     public boolean takeBugreportOnInvocationEnded();
112 
113     /** Sets whether or not to capture a bugreport at the end of the invocation. */
setBugreportOnInvocationEnded(boolean takeBugreport)114     public void setBugreportOnInvocationEnded(boolean takeBugreport);
115 
116     /**
117      * Return true if a bugreportz should be taken instead of bugreport during the test invocation
118      * final bugreport.
119      */
takeBugreportzOnInvocationEnded()120     public boolean takeBugreportzOnInvocationEnded();
121 
122     /** Sets whether or not to capture a bugreportz at the end of the invocation. */
setBugreportzOnInvocationEnded(boolean takeBugreportz)123     public void setBugreportzOnInvocationEnded(boolean takeBugreportz);
124 
125     /**
126      * Return the invocation timeout specified. 0 if no timeout to be used.
127      */
getInvocationTimeout()128     public long getInvocationTimeout();
129 
130     /**
131      * Set the invocation timeout. 0 if no timeout to be used.
132      */
setInvocationTimeout(Long mInvocationTimeout)133     public void setInvocationTimeout(Long mInvocationTimeout);
134 
135     /**
136      * Return the total shard count for the command.
137      */
getShardCount()138     public Integer getShardCount();
139 
140     /**
141      * Sets the shard count for the command.
142      */
setShardCount(Integer shardCount)143     public void setShardCount(Integer shardCount);
144 
145     /**
146      * Return the shard index for the command.
147      */
getShardIndex()148     public Integer getShardIndex();
149 
150     /**
151      * Sets the shard index for the command.
152      */
setShardIndex(Integer shardIndex)153     public void setShardIndex(Integer shardIndex);
154 
155     /** Whether or not sharding should use the token support. */
shouldUseTokenSharding()156     public boolean shouldUseTokenSharding();
157 
158     /** Return true if the test should skip device setup during TestInvocation setup. */
shouldSkipPreDeviceSetup()159     public boolean shouldSkipPreDeviceSetup();
160 
161     /** Returns if we should use dynamic sharding or not */
shouldUseDynamicSharding()162     public boolean shouldUseDynamicSharding();
163 
164     /** Returns the data passed to the invocation to describe it */
getInvocationData()165     public UniqueMultiMap<String, String> getInvocationData();
166 
167     /** Returns true if we should use Tf containers to run the invocation */
shouldUseSandboxing()168     public boolean shouldUseSandboxing();
169 
170     /** Sets whether or not we should use TF containers */
setShouldUseSandboxing(boolean use)171     public void setShouldUseSandboxing(boolean use);
172 
173     /** Returns true if we should use the Tf sandbox in a test mode. */
shouldUseSandboxTestMode()174     public boolean shouldUseSandboxTestMode();
175 
176     /** Sets whether or not we should use the TF sandbox test mode. */
setUseSandboxTestMode(boolean use)177     public void setUseSandboxTestMode(boolean use);
178 
179     /** Whether or not to use sandbox mode in remote invocation. */
shouldUseRemoteSandboxMode()180     public boolean shouldUseRemoteSandboxMode();
181 
182     /** Returns the set of auto log collectors to be added for an invocation */
getAutoLogCollectors()183     public Set<AutoLogCollector> getAutoLogCollectors();
184 
185     /** Sets the set of auto log collectors that should be added to an invocation. */
setAutoLogCollectors(Set<AutoLogCollector> autoLogCollectors)186     public void setAutoLogCollectors(Set<AutoLogCollector> autoLogCollectors);
187 
188     /** Whether or not to capture a screenshot on test case failure */
captureScreenshotOnFailure()189     public boolean captureScreenshotOnFailure();
190 
191     /** Whether or not to capture a logcat on test case failure */
captureLogcatOnFailure()192     public boolean captureLogcatOnFailure();
193 
194     /** Returns the suffix to append to the Tradefed host_log or null if no prefix. */
getHostLogSuffix()195     public String getHostLogSuffix();
196 
197     /** Sets the suffix to append to Tradefed host_log. */
setHostLogSuffix(String suffix)198     public void setHostLogSuffix(String suffix);
199 
200     /** Whether or not to attempt parallel setup of the remote devices. */
shouldUseParallelRemoteSetup()201     public boolean shouldUseParallelRemoteSetup();
202 }
203