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.Map; 23 import java.util.Set; 24 25 /** 26 * Container for execution options for commands. 27 */ 28 public interface ICommandOptions { 29 30 /** 31 * Returns <code>true</code> if abbreviated help mode has been requested 32 */ isHelpMode()33 public boolean isHelpMode(); 34 35 /** 36 * Returns <code>true</code> if full detailed help mode has been requested 37 */ isFullHelpMode()38 public boolean isFullHelpMode(); 39 40 /** 41 * Return <code>true</code> if we should <emph>skip</emph> adding this command to the queue. 42 */ isDryRunMode()43 public boolean isDryRunMode(); 44 45 /** 46 * Return <code>true</code> if we should print the command out to the console before we 47 * <emph>skip</emph> adding it to the queue. 48 */ isNoisyDryRunMode()49 public boolean isNoisyDryRunMode(); 50 51 /** 52 * Return the loop mode for the config. 53 */ isLoopMode()54 public boolean isLoopMode(); 55 56 /** 57 * Get the time to wait before re-scheduling this command. 58 * @return time in ms 59 */ getLoopTime()60 public long getLoopTime(); 61 62 /** 63 * Sets the loop mode for the command 64 * 65 * @param loopMode 66 */ setLoopMode(boolean loopMode)67 public void setLoopMode(boolean loopMode); 68 69 /** 70 * Return the test-tag for the invocation. Default is 'stub' if unspecified. 71 */ getTestTag()72 public String getTestTag(); 73 74 /** 75 * Sets the test-tag for the invocation. 76 * 77 * @param testTag 78 */ setTestTag(String testTag)79 public void setTestTag(String testTag); 80 81 /** 82 * Return the test-tag suffix, appended to test-tag to represents some variants of one test. 83 */ getTestTagSuffix()84 public String getTestTagSuffix(); 85 86 /** 87 * Creates a copy of the {@link ICommandOptions} object. 88 */ clone()89 public ICommandOptions clone(); 90 91 /** 92 * Return true if command should run on all devices. 93 */ runOnAllDevices()94 public boolean runOnAllDevices(); 95 96 /** 97 * Return true if a bugreport should be taken when the test invocation has ended. 98 */ takeBugreportOnInvocationEnded()99 public boolean takeBugreportOnInvocationEnded(); 100 101 /** Sets whether or not to capture a bugreport at the end of the invocation. */ setBugreportOnInvocationEnded(boolean takeBugreport)102 public void setBugreportOnInvocationEnded(boolean takeBugreport); 103 104 /** 105 * Return true if a bugreportz should be taken instead of bugreport during the test invocation 106 * final bugreport. 107 */ takeBugreportzOnInvocationEnded()108 public boolean takeBugreportzOnInvocationEnded(); 109 110 /** Sets whether or not to capture a bugreportz at the end of the invocation. */ setBugreportzOnInvocationEnded(boolean takeBugreportz)111 public void setBugreportzOnInvocationEnded(boolean takeBugreportz); 112 113 /** 114 * Return the invocation timeout specified. 0 if no timeout to be used. 115 */ getInvocationTimeout()116 public long getInvocationTimeout(); 117 118 /** 119 * Set the invocation timeout. 0 if no timeout to be used. 120 */ setInvocationTimeout(Long mInvocationTimeout)121 public void setInvocationTimeout(Long mInvocationTimeout); 122 123 /** 124 * Return the total shard count for the command. 125 */ getShardCount()126 public Integer getShardCount(); 127 128 /** 129 * Sets the shard count for the command. 130 */ setShardCount(Integer shardCount)131 public void setShardCount(Integer shardCount); 132 133 /** 134 * Return the shard index for the command. 135 */ getShardIndex()136 public Integer getShardIndex(); 137 138 /** 139 * Sets the shard index for the command. 140 */ setShardIndex(Integer shardIndex)141 public void setShardIndex(Integer shardIndex); 142 143 /** Whether or not sharding should use the token support. */ shouldUseTokenSharding()144 public boolean shouldUseTokenSharding(); 145 146 /** Returns if we should use dynamic sharding or not */ shouldUseDynamicSharding()147 public boolean shouldUseDynamicSharding(); 148 149 /** Returns the data passed to the invocation to describe it */ getInvocationData()150 public UniqueMultiMap<String, String> getInvocationData(); 151 152 /** Returns true if we should use Tf containers to run the invocation */ shouldUseSandboxing()153 public boolean shouldUseSandboxing(); 154 155 /** Sets whether or not we should use TF containers */ setShouldUseSandboxing(boolean use)156 public void setShouldUseSandboxing(boolean use); 157 158 /** Returns true if we should use the Tf sandbox in a test mode. */ shouldUseSandboxTestMode()159 public boolean shouldUseSandboxTestMode(); 160 161 /** Sets whether or not we should use the TF sandbox test mode. */ setUseSandboxTestMode(boolean use)162 public void setUseSandboxTestMode(boolean use); 163 164 /** Whether or not to use sandbox mode in remote invocation. */ shouldUseRemoteSandboxMode()165 public boolean shouldUseRemoteSandboxMode(); 166 167 /** Returns the set of auto log collectors to be added for an invocation */ getAutoLogCollectors()168 public Set<AutoLogCollector> getAutoLogCollectors(); 169 170 /** Sets the set of auto log collectors that should be added to an invocation. */ setAutoLogCollectors(Set<AutoLogCollector> autoLogCollectors)171 public void setAutoLogCollectors(Set<AutoLogCollector> autoLogCollectors); 172 173 /** Whether or not to capture a screenshot on test case failure */ captureScreenshotOnFailure()174 public boolean captureScreenshotOnFailure(); 175 176 /** Whether or not to capture a logcat on test case failure */ captureLogcatOnFailure()177 public boolean captureLogcatOnFailure(); 178 179 /** Returns the suffix to append to the Tradefed host_log or null if no prefix. */ getHostLogSuffix()180 public String getHostLogSuffix(); 181 182 /** Sets the suffix to append to Tradefed host_log. */ setHostLogSuffix(String suffix)183 public void setHostLogSuffix(String suffix); 184 185 /** Whether or not to attempt parallel setup of the remote devices. */ shouldUseParallelRemoteSetup()186 public boolean shouldUseParallelRemoteSetup(); 187 188 /** Whether or not to use replicated setup for all the remote devices. */ shouldUseReplicateSetup()189 public boolean shouldUseReplicateSetup(); 190 191 /** Set whether or not to use replicated setup. */ setReplicateSetup(boolean replicate)192 public void setReplicateSetup(boolean replicate); 193 194 /** Whether or not to report progression of remote invocation at module level. */ shouldReportModuleProgression()195 public boolean shouldReportModuleProgression(); 196 197 /** Whether or not to start extra instances in the remote VM in postsubmit. */ getExtraRemotePostsubmitInstance()198 public int getExtraRemotePostsubmitInstance(); 199 200 /** Whether or not to release the device early when done with it. */ earlyDeviceRelease()201 public boolean earlyDeviceRelease(); 202 203 /** Returns the map of args to pass to the dynamic download query. */ getDynamicDownloadArgs()204 public Map<String, String> getDynamicDownloadArgs(); 205 } 206