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.util.UniqueMultiMap;
20 
21 /**
22  *  Container for execution options for commands.
23  */
24 public interface ICommandOptions {
25 
26     /**
27      * Returns <code>true</code> if abbreviated help mode has been requested
28      */
isHelpMode()29     public boolean isHelpMode();
30 
31     /**
32      * Returns <code>true</code> if full detailed help mode has been requested
33      */
isFullHelpMode()34     public boolean isFullHelpMode();
35 
36     /**
37      * Returns <code>true</code> if full json help mode has been requested
38      */
isJsonHelpMode()39     public boolean isJsonHelpMode();
40 
41     /**
42      * Return <code>true</code> if we should <emph>skip</emph> adding this command to the queue.
43      */
isDryRunMode()44     public boolean isDryRunMode();
45 
46     /**
47      * Return <code>true</code> if we should print the command out to the console before we
48      * <emph>skip</emph> adding it to the queue.
49      */
isNoisyDryRunMode()50     public boolean isNoisyDryRunMode();
51 
52     /**
53      * Return the loop mode for the config.
54      */
isLoopMode()55     public boolean isLoopMode();
56 
57     /**
58      * Get the min loop time for the config.
59      *
60      * @deprecated use {@link #getLoopTime()} instead
61      */
62     @Deprecated
getMinLoopTime()63     public long getMinLoopTime();
64 
65     /**
66      * Get the time to wait before re-scheduling this command.
67      * @return time in ms
68      */
getLoopTime()69     public long getLoopTime();
70 
71     /**
72      * Sets the loop mode for the command
73      *
74      * @param loopMode
75      */
setLoopMode(boolean loopMode)76     public void setLoopMode(boolean loopMode);
77 
78     /**
79      * Return the test-tag for the invocation. Default is 'stub' if unspecified.
80      */
getTestTag()81     public String getTestTag();
82 
83     /**
84      * Sets the test-tag for the invocation.
85      *
86      * @param testTag
87      */
setTestTag(String testTag)88     public void setTestTag(String testTag);
89 
90     /**
91      * Return the test-tag suffix, appended to test-tag to represents some variants of one test.
92      */
getTestTagSuffix()93     public String getTestTagSuffix();
94 
95     /**
96      * Creates a copy of the {@link ICommandOptions} object.
97      */
clone()98     public ICommandOptions clone();
99 
100     /**
101      * Return true if command should run on all devices.
102      */
runOnAllDevices()103     public boolean runOnAllDevices();
104 
105     /**
106      * Return true if a bugreport should be taken when the test invocation has ended.
107      */
takeBugreportOnInvocationEnded()108     public boolean takeBugreportOnInvocationEnded();
109 
110     /** Sets whether or not to capture a bugreport at the end of the invocation. */
setBugreportOnInvocationEnded(boolean takeBugreport)111     public void setBugreportOnInvocationEnded(boolean takeBugreport);
112 
113     /**
114      * Return true if a bugreportz should be taken instead of bugreport during the test invocation
115      * final bugreport.
116      */
takeBugreportzOnInvocationEnded()117     public boolean takeBugreportzOnInvocationEnded();
118 
119     /** Sets whether or not to capture a bugreportz at the end of the invocation. */
setBugreportzOnInvocationEnded(boolean takeBugreportz)120     public void setBugreportzOnInvocationEnded(boolean takeBugreportz);
121 
122     /**
123      * Return the invocation timeout specified. 0 if no timeout to be used.
124      */
getInvocationTimeout()125     public long getInvocationTimeout();
126 
127     /**
128      * Set the invocation timeout. 0 if no timeout to be used.
129      */
setInvocationTimeout(Long mInvocationTimeout)130     public void setInvocationTimeout(Long mInvocationTimeout);
131 
132     /**
133      * Return the total shard count for the command.
134      */
getShardCount()135     public Integer getShardCount();
136 
137     /**
138      * Sets the shard count for the command.
139      */
setShardCount(Integer shardCount)140     public void setShardCount(Integer shardCount);
141 
142     /**
143      * Return the shard index for the command.
144      */
getShardIndex()145     public Integer getShardIndex();
146 
147     /**
148      * Sets the shard index for the command.
149      */
setShardIndex(Integer shardIndex)150     public void setShardIndex(Integer shardIndex);
151 
152     /** Return true if the test should skip device setup during TestInvocation setup. */
shouldSkipPreDeviceSetup()153     public boolean shouldSkipPreDeviceSetup();
154 
155     /** Returns if we should use dynamic sharding or not */
shouldUseDynamicSharding()156     public boolean shouldUseDynamicSharding();
157 
158     /** Returns the data passed to the invocation to describe it */
getInvocationData()159     public UniqueMultiMap<String, String> getInvocationData();
160 
161     /** Returns true if we should use Tf new sharding logic */
shouldUseTfSharding()162     public boolean shouldUseTfSharding();
163 
164     /** Returns true if we should use Tf containers to run the invocation */
shouldUseSandboxing()165     public boolean shouldUseSandboxing();
166 
167     /** Sets whether or not we should use TF containers */
setShouldUseSandboxing(boolean use)168     public void setShouldUseSandboxing(boolean use);
169 }
170