Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: googletest/run_test_cases.py

Issue 19917006: Move all googletest related scripts into googletest/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Remove unnecessary pylint warning disable Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « googletest/list_test_cases.py ('k') | googletest/shard_test_cases.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 each test cases as a single shard, single process execution. 6 """Runs each test cases as a single shard, single process execution.
7 7
8 Similar to sharding_supervisor.py but finer grained. It runs each test case 8 Similar to sharding_supervisor.py but finer grained. It runs each test case
9 individually instead of running per shard. Runs multiple instances in parallel. 9 individually instead of running per shard. Runs multiple instances in parallel.
10 """ 10 """
11 11
12 import datetime 12 import datetime
13 import fnmatch 13 import fnmatch
14 import json 14 import json
15 import logging 15 import logging
16 import optparse 16 import optparse
17 import os 17 import os
18 import Queue 18 import Queue
19 import random 19 import random
20 import re 20 import re
21 import subprocess 21 import subprocess
22 import sys 22 import sys
23 import threading 23 import threading
24 import time 24 import time
25 from xml.dom import minidom 25 from xml.dom import minidom
26 import xml.parsers.expat 26 import xml.parsers.expat
27 27
28 ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
29 if not ROOT_DIR in sys.path:
30 sys.path.insert(0, ROOT_DIR)
31
28 import run_isolated 32 import run_isolated
29 33
30 # Scripts using run_test_cases as a library expect this function.
31 from run_isolated import fix_python_path
32
33 34
34 # These are known to influence the way the output is generated. 35 # These are known to influence the way the output is generated.
35 KNOWN_GTEST_ENV_VARS = [ 36 KNOWN_GTEST_ENV_VARS = [
36 'GTEST_ALSO_RUN_DISABLED_TESTS', 37 'GTEST_ALSO_RUN_DISABLED_TESTS',
37 'GTEST_BREAK_ON_FAILURE', 38 'GTEST_BREAK_ON_FAILURE',
38 'GTEST_CATCH_EXCEPTIONS', 39 'GTEST_CATCH_EXCEPTIONS',
39 'GTEST_COLOR', 40 'GTEST_COLOR',
40 'GTEST_FILTER', 41 'GTEST_FILTER',
41 'GTEST_OUTPUT', 42 'GTEST_OUTPUT',
42 'GTEST_PRINT_TIME', 43 'GTEST_PRINT_TIME',
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 options, args = parser.parse_args(argv) 1594 options, args = parser.parse_args(argv)
1594 1595
1595 if not args: 1596 if not args:
1596 parser.error( 1597 parser.error(
1597 'Please provide the executable line to run, if you need fancy things ' 1598 'Please provide the executable line to run, if you need fancy things '
1598 'like xvfb, start this script from *inside* xvfb, it\'ll be much faster' 1599 'like xvfb, start this script from *inside* xvfb, it\'ll be much faster'
1599 '.') 1600 '.')
1600 1601
1601 if options.run_all and options.max_failures is not None: 1602 if options.run_all and options.max_failures is not None:
1602 parser.error('Use only one of --run-all or --max-failures') 1603 parser.error('Use only one of --run-all or --max-failures')
1603 return parser, options, fix_python_path(args) 1604 return parser, options, run_isolated.fix_python_path(args)
1604 1605
1605 1606
1606 def main(argv): 1607 def main(argv):
1607 """CLI frontend to validate arguments.""" 1608 """CLI frontend to validate arguments."""
1608 run_isolated.disable_buffering() 1609 run_isolated.disable_buffering()
1609 parser, options, cmd = process_args(argv) 1610 parser, options, cmd = process_args(argv)
1610 1611
1611 if options.gtest_list_tests: 1612 if options.gtest_list_tests:
1612 # Special case, return the output of the target unmodified. 1613 # Special case, return the output of the target unmodified.
1613 return subprocess.call(cmd + ['--gtest_list_tests']) 1614 return subprocess.call(cmd + ['--gtest_list_tests'])
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1663 options.gtest_output, 1664 options.gtest_output,
1664 result_file, 1665 result_file,
1665 options.verbose) 1666 options.verbose)
1666 except Failure as e: 1667 except Failure as e:
1667 print >> sys.stderr, e.args[0] 1668 print >> sys.stderr, e.args[0]
1668 return 1 1669 return 1
1669 1670
1670 1671
1671 if __name__ == '__main__': 1672 if __name__ == '__main__':
1672 sys.exit(main(sys.argv[1:])) 1673 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « googletest/list_test_cases.py ('k') | googletest/shard_test_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698