• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import os
6
7from autotest_lib.server import test
8from autotest_lib.server.cros import goofy_client
9
10
11class factory_Basic(test.test):
12    """Basic factory wrapper."""
13    version = 1
14    REMOTE_TEST_LIST_DIR = '/usr/local/factory/test_lists'
15
16    def initialize(self, host, test_list_path, test_list_name):
17        """Initialize a goofy proxy and copy over the test lists.
18
19        @param host: The host to run this test on.
20        @param test_list_path: The local path of the test_list to copy
21                               over to the DUT.
22        @param test_list_name: The name of the test list.
23        """
24        self._goofy_client = goofy_client.GoofyProxy(host)
25        if test_list_path:
26            host.send_file(test_list_path,
27                           os.path.join(self.REMOTE_TEST_LIST_DIR,
28                                        'test_list.%s' % test_list_name))
29
30            # For goofy to load any new tests lists we need a factory restart.
31            host.run('factory_restart -a')
32
33
34    def run_once(self, host, test_list_name):
35        """Wait on all the tests in a test_list to finish.
36
37        @param test_list_name: The name of the tests list to wait on.
38        """
39        self._goofy_client.monitor_tests(test_list_name)
40        self._goofy_client.get_results(self.resultsdir)
41