OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 DomDistillers jstests. | 6 """Runs DomDistillers jstests. |
7 | 7 |
8 This uses ChromeDriver (https://sites.google.com/a/chromium.org/chromedriver/) t
o run the jstests. | 8 This uses ChromeDriver (https://sites.google.com/a/chromium.org/chromedriver/) t
o run the jstests. |
9 This requires that the ChromeDriver executable is on the PATH and that Selenium
WebDriver is | 9 This requires that the ChromeDriver executable is on the PATH and that Selenium
WebDriver is |
10 installed. | 10 installed. |
11 | 11 |
12 In addition, ChromeDriver assumes that Chrome is available at /usr/bin/google-ch
rome. | 12 In addition, ChromeDriver assumes that Chrome is available at /usr/bin/google-ch
rome. |
13 """ | 13 """ |
14 | 14 |
15 import argparse | 15 import argparse |
16 import os | 16 import os |
17 import sys | 17 import sys |
18 import time | 18 import time |
19 import urllib | 19 import urllib |
20 | 20 |
21 try: | 21 try: |
22 from selenium import webdriver | 22 from selenium import webdriver |
23 except: | 23 except: |
24 print 'ERROR:' | 24 print 'ERROR:' |
25 print 'Couldn\'t import webdriver. Please run `sudo ./install-build-deps.sh`.' | 25 print 'Couldn\'t import webdriver. Please run `sudo ./install-build-deps.sh`.' |
26 sys.exit(1) | 26 sys.exit(1) |
27 | 27 |
28 def main(argv): | 28 def main(argv): |
29 parser = argparse.ArgumentParser() | 29 parser = argparse.ArgumentParser() |
30 parser.add_argument('--filter', help='Only tests that match this pattern will
be run.') | 30 parser.add_argument('--filter', help='See gtest_filter syntax.') |
31 parser.add_argument('--debug_level', help='Verbosity level of debug messages.'
) | 31 parser.add_argument('--debug_level', help='Verbosity level of debug messages.'
) |
32 parser.add_argument('--no_console_log', | 32 parser.add_argument('--no_console_log', |
33 action='store_true', help='Disable the console log output.') | 33 action='store_true', help='Disable the console log output.') |
34 options = parser.parse_args(argv) | 34 options = parser.parse_args(argv) |
35 | 35 |
36 params = {} | 36 params = {} |
37 if options.filter: | 37 if options.filter: |
38 params['filter'] = options.filter | 38 params['filter'] = options.filter |
39 | 39 |
40 if options.debug_level: | 40 if options.debug_level: |
(...skipping 14 matching lines...) Expand all Loading... |
55 | 55 |
56 end = time.time() | 56 end = time.time() |
57 print result['log'].encode('utf-8') | 57 print result['log'].encode('utf-8') |
58 print 'Tests run: %d, Failures: %d, Skipped: %d, Time elapsed: %0.3f sec' % (r
esult['numTests'], | 58 print 'Tests run: %d, Failures: %d, Skipped: %d, Time elapsed: %0.3f sec' % (r
esult['numTests'], |
59 result['failed'], result['skipped'], end - start) | 59 result['failed'], result['skipped'], end - start) |
60 return 0 if result['success'] else 1 | 60 return 0 if result['success'] else 1 |
61 | 61 |
62 if __name__ == '__main__': | 62 if __name__ == '__main__': |
63 sys.exit(main(sys.argv[1:])) | 63 sys.exit(main(sys.argv[1:])) |
64 | 64 |
OLD | NEW |