Home | History | Annotate | Download | only in testtype
      1 /*
      2  * Copyright (C) 2017 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.OptionCopier;
     19 import com.android.tradefed.result.TestDescription;
     20 import com.android.tradefed.testtype.IRemoteTest;
     21 import com.android.tradefed.testtype.IStrictShardableTest;
     22 
     23 import java.util.ArrayList;
     24 
     25 /**
     26  * A test Stub that can be used to fake some runs.
     27  */
     28 public class TestStubShardable extends TestStub implements IStrictShardableTest {
     29 
     30     @Override
     31     public IRemoteTest getTestShard(int shardCount, int shardIndex) {
     32         TestStubShardable test = new TestStubShardable();
     33         OptionCopier.copyOptionsNoThrow(this, test);
     34         test.mShardedTestToRun = new ArrayList<>();
     35         TestDescription tid = new TestDescription("TestStub", "test" + shardIndex);
     36         test.mShardedTestToRun.add(tid);
     37         if (mIsComplete == false) {
     38             TestDescription tid2 = new TestDescription("TestStub", "test" + shardIndex + 100);
     39             test.mShardedTestToRun.add(tid2);
     40             test.mIsComplete = false;
     41         }
     42         test.mShardIndex = shardIndex;
     43         return test;
     44     }
     45 }
     46