blob: 3b91d81bf5426cc6ea2bdbb9005b0562b28507ea [file] [log] [blame]
Ahmad Sharif0dcbc4b2012-02-02 16:37:18 -08001#!/usr/bin/python
Ahmad Shariffd356fb2012-05-07 12:02:16 -07002#
Ahmad Sharif0dcbc4b2012-02-02 16:37:18 -08003# Copyright 2011 Google Inc. All Rights Reserved.
4
5from utils import command_executer
Ahmad Sharif0dcbc4b2012-02-02 16:37:18 -08006
7
8class 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
34class MockAutotestRunner(object):
35 def __init__(self):
36 pass
37
38 def Run(self, *args):
39 return ["", "", 0]