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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/bin/site_chrome_test.py
diff --git a/client/bin/site_chrome_test.py b/client/bin/site_chrome_test.py
new file mode 100644
index 0000000000000000000000000000000000000000..4c84d698b95e9ced37ea97c02d4a4d6082c79a5e
--- /dev/null
+++ b/client/bin/site_chrome_test.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import logging, os, shutil, tempfile, utils
+from autotest_lib.client.bin import test
+from autotest_lib.client.common_lib import error, site_ui
+
+class ChromeTestBase(test.test):
+ home_dir = None
+
+ def setup(self):
+ self.job.setup_dep(['chrome_test'])
+ # create a empty srcdir to prevent the error that checks .version file
+ if not os.path.exists(self.srcdir):
+ os.mkdir(self.srcdir)
+
+
+ def run_chrome_test(self, test_to_run, extra_params = ''):
+ dep = 'chrome_test'
+ dep_dir = os.path.join(self.autodir, 'deps', dep)
+ self.job.install_pkg(dep, 'dep', dep_dir)
+
+ chrome_dir = '/opt/google/chrome'
+ cr_source_dir = '%s/test_src' % dep_dir
+ test_binary_dir = '%s/test_src/out/Release' % dep_dir
+ self.home_dir = tempfile.mkdtemp()
+
+ try:
+ setup_cmd = '%s/%s' % (test_binary_dir,
+ 'setup_test_links.sh')
+ utils.system(setup_cmd)
+
+ cmd = '%s/%s %s' % (test_binary_dir, test_to_run, extra_params)
+ cmd = 'HOME=%s CR_SOURCE_ROOT=%s %s' % (self.home_dir,
+ cr_source_dir,
+ site_ui.xcommand(cmd))
+ logging.info("Running %s" % cmd)
+ utils.system(cmd)
+ except error.CmdError, e:
+ logging.debug(e)
+ raise error.TestFail('%s failed!' % test_to_run)
+
+
+ def cleanup(self):
+ if self.home_dir:
+ shutil.rmtree(self.home_dir, ignore_errors=True)
+ test.test.cleanup(self)
« 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