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_SPECIFIC_FILTER = [] |
kkania
2013/03/25 20:45:10
the other two are called negative, which made me t
chrisgao (Use stgao instead)
2013/03/25 20:50:21
Done.
| |
30 'UploadTest#testFileUploading', | 30 if util.IsLinux(): |
31 'AlertsTest'] | 31 _DESKTOP_OS_SPECIFIC_FILTER = [ |
32 'TypingTest#testArrowKeysAndPageUpAndDown', | |
33 'TypingTest#testHomeAndEndAndPageUpAndPageDownKeys', | |
34 'TypingTest#testNumberpadKeys', | |
35 ] | |
36 | |
37 _DESKTOP_NEGATIVE_FILTER = {} | |
38 _DESKTOP_NEGATIVE_FILTER['HEAD'] = ( | |
39 _DESKTOP_OS_SPECIFIC_FILTER + [ | |
40 'ExecutingAsyncJavascriptTest#shouldNotTimeoutIfScriptCallsbackInsideAZe roTimeout', | |
41 ] | |
42 ) | |
43 _DESKTOP_NEGATIVE_FILTER[CHROME_26_REVISION] = ( | |
44 _DESKTOP_NEGATIVE_FILTER['HEAD'] + [ | |
45 'UploadTest#testFileUploading', | |
46 'AlertsTest', | |
47 ] | |
48 ) | |
32 | 49 |
33 | 50 |
34 class TestResult(object): | 51 class TestResult(object): |
35 """A result for an attempted single test case.""" | 52 """A result for an attempted single test case.""" |
36 | 53 |
37 def __init__(self, name, time, failure): | 54 def __init__(self, name, time, failure): |
38 """Initializes a test result. | 55 """Initializes a test result. |
39 | 56 |
40 Args: | 57 Args: |
41 name: the full name of the test. | 58 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() | 254 options, args = parser.parse_args() |
238 | 255 |
239 if options.chromedriver is None or not os.path.exists(options.chromedriver): | 256 if options.chromedriver is None or not os.path.exists(options.chromedriver): |
240 parser.error('chromedriver is required or the given path is invalid.' + | 257 parser.error('chromedriver is required or the given path is invalid.' + |
241 'Please run "%s --help" for help' % __file__) | 258 'Please run "%s --help" for help' % __file__) |
242 | 259 |
243 # Run passed tests when filter is not provided. | 260 # Run passed tests when filter is not provided. |
244 test_filter = options.filter | 261 test_filter = options.filter |
245 if test_filter is None: | 262 if test_filter is None: |
246 passed_java_tests = [] | 263 passed_java_tests = [] |
264 failed_tests = _DESKTOP_NEGATIVE_FILTER[options.chrome_revision] | |
247 with open(os.path.join(_THIS_DIR, 'passed_java_tests.txt'), 'r') as f: | 265 with open(os.path.join(_THIS_DIR, 'passed_java_tests.txt'), 'r') as f: |
248 for line in f: | 266 for line in f: |
249 java_test = line.strip('\n') | 267 java_test = line.strip('\n') |
250 # Filter out failed tests for chrome 26. | 268 # Filter out failed tests. |
251 if options.chrome_revision == CHROME_26_REVISION: | 269 suite_name = java_test.split('#')[0] |
252 suite_name = java_test.split('#')[0] | 270 if java_test in failed_tests or suite_name in failed_tests: |
253 if (java_test in _FAILED_JAVA_TESTS_IN_CHROME_26 or | 271 continue |
254 suite_name in _FAILED_JAVA_TESTS_IN_CHROME_26): | |
255 continue | |
256 passed_java_tests.append(java_test) | 272 passed_java_tests.append(java_test) |
257 test_filter = ','.join(passed_java_tests) | 273 test_filter = ','.join(passed_java_tests) |
258 | 274 |
259 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test', | 275 java_tests_src_dir = os.path.join(chrome_paths.GetSrc(), 'chrome', 'test', |
260 'chromedriver', 'third_party', 'java_tests') | 276 'chromedriver', 'third_party', 'java_tests') |
261 if (not os.path.exists(java_tests_src_dir) or | 277 if (not os.path.exists(java_tests_src_dir) or |
262 not os.listdir(java_tests_src_dir)): | 278 not os.listdir(java_tests_src_dir)): |
263 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir + | 279 print ('"%s" is empty or it doesn\'t exist.' % java_tests_src_dir + |
264 'Should add "deps/third_party/webdriver" to source checkout config') | 280 'Should add "deps/third_party/webdriver" to source checkout config') |
265 return 1 | 281 return 1 |
266 | 282 |
267 return PrintTestResults(_Run( | 283 return PrintTestResults(_Run( |
268 java_tests_src_dir=java_tests_src_dir, | 284 java_tests_src_dir=java_tests_src_dir, |
269 test_filter=test_filter, | 285 test_filter=test_filter, |
270 chromedriver_path=options.chromedriver, | 286 chromedriver_path=options.chromedriver, |
271 chrome_path=options.chrome, | 287 chrome_path=options.chrome, |
272 android_package=options.android_package)) | 288 android_package=options.android_package)) |
273 | 289 |
274 | 290 |
275 if __name__ == '__main__': | 291 if __name__ == '__main__': |
276 sys.exit(main()) | 292 sys.exit(main()) |
OLD | NEW |