Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: client/bin/site_chrome_test.py

Issue 3403006: Base test class for chrome tests (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: updates Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright (c) 2010 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
5 import logging, os, shutil, tempfile, utils
6 from autotest_lib.client.bin import test
7 from autotest_lib.client.common_lib import error, site_ui
8
9 class ChromeTestBase(test.test):
10 home_dir = None
11
12 def setup(self):
13 self.job.setup_dep(['chrome_test'])
14 # create a empty srcdir to prevent the error that checks .version file
15 if not os.path.exists(self.srcdir):
16 os.mkdir(self.srcdir)
17
18
19 def run_chrome_test(self, test_to_run, extra_params = ''):
20 dep = 'chrome_test'
21 dep_dir = os.path.join(self.autodir, 'deps', dep)
22 self.job.install_pkg(dep, 'dep', dep_dir)
23
24 chrome_dir = '/opt/google/chrome'
25 cr_source_dir = '%s/test_src' % dep_dir
26 test_binary_dir = '%s/test_src/out/Release' % dep_dir
27 self.home_dir = tempfile.mkdtemp()
28
29 try:
30 setup_cmd = '%s/%s' % (test_binary_dir,
31 'setup_test_links.sh')
32 utils.system(setup_cmd)
33
34 cmd = '%s/%s %s' % (test_binary_dir, test_to_run, extra_params)
35 cmd = 'HOME=%s CR_SOURCE_ROOT=%s %s' % (self.home_dir,
36 cr_source_dir,
37 site_ui.xcommand(cmd))
38 logging.info("Running %s" % cmd)
39 utils.system(cmd)
40 except error.CmdError, e:
41 logging.debug(e)
42 raise error.TestFail('%s failed!' % test_to_run)
43
44
45 def cleanup(self):
46 if self.home_dir:
47 shutil.rmtree(self.home_dir, ignore_errors=True)
48 test.test.cleanup(self)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698