1# Copyright (c) 2014 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 logging 6import os 7 8from autotest_lib.client.bin import utils 9from autotest_lib.client.common_lib import error 10from autotest_lib.server import test, autotest 11 12 13class firmware_TouchMTBSetup(test.test): 14 version = 1 15 client_test_name = 'firmware_TouchMTB' 16 17 def _get_client_test_path(self): 18 test_rel_dir = os.path.join(os.path.dirname(__file__), 19 '..', '..', '..', 'client', 'site_tests', 20 self.client_test_name) 21 return os.path.realpath(test_rel_dir) 22 23 def run_once(self, host=None): 24 """Run the test.""" 25 # Run the client test for installing the test. 26 self.client_at = autotest.Autotest(host) 27 self.client_at.run_test(self.client_test_name) 28 29 # Copy the version info to the test machine. 30 version_script = os.path.join(self._get_client_test_path(), 31 'version.sh') 32 cmd = '%s -r %s' % (version_script, host.ip) 33 try: 34 utils.system(cmd) 35 except: 36 raise error.TestError('executing "%s"' % cmd) 37