OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Runs the WebDriver Java acceptance tests. | 6 """Runs the WebDriver Java acceptance tests. |
7 | 7 |
8 This script is called from chrome/test/chromedriver/run_all_tests.py and reports | 8 This script is called from chrome/test/chromedriver/run_all_tests.py and reports |
9 results using the buildbot annotation scheme. | 9 results using the buildbot annotation scheme. |
10 | 10 |
11 For ChromeDriver documentation, refer to http://code.google.com/p/chromedriver. | 11 For ChromeDriver documentation, refer to http://code.google.com/p/chromedriver. |
12 """ | 12 """ |
13 | 13 |
14 import optparse | 14 import optparse |
15 import os | 15 import os |
16 import shutil | 16 import shutil |
17 import sys | 17 import sys |
18 import xml.dom.minidom as minidom | 18 import xml.dom.minidom as minidom |
19 | 19 |
20 sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, 'pylib')) | 20 sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, 'pylib')) |
21 | 21 |
22 from common import chrome_paths | 22 from common import chrome_paths |
23 from common import util | 23 from common import util |
24 from continuous_archive import CHROME_26_REVISION | 24 from continuous_archive import CHROME_26_REVISION |
25 | 25 |
26 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 26 _THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
27 | 27 |
28 | 28 |
29 _FAILED_JAVA_TESTS_IN_CHROME_26 = [ | 29 _DESKTOP_OS_NEGATIVE_FILTER = [] |
30 'UploadTest#testFileUploading', | 30 if util.IsLinux(): |
31 'AlertsTest'] | 31 _DESKTOP_OS_NEGATIVE_FILTER = [ |
| 32 'TypingTest#testArrowKeysAndPageUpAndDown', |
| 33 'TypingTest#testHomeAndEndAndPageUpAndPageDownKeys', |
| 34 'TypingTest#testNumberpadKeys', |
| 35 ] |
| 36 |
| 37 _DESKTOP_NEGATIVE_FILTER = {} |
| 38 _DESKTOP_NEGATIVE_FILTER['HEAD'] = ( |
| 39 _DESKTOP_OS_NEGATIVE_FILTER + [ |
| 40 'ExecutingAsyncJavascriptTest#' |
| 41 'shouldNotTimeoutIfScriptCallsbackInsideAZeroTimeout', |
| 42 ] |
| 43 ) |
| 44 _DESKTOP_NEGATIVE_FILTER[CHROME_26_REVISION] = ( |
| 45 _DESKTOP_NEGATIVE_FILTER['HEAD'] + [ |
| 46 'UploadTest#testFileUploading', |
| 47 'AlertsTest', |
| 48 ] |
| 49 ) |
32 | 50 |
33 | 51 |
34 class TestResult(object): | 52 class TestResult(object): |
35 """A result for an attempted single test case.""" | 53 """A result for an attempted single test case.""" |
36 | 54 |
37 def __init__(self, name, time, failure): | 55 def __init__(self, name, time, failure): |
38 """Initializes a test result. | 56 """Initializes a test result. |
39 | 57 |
40 Args: | 58 Args: |
41 name: the full name of the test. | 59 name: the full name of the test. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 options, args = parser.parse_args() | 255 options, args = parser.parse_args() |
238 | 256 |
239 if options.chromedriver is None or not os.path.exists(options.chromedriver): | 257 if options.chromedriver is None or not os.path.exists(options.chromedriver): |
240 parser.error('chromedriver is required or the given path is invalid.' + | 258 parser.error('chromedriver is required or the given path is invalid.' + |
241 'Please run "%s --help" for help' % __file__) | 259 'Please run "%s --help" for help' % __file__) |
242 | 260 |
243 # Run passed tests when filter is not provided. | 261 # Run passed tests when filter is not provided. |
244 test_filter = options.filter | 262 test_filter = options.filter |
245 if test_filter is None: | 263 if test_filter is None: |
246 passed_java_tests = [] | 264 passed_java_tests = [] |
| 265 failed_tests = _DESKTOP_NEGATIVE_FILTER[options.chrome_revision] |
247 with open(os.path.join(_THIS_DIR, 'passed_java_tests.txt'), 'r') as f: | 266 with open(os.path.join(_THIS_DIR, 'passed_java_tests.txt'), 'r') as f: |
248 for line in f: | 267 for line in f: |
249 java_test = line.strip('\n') | 268 java_test = line.strip('\n') |
250 # Filter out failed tests for chrome 26. | 269 # Filter out failed tests. |
251 if options.chrome_revision == CHROME_26_REVISION: | 270 suite_name = java_test.split('#')[0] |
252 suite_name = java_test.split('#')[0] | 271 if java_test in failed_tests or suite_name in failed_tests: |
253 if (java_test in _FAILED_JAVA_TESTS_IN_CHROME_26 or | 272 continue |
254 suite_name in _FAILED_JAVA_TESTS_IN_CHROME_26): | |
255 continue | |
256 passed_java_tests.append(java_test) | 273 passed_java_tests.append(java_test) |
257 test_filter = ','.join(passed_java_tests) | 274 test_filter = ','.join(passed_java_tests) |
258 | 275 |
259 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test', | 276 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test', |
260 'chromedriver', 'third_party', 'java_tests') | 277 'chromedriver', 'third_party', 'java_tests') |
261 if (not os.path.exists(java_tests_src_dir) or | 278 if (not os.path.exists(java_tests_src_dir) or |
262 not os.listdir(java_tests_src_dir)): | 279 not os.listdir(java_tests_src_dir)): |
263 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir + | 280 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir + |
264 'Should add "deps/third_party/webdriver" to source checkout config') | 281 'Should add "deps/third_party/webdriver" to source checkout config') |
265 return 1 | 282 return 1 |
266 | 283 |
267 return PrintTestResults(_Run( | 284 return PrintTestResults(_Run( |
268 java_tests_src_dir=java_tests_src_dir, | 285 java_tests_src_dir=java_tests_src_dir, |
269 test_filter=test_filter, | 286 test_filter=test_filter, |
270 chromedriver_path=options.chromedriver, | 287 chromedriver_path=options.chromedriver, |
271 chrome_path=options.chrome, | 288 chrome_path=options.chrome, |
272 android_package=options.android_package)) | 289 android_package=options.android_package)) |
273 | 290 |
274 | 291 |
275 if __name__ == '__main__': | 292 if __name__ == '__main__': |
276 sys.exit(main()) | 293 sys.exit(main()) |
OLD | NEW |