diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-23 08:11:51 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-23 08:11:51 +0000 |
commit | 8aacbd914faee00e4cccea2d640c87b37cc09e3a (patch) | |
tree | 5f16b826cc253ef298f475cd6a42952a5457f63e /chrome/test/chromeos/autotest | |
parent | 201861b11b9c36bdf5b6f9691d7b9621def5a4ea (diff) | |
download | chromium_src-8aacbd914faee00e4cccea2d640c87b37cc09e3a.zip chromium_src-8aacbd914faee00e4cccea2d640c87b37cc09e3a.tar.gz chromium_src-8aacbd914faee00e4cccea2d640c87b37cc09e3a.tar.bz2 |
Changes to help debug browser_tests.
Added three optional arguments to be used with the new custom control file for the browser tests. The control.custom file has detailed usage of the arguments.
Sample commands to use the parameters,
gtest_filter:
./run_remote_tests.sh --remote host --use_emerged desktopui_BrowserTest.control.custom$ --args 'gtest_filter=PanelBrowserTest.AutoResize gtest_filter=PrintPreviewWebUITest.TestColorSettings:PrintPreviewWebUITest.TestPrinterChangeUpdatesPreview'
This will run only the three specified tests and none else.
gtest_filter works like the --gtest_filter parameter in the regular Chrome browser_tests, plus it can be specified multiple times to specify additional tests
skip_deps:
./run_remote_tests.sh --remote host --use_emerged desktopui_BrowserTest.control.custom$ --args 'skip_deps gtest_filter=PrintPreviewWebUITest.TestColorSettings'
This will run only the one specified test and will not copy over the chrome_test or pyauto dependencies. This is a total of over 550mb of data.
Keep in mind that you need to run run_remote_tests.sh once WITHOUT skip_deps to make sure the deps do initially get on the target device, otherwise your tests will all just fail.
gdbserver:
./run_remote_tests.sh --remote host --use_emerged desktopui_BrowserTest.control.custom$ --args 'skip_deps gtest_filter=PrintPreviewWebUITest.TestColorSettings gdbserver'
This will essentially not copy over the deps, run only the one test, but it will run the test under gdbserver, so your test will pause. Use this option *only* if you are debugging, otherwise you'll have to manually log on and kill the gdbserver instance.
The gdbserver instance will always be created on port 1234. Incoming connections will automatically be opened on the device for that port before gdbserver is started.
Use target remote host:1234 in a gdb instance to connect to the paused test.
The order of any of the arguments is irrelevant.
R=zelidrag@chromium.org,nirnimesh@chromium.org,sosa@chromium.org
BUG=chromium-os:20705
TEST=Tested locally with http://gerrit.chromium.org/gerrit/8130
Review URL: http://codereview.chromium.org/7994011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos/autotest')
2 files changed, 72 insertions, 9 deletions
diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/control.custom b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/control.custom new file mode 100644 index 0000000..c3e8b17 --- /dev/null +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/control.custom @@ -0,0 +1,35 @@ +# Copyright (c) 2010 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# This is a custom control file for the browser tests used specifically to +# help debug tests. +# Arguments added with this control file, +# (passed through run_remote_tests.sh via the --args '' option) +# skip_deps - Specify this argument so autotest does 'NOT' re-copy the +# chrome test dependencies. This can be a several hundred +# megabyte copy operation. +# +# gtest_filter= - Specify this option to run only the tests specified by the +# test filter. +# +# gdbserver - Specify this option to run the tests under gdbserver. The +# gdb server will be run on port 1234. + +AUTHOR = "Chrome OS Team" +NAME = "desktopui_BrowserTest" +PURPOSE = "Verify basic browsing capability of Chrome." +CRITERIA = """ +This test will fail if any of the commands chrome executes returns an error. +""" +TIME = "LONG" +TEST_CATEGORY = "Functional" +TEST_CLASS = "desktopui" +TEST_TYPE = "client" + +DOC = """ +This is a wrapper test for Chrome browser_test. +""" + +job.run_test('desktopui_BrowserTest', arguments=args) + diff --git a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/desktopui_BrowserTest.py b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/desktopui_BrowserTest.py index 9e3c51d..38df439 100644 --- a/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/desktopui_BrowserTest.py +++ b/chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/desktopui_BrowserTest.py @@ -2,25 +2,53 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -from autotest_lib.client.cros import chrome_test -from autotest_lib.client.cros import cros_ui_test +from autotest_lib.client.cros import chrome_test, cros_ui, cros_ui_test from blacklists import blacklist, blacklist_vm +SKIP_DEPS_ARG = 'skip_deps' +GDBSERVER_ARG = 'gdbserver' +GTEST_FILTER_ARG = 'gtest_filter=' + +GDBSERVER_SETUP_CMD = '/sbin/iptables -A INPUT -p tcp --dport 1234 -j ACCEPT' +GDBSERVER_STRING = 'gdbserver PORT:1234' + +def get_binary_prefix(arguments=[]): + if GDBSERVER_ARG in arguments: + cros_ui.xsystem(GDBSERVER_SETUP_CMD, ignore_status=True) + return GDBSERVER_STRING + ' ' + return '' + + class desktopui_BrowserTest(chrome_test.ChromeTestBase, cros_ui_test.UITest): version = 1 binary_to_run='browser_tests' - def initialize(self, creds='$default'): - chrome_test.ChromeTestBase.initialize(self, False) + def initialize(self, creds='$default', arguments=[]): + if SKIP_DEPS_ARG in arguments: + skip_deps = True + else: + skip_deps = False + chrome_test.ChromeTestBase.initialize(self, False, skip_deps=skip_deps) cros_ui_test.UITest.initialize(self, creds) def cleanup(self): cros_ui_test.UITest.cleanup(self) chrome_test.ChromeTestBase.cleanup(self) - def run_once(self, group=0, total_groups=4): - tests_to_run = self.filter_bad_tests( - self.generate_test_list(self.binary_to_run, group, total_groups), - blacklist + blacklist_vm) + def get_tests_to_run(self, group=0, total_groups=1, arguments=[]): + # Tests specified in arguments override default test behavior + tests_to_run = [x[len(GTEST_FILTER_ARG):] + for x in arguments + if GTEST_FILTER_ARG in x] + if not tests_to_run: + tests_to_run = self.filter_bad_tests( + self.generate_test_list(self.binary_to_run, group, + total_groups), + blacklist + blacklist_vm) + return tests_to_run + + def run_once(self, group=0, total_groups=1, arguments=[]): + tests_to_run = self.get_tests_to_run(group, total_groups, arguments) self.run_chrome_test(self.binary_to_run, - '--gtest_filter=%s' % ':'.join(tests_to_run)) + '--gtest_filter=%s' % ':'.join(tests_to_run), + prefix=get_binary_prefix(arguments)) |