| OLD | NEW |
| 1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
| 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 """Encapsulates running tests defined in tests.py. | 6 """Encapsulates running tests defined in tests.py. |
| 7 | 7 |
| 8 Running this script requires passing --config-path with a path to a config file | 8 Running this script requires passing --config-path with a path to a config file |
| 9 of the following structure: | 9 of the following structure: |
| 10 | 10 |
| 11 [data_files] | 11 [data_files] |
| 12 passwords_path=<path to a file with passwords> | 12 passwords_path=<path to a file with passwords> |
| 13 [binaries] | 13 [binaries] |
| 14 chrome-path=<chrome binary path> | 14 chrome-path=<chrome binary path> |
| 15 chromedriver-path=<chrome driver path> | 15 chromedriver-path=<chrome driver path> |
| 16 [run_options] | 16 [run_options] |
| 17 # |tests_in_parallel| is optional, the default value is 1. | 17 # |tests_in_parallel| is optional, the default value is 1. |
| 18 tests_in_parallel=<number of parallel tests> | 18 tests_in_parallel=<number of parallel tests> |
| 19 # |tests_to_runs| field is optional, if it is absent all tests will be run. | 19 # |tests_to_runs| field is optional, if it is absent all tests will be run. |
| 20 tests_to_run=<test names to run, comma delimited> | 20 tests_to_run=<test names to run, comma delimited> |
| 21 |
| 22 The script uses the Python's logging library to report the test results, |
| 23 as well as debugging information. It emits three levels of logs (in |
| 24 descending order of severity): |
| 25 logging.INFO: Summary of the tests. |
| 26 logging.DEBUG: Details about tests failures. |
| 27 SCRIPT_DEBUG (see below): Debug info of this script. |
| 28 You have to set up appropriate logging handlers to have the logs appear. |
| 21 """ | 29 """ |
| 22 import argparse | 30 import argparse |
| 23 import ConfigParser | 31 import ConfigParser |
| 24 import logging | 32 import logging |
| 25 import os | 33 import os |
| 26 import shutil | 34 import shutil |
| 27 import subprocess | 35 import subprocess |
| 28 import tempfile | 36 import tempfile |
| 29 import time | 37 import time |
| 30 | 38 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 def main(): | 227 def main(): |
| 220 parser = argparse.ArgumentParser() | 228 parser = argparse.ArgumentParser() |
| 221 parser.add_argument("config_path", metavar="N", | 229 parser.add_argument("config_path", metavar="N", |
| 222 help="Path to the config.ini file.") | 230 help="Path to the config.ini file.") |
| 223 args = parser.parse_args() | 231 args = parser.parse_args() |
| 224 run_tests(args.config_path) | 232 run_tests(args.config_path) |
| 225 | 233 |
| 226 | 234 |
| 227 if __name__ == "__main__": | 235 if __name__ == "__main__": |
| 228 main() | 236 main() |
| OLD | NEW |