aboutsummaryrefslogtreecommitdiff
path: root/crosperf/autotest_runner.py
blob: 80fb2a240a1dc16864d3589bac17d6aa9c483db9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/python
#
# Copyright 2011 Google Inc. All Rights Reserved.

from utils import command_executer


class AutotestRunner(object):
  """ This defines the interface from crosperf to ./run_remote_tests.sh.
  """
  def __init__(self, logger_to_use=None):
    self._logger = logger_to_use
    self._ce = command_executer.GetCommandExecuter(self._logger)
    self._ct = command_executer.CommandTerminator()

  def Run(self, machine_name, chromeos_root, board, autotest_name,
          autotest_args):
    options = ""
    if board:
      options += " --board=%s" % board
    if autotest_args:
      options += " %s" % autotest_args
    command = ("./run_remote_tests.sh --remote=%s %s %s" %
               (machine_name, options, autotest_name))
    return self._ce.ChrootRunCommand(chromeos_root, command, True, self._ct)

  def Terminate(self):
    self._ct.Terminate()


class MockAutotestRunner(object):
  def __init__(self):
    pass

  def Run(self, *args):
    return ["", "", 0]