1# Copyright 2018, The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15"""
16Example test runner class.
17"""
18
19# pylint: disable=import-error
20import test_runner_base
21
22
23class ExampleTestRunner(test_runner_base.TestRunnerBase):
24    """Base Test Runner class."""
25    NAME = 'ExampleTestRunner'
26    EXECUTABLE = 'echo'
27    _RUN_CMD = '{exe} ExampleTestRunner - test:{test}'
28    _BUILD_REQ = set()
29
30    def run_tests(self, test_infos, extra_args):
31        """Run the list of test_infos.
32
33        Args:
34            test_infos: List of TestInfo.
35            extra_args: Dict of extra args to add to test run.
36        """
37        for test_info in test_infos:
38            run_cmd_dict = {'exe': self.EXECUTABLE,
39                            'test': test_info.test_name}
40            run_cmd = self._RUN_CMD.format(**run_cmd_dict)
41            super(ExampleTestRunner, self).run(run_cmd)
42
43    def host_env_check(self):
44        """Check that host env has everything we need.
45
46        We actually can assume the host env is fine because we have the same
47        requirements that atest has. Update this to check for android env vars
48        if that changes.
49        """
50        pass
51
52    def get_test_runner_build_reqs(self):
53        """Return the build requirements.
54
55        Returns:
56            Set of build targets.
57        """
58        return set()
59