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