Home | History | Annotate | Download | only in testtype
      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 
     45     /**
     46      * @return The name of this module.
     47      */
     48     String getName();
     49 
     50     /**
     51      * @return a {@link String} to uniquely identify this module.
     52      */
     53     String getId();
     54 
     55     /**
     56      * @return the abi of this test module.
     57      */
     58     IAbi getAbi();
     59 
     60     /**
     61      * @return the {@link Set} of tokens a device must have in order to run this module.
     62      */
     63     Set<String> getTokens();
     64 
     65     /**
     66      * @return the {@link IRemoteTest} that runs the tests.
     67      */
     68     IRemoteTest getTest();
     69 
     70     /**
     71      * Set a list of preparers to allow to run before or after a test.
     72      * If this list is empty, then all configured preparers will run.
     73      *
     74      * @param preparerWhitelist list containing the simple name of the preparer to run.
     75      */
     76     void setPreparerWhitelist(Set<String> preparerWhitelist);
     77 
     78     /**
     79      * Pushes dynamic configuration, then runs the module's precondition checks and setup tasks.
     80      * @param skipPrep whether preparation should be skipped
     81      * @param preconditionArgs arguments to set on precondition preparers for the module, taking
     82      * format arg-name:arg-value. If "arg-value" is unset, the value will default to "true".
     83      * @return whether preparation succeeded.
     84      */
     85     boolean prepare(boolean skipPrep, List<String> preconditionArgs)
     86             throws DeviceNotAvailableException;
     87 
     88     /**
     89      * Retrieves the {@link ConfigurationDescriptor} associated with module config
     90      */
     91     ConfigurationDescriptor getConfigurationDescriptor();
     92 }
     93