1 /* 2 * Copyright (C) 2015 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 package com.android.compatibility.common.tradefed.testtype; 17 18 import com.android.tradefed.config.ConfigurationDescriptor; 19 import com.android.tradefed.device.DeviceNotAvailableException; 20 import com.android.tradefed.invoker.IInvocationContext; 21 import com.android.tradefed.testtype.IAbi; 22 import com.android.tradefed.testtype.IBuildReceiver; 23 import com.android.tradefed.testtype.IDeviceTest; 24 import com.android.tradefed.testtype.IInvocationContextReceiver; 25 import com.android.tradefed.testtype.IRemoteTest; 26 import com.android.tradefed.testtype.IRuntimeHintProvider; 27 import com.android.tradefed.testtype.ITestCollector; 28 import com.android.tradefed.testtype.suite.ModuleDefinition; 29 30 import java.util.List; 31 import java.util.Set; 32 33 /** 34 * Container for Compatibility test info. 35 */ 36 public interface IModuleDef extends Comparable<IModuleDef>, IBuildReceiver, IDeviceTest, 37 IRemoteTest, IRuntimeHintProvider, ITestCollector, IInvocationContextReceiver { 38 39 /** key names used for saving module info into {@link IInvocationContext} */ 40 // This currently references ModuleDefinition so that there's only once source for String 41 // literals and making it easier to converge IModuleDef and ModuleDefinition later 42 public static String MODULE_NAME = ModuleDefinition.MODULE_NAME; 43 public static String MODULE_ABI = ModuleDefinition.MODULE_ABI; 44 public static String MODULE_ID = ModuleDefinition.MODULE_ID; 45 46 /** 47 * @return The name of this module. 48 */ getName()49 String getName(); 50 51 /** 52 * @return a {@link String} to uniquely identify this module. 53 */ getId()54 String getId(); 55 56 /** 57 * @return the abi of this test module. 58 */ getAbi()59 IAbi getAbi(); 60 61 /** 62 * @return the {@link Set} of tokens a device must have in order to run this module. 63 */ getTokens()64 Set<String> getTokens(); 65 66 /** 67 * @return the {@link IRemoteTest} that runs the tests. 68 */ getTest()69 IRemoteTest getTest(); 70 71 /** 72 * Set a list of preparers to allow to run before or after a test. 73 * If this list is empty, then all configured preparers will run. 74 * 75 * @param preparerWhitelist list containing the simple name of the preparer to run. 76 */ setPreparerWhitelist(Set<String> preparerWhitelist)77 void setPreparerWhitelist(Set<String> preparerWhitelist); 78 79 /** 80 * Pushes dynamic configuration, then runs the module's precondition checks and setup tasks. 81 * @param skipPrep whether preparation should be skipped 82 * @param preconditionArgs arguments to set on precondition preparers for the module, taking 83 * format arg-name:arg-value. If "arg-value" is unset, the value will default to "true". 84 * @return whether preparation succeeded. 85 */ prepare(boolean skipPrep, List<String> preconditionArgs)86 boolean prepare(boolean skipPrep, List<String> preconditionArgs) 87 throws DeviceNotAvailableException; 88 89 /** 90 * Retrieves the {@link ConfigurationDescriptor} associated with module config 91 */ getConfigurationDescriptor()92 ConfigurationDescriptor getConfigurationDescriptor(); 93 } 94