| """Run the Android.mk host tests.""" |
| |
| from __future__ import absolute_import |
| import os |
| |
| from slave.step import shell_step |
| |
| |
| _TEST_PROJECT = 'test' |
| _RUN_HOST_TEST_SCRIPT = 'unit_test/run_host_tests.py' |
| |
| |
| class RunHostTestsStep(shell_step.ShellStep): |
| """Step to run the Android.mk host tests.""" |
| |
| def __init__(self, env=None, **kwargs): |
| del env # Unsused |
| shell_step.ShellStep.__init__(self, name='run host tests', **kwargs) |
| |
| def get_commands(self): |
| """Return commands to run the host tests. |
| |
| After building the `make test-build-target`, these tests |
| can be found in out/host/*/bin/* and include tests |
| such as usbtest and led_unittests. |
| |
| Returns: |
| List of ShellCommand objects to execute to run the host tests. |
| """ |
| test_project_dir = self.get_project_path(_TEST_PROJECT) |
| run_test_script = os.path.join(test_project_dir, _RUN_HOST_TEST_SCRIPT) |
| return [self.ShellCommand(['python3', run_test_script], |
| cwd=os.getcwd(), |
| env={'PYTHONPATH': test_project_dir})] |