summaryrefslogtreecommitdiffstats
path: root/chrome/test/chromeos
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-28 02:12:56 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-28 02:12:56 +0000
commitbe8b30dcb93ba02315d6ca619876cab531f75cd8 (patch)
tree58a8154d639c8ddc463a00e115b58c4e8a18b1e1 /chrome/test/chromeos
parent2953a669ec0a32a25c6250d34bf895ec0eb63d27 (diff)
downloadchromium_src-be8b30dcb93ba02315d6ca619876cab531f75cd8.zip
chromium_src-be8b30dcb93ba02315d6ca619876cab531f75cd8.tar.gz
chromium_src-be8b30dcb93ba02315d6ca619876cab531f75cd8.tar.bz2
Add ability to pass arguments to browser_tests
Add the ability to pass arbitrary arguments to the browser_tests. This is needed for diagnosing and debugging the tests on a CrOS device/VM. To use, add pass_to_tests=argument to the --args parameter, so for example, to run the browser_tests in single process mode you would use, ./run_remote_tests.sh --use_emerged --remote localhost --ssh_port 9222 desktopui_BrowserTest.control.custom --args 'gtest_filter=TestSuite.Test pass_to_tests=single_process' The -- will automatically be added to the argument. Multiple pass_to_tests parameters can be specified in any order; all will be processed and the arguments added to the command line for the tests. R=zelidrag@chromium.org,stevenjb@chromium.org,nirnimesh@chromium.org BUG=None TEST=Tested the new pass_to_tests= argument and verified existing arguments still work correctly. Review URL: http://codereview.chromium.org/8992025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115860 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/chromeos')
-rw-r--r--chrome/test/chromeos/autotest/files/client/site_tests/desktopui_BrowserTest/desktopui_BrowserTest.py22
1 files changed, 18 insertions, 4 deletions
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 38df439..f9d7321 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
@@ -8,10 +8,19 @@ from blacklists import blacklist, blacklist_vm
SKIP_DEPS_ARG = 'skip_deps'
GDBSERVER_ARG = 'gdbserver'
GTEST_FILTER_ARG = 'gtest_filter='
+PASS_TO_TESTS_ARG = 'pass_to_tests='
GDBSERVER_SETUP_CMD = '/sbin/iptables -A INPUT -p tcp --dport 1234 -j ACCEPT'
GDBSERVER_STRING = 'gdbserver PORT:1234'
+def extract_named_args(name, arguments=[]):
+ # return a list of arguments with the named part removed
+ return [x[len(name):]
+ for x in arguments
+ # if the argument starts with the given name
+ if name == x[:len(name)]]
+
+
def get_binary_prefix(arguments=[]):
if GDBSERVER_ARG in arguments:
cros_ui.xsystem(GDBSERVER_SETUP_CMD, ignore_status=True)
@@ -37,9 +46,7 @@ class desktopui_BrowserTest(chrome_test.ChromeTestBase, cros_ui_test.UITest):
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]
+ tests_to_run = extract_named_args(GTEST_FILTER_ARG, arguments)
if not tests_to_run:
tests_to_run = self.filter_bad_tests(
self.generate_test_list(self.binary_to_run, group,
@@ -49,6 +56,13 @@ class desktopui_BrowserTest(chrome_test.ChromeTestBase, cros_ui_test.UITest):
def run_once(self, group=0, total_groups=1, arguments=[]):
tests_to_run = self.get_tests_to_run(group, total_groups, arguments)
+
+ test_args = '--gtest_filter=%s' % ':'.join(tests_to_run);
+ args_to_pass = ' --'.join(extract_named_args(PASS_TO_TESTS_ARG,
+ arguments));
+ if args_to_pass:
+ test_args += ' --' + args_to_pass
+
self.run_chrome_test(self.binary_to_run,
- '--gtest_filter=%s' % ':'.join(tests_to_run),
+ test_args,
prefix=get_binary_prefix(arguments))