Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 1 | #!/usr/bin/python |
Ahmad Sharif | fd356fb | 2012-05-07 12:02:16 -0700 | [diff] [blame^] | 2 | # |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 3 | # Copyright 2011 Google Inc. All Rights Reserved. |
| 4 | |
| 5 | from utils import command_executer |
Ahmad Sharif | 0dcbc4b | 2012-02-02 16:37:18 -0800 | [diff] [blame] | 6 | |
| 7 | |
| 8 | class AutotestRunner(object): |
| 9 | def __init__(self, logger_to_use=None): |
| 10 | self._logger = logger_to_use |
| 11 | self._ce = command_executer.GetCommandExecuter(self._logger) |
| 12 | self._ct = command_executer.CommandTerminator() |
| 13 | |
| 14 | def Run(self, machine_name, chromeos_root, board, autotest_name, |
| 15 | autotest_args, profile_counters, profile_type): |
| 16 | if profile_counters and profile_type: |
| 17 | profiler_args = "-e " + " -e ".join(profile_counters) |
| 18 | # TODO(asharif): Add an option to do -g. |
| 19 | autotest_args += (" --profile --profiler_args='%s' --profile_type='%s'" |
| 20 | % (profiler_args, profile_type)) |
| 21 | options = "" |
| 22 | if board: |
| 23 | options += " --board=%s" % board |
| 24 | if autotest_args: |
| 25 | options += " %s" % autotest_args |
| 26 | command = ("./run_remote_tests.sh --remote=%s %s %s" % |
| 27 | (machine_name, options, autotest_name)) |
| 28 | return self._ce.ChrootRunCommand(chromeos_root, command, True, self._ct) |
| 29 | |
| 30 | def Terminate(self): |
| 31 | self._ct.Terminate() |
| 32 | |
| 33 | |
| 34 | class MockAutotestRunner(object): |
| 35 | def __init__(self): |
| 36 | pass |
| 37 | |
| 38 | def Run(self, *args): |
| 39 | return ["", "", 0] |