blob: 779937f47db75d7b60cb666464e8dca9aa984a11 [file] [log] [blame]
Johnny Chene8d9dc62011-10-31 19:04:07 +00001#!/usr/bin/env python
2
3"""
4Run the test suite using a separate process for each test file.
Vince Harronede59652015-01-08 02:11:26 +00005
Siva Chandra2d7832e2015-05-08 23:08:53 +00006Each test will run with a time limit of 10 minutes by default.
Vince Harronede59652015-01-08 02:11:26 +00007
Siva Chandra2d7832e2015-05-08 23:08:53 +00008Override the default time limit of 10 minutes by setting
Vince Harronede59652015-01-08 02:11:26 +00009the environment variable LLDB_TEST_TIMEOUT.
10
11E.g., export LLDB_TEST_TIMEOUT=10m
12
13Override the time limit for individual tests by setting
14the environment variable LLDB_[TEST NAME]_TIMEOUT.
15
16E.g., export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m
17
18Set to "0" to run without time limit.
19
20E.g., export LLDB_TEST_TIMEOUT=0
21or export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0
Vince Harrondcc2b9f2015-05-27 04:40:36 +000022
23To collect core files for timed out tests, do the following before running dosep.py
24
25OSX
26ulimit -c unlimited
27sudo sysctl -w kern.corefile=core.%P
28
29Linux:
30ulimit -c unlimited
31echo core.%p | sudo tee /proc/sys/kernel/core_pattern
Johnny Chene8d9dc62011-10-31 19:04:07 +000032"""
33
Greg Clayton2256d0d2014-03-24 23:01:57 +000034import multiprocessing
Todd Fiala3f0a3602014-07-08 06:42:37 +000035import os
Vince Harrondcc2b9f2015-05-27 04:40:36 +000036import fnmatch
Todd Fiala3f0a3602014-07-08 06:42:37 +000037import platform
Vince Harron06381732015-05-12 23:10:36 +000038import re
Vince Harronf8b9a1d2015-05-18 19:40:54 +000039import dotest_args
Vince Harron17f429f2014-12-13 00:08:19 +000040import shlex
41import subprocess
Todd Fiala3f0a3602014-07-08 06:42:37 +000042import sys
Steve Puccibefe2b12014-03-07 00:01:11 +000043
Johnny Chene8d9dc62011-10-31 19:04:07 +000044from optparse import OptionParser
45
Vince Harron17f429f2014-12-13 00:08:19 +000046def get_timeout_command():
Vince Harronede59652015-01-08 02:11:26 +000047 """Search for a suitable timeout command."""
Ying Chen93190c42015-07-20 20:04:22 +000048 if not sys.platform.startswith("win32"):
49 try:
50 subprocess.call("timeout", stderr=subprocess.PIPE)
51 return "timeout"
52 except OSError:
53 pass
Vince Harron17f429f2014-12-13 00:08:19 +000054 try:
Chaoren Lin45c17ff2015-05-28 23:00:10 +000055 subprocess.call("gtimeout", stderr=subprocess.PIPE)
Vince Harron17f429f2014-12-13 00:08:19 +000056 return "gtimeout"
57 except OSError:
58 pass
59 return None
60
61timeout_command = get_timeout_command()
62
Vince Harron17f429f2014-12-13 00:08:19 +000063# Status codes for running command with timeout.
64eTimedOut, ePassed, eFailed = 124, 0, 1
65
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000066output_lock = None
67test_counter = None
68total_tests = None
Pavel Labath05ab2372015-07-06 15:57:52 +000069dotest_options = None
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000070
Pavel Labath05ab2372015-07-06 15:57:52 +000071def setup_global_variables(lock, counter, total, options):
72 global output_lock, test_counter, total_tests, dotest_options
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000073 output_lock = lock
74 test_counter = counter
75 total_tests = total
Pavel Labath05ab2372015-07-06 15:57:52 +000076 dotest_options = options
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000077
Chaoren Lina4447b32015-06-07 18:50:40 +000078def update_status(name = None, command = None, output = None):
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000079 global output_lock, test_counter, total_tests
80 with output_lock:
81 if output is not None:
82 print >> sys.stderr
Chaoren Lina4447b32015-06-07 18:50:40 +000083 print >> sys.stderr, "Failed test suite: %s" % name
84 print >> sys.stderr, "Command invoked: %s" % ' '.join(command)
85 print >> sys.stderr, "stdout:\n%s" % output[0]
86 print >> sys.stderr, "stderr:\n%s" % output[1]
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +000087 sys.stderr.write("\r%*d out of %d test suites processed" %
88 (len(str(total_tests)), test_counter.value, total_tests))
89 test_counter.value += 1
90
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +000091def parse_test_results(output):
92 passes = 0
93 failures = 0
94 for result in output:
95 pass_count = re.search("^RESULT:.*([0-9]+) passes", result, re.MULTILINE)
96 fail_count = re.search("^RESULT:.*([0-9]+) failures", result, re.MULTILINE)
97 error_count = re.search("^RESULT:.*([0-9]+) errors", result, re.MULTILINE)
98 this_fail_count = 0
99 this_error_count = 0
100 if pass_count != None:
101 passes = passes + int(pass_count.group(1))
102 if fail_count != None:
103 failures = failures + int(fail_count.group(1))
104 if error_count != None:
105 failures = failures + int(error_count.group(1))
106 pass
107 return passes, failures
108
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +0000109def call_with_timeout(command, timeout, name):
Vince Harronede59652015-01-08 02:11:26 +0000110 """Run command with a timeout if possible."""
Vince Harrondcc2b9f2015-05-27 04:40:36 +0000111 """-s QUIT will create a coredump if they are enabled on your system"""
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000112 process = None
113 if timeout_command and timeout != "0":
114 command = [timeout_command, '-s', 'QUIT', timeout] + command
115 # Specifying a value for close_fds is unsupported on Windows when using subprocess.PIPE
Zachary Turnerdc494d52015-02-07 00:14:55 +0000116 if os.name != "nt":
Chaoren Lin9d2b7f92015-05-29 18:43:46 +0000117 process = subprocess.Popen(command, stdin=subprocess.PIPE,
118 stdout=subprocess.PIPE,
119 stderr=subprocess.PIPE,
120 close_fds=True)
Zachary Turnerdc494d52015-02-07 00:14:55 +0000121 else:
Chaoren Lin9d2b7f92015-05-29 18:43:46 +0000122 process = subprocess.Popen(command, stdin=subprocess.PIPE,
123 stdout=subprocess.PIPE,
124 stderr=subprocess.PIPE)
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000125 output = process.communicate()
126 exit_status = process.returncode
127 passes, failures = parse_test_results(output)
Chaoren Lina4447b32015-06-07 18:50:40 +0000128 update_status(name, command, output if exit_status != 0 else None)
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000129 return exit_status, passes, failures
Johnny Chene8d9dc62011-10-31 19:04:07 +0000130
Vince Harron41657cc2015-05-21 18:15:09 +0000131def process_dir(root, files, test_root, dotest_argv):
Steve Puccibefe2b12014-03-07 00:01:11 +0000132 """Examine a directory for tests, and invoke any found within it."""
Vince Harron17f429f2014-12-13 00:08:19 +0000133 timed_out = []
Daniel Maleacbaef262013-02-15 21:31:37 +0000134 failed = []
135 passed = []
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000136 pass_sub_count = 0
137 fail_sub_count = 0
Steve Puccibefe2b12014-03-07 00:01:11 +0000138 for name in files:
139 path = os.path.join(root, name)
140
141 # We're only interested in the test file with the "Test*.py" naming pattern.
142 if not name.startswith("Test") or not name.endswith(".py"):
143 continue
144
145 # Neither a symbolically linked file.
146 if os.path.islink(path):
147 continue
148
Zachary Turnerf6896b02015-01-05 19:37:03 +0000149 script_file = os.path.join(test_root, "dotest.py")
Zachary Turnerf6896b02015-01-05 19:37:03 +0000150 command = ([sys.executable, script_file] +
Vince Harron41657cc2015-05-21 18:15:09 +0000151 dotest_argv +
Vince Harron17f429f2014-12-13 00:08:19 +0000152 ["-p", name, root])
153
154 timeout_name = os.path.basename(os.path.splitext(name)[0]).upper()
155
Pavel Labath05ab2372015-07-06 15:57:52 +0000156 timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or getDefaultTimeout(dotest_options.lldb_platform_name)
Vince Harron17f429f2014-12-13 00:08:19 +0000157
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +0000158 exit_status, pass_count, fail_count = call_with_timeout(command, timeout, name)
Vince Harron17f429f2014-12-13 00:08:19 +0000159
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000160 pass_sub_count = pass_sub_count + pass_count
161 fail_sub_count = fail_sub_count + fail_count
162
163 if exit_status == ePassed:
Steve Puccibefe2b12014-03-07 00:01:11 +0000164 passed.append(name)
Vince Harron17f429f2014-12-13 00:08:19 +0000165 else:
166 if eTimedOut == exit_status:
167 timed_out.append(name)
168 failed.append(name)
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000169 return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
Steve Puccibefe2b12014-03-07 00:01:11 +0000170
171in_q = None
172out_q = None
173
Todd Fiala3f0a3602014-07-08 06:42:37 +0000174def process_dir_worker(arg_tuple):
Steve Puccibefe2b12014-03-07 00:01:11 +0000175 """Worker thread main loop when in multithreaded mode.
176 Takes one directory specification at a time and works on it."""
Vince Harron41657cc2015-05-21 18:15:09 +0000177 (root, files, test_root, dotest_argv) = arg_tuple
178 return process_dir(root, files, test_root, dotest_argv)
Steve Puccibefe2b12014-03-07 00:01:11 +0000179
Vince Harron41657cc2015-05-21 18:15:09 +0000180def walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads):
Steve Puccibefe2b12014-03-07 00:01:11 +0000181 """Look for matched files and invoke test driver on each one.
182 In single-threaded mode, each test driver is invoked directly.
183 In multi-threaded mode, submit each test driver to a worker
Vince Harrone06a7a82015-05-12 23:12:19 +0000184 queue, and then wait for all to complete.
185
186 test_directory - lldb/test/ directory
187 test_subdir - lldb/test/ or a subfolder with the tests we're interested in running
188 """
Todd Fiala3f0a3602014-07-08 06:42:37 +0000189
190 # Collect the test files that we'll run.
191 test_work_items = []
Vince Harrone06a7a82015-05-12 23:12:19 +0000192 for root, dirs, files in os.walk(test_subdir, topdown=False):
Vince Harron41657cc2015-05-21 18:15:09 +0000193 test_work_items.append((root, files, test_directory, dotest_argv))
Todd Fiala3f0a3602014-07-08 06:42:37 +0000194
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +0000195 global output_lock, test_counter, total_tests
196 output_lock = multiprocessing.Lock()
197 total_tests = len(test_work_items)
198 test_counter = multiprocessing.Value('i', 0)
199 print >> sys.stderr, "Testing: %d tests, %d threads" % (total_tests, num_threads)
200 update_status()
201
Todd Fiala3f0a3602014-07-08 06:42:37 +0000202 # Run the items, either in a pool (for multicore speedup) or
203 # calling each individually.
204 if num_threads > 1:
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +0000205 pool = multiprocessing.Pool(num_threads,
Pavel Labath05ab2372015-07-06 15:57:52 +0000206 initializer = setup_global_variables,
207 initargs = (output_lock, test_counter, total_tests, dotest_options))
Todd Fiala3f0a3602014-07-08 06:42:37 +0000208 test_results = pool.map(process_dir_worker, test_work_items)
209 else:
210 test_results = []
211 for work_item in test_work_items:
212 test_results.append(process_dir_worker(work_item))
213
Vince Harron17f429f2014-12-13 00:08:19 +0000214 timed_out = []
Steve Puccibefe2b12014-03-07 00:01:11 +0000215 failed = []
216 passed = []
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000217 fail_sub_count = 0
218 pass_sub_count = 0
Todd Fiala3f0a3602014-07-08 06:42:37 +0000219
220 for test_result in test_results:
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000221 (dir_timed_out, dir_failed, dir_passed, dir_fail_sub_count, dir_pass_sub_count) = test_result
Vince Harron17f429f2014-12-13 00:08:19 +0000222 timed_out += dir_timed_out
Todd Fiala3f0a3602014-07-08 06:42:37 +0000223 failed += dir_failed
224 passed += dir_passed
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000225 fail_sub_count = fail_sub_count + dir_fail_sub_count
226 pass_sub_count = pass_sub_count + dir_pass_sub_count
Todd Fiala3f0a3602014-07-08 06:42:37 +0000227
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000228 return (timed_out, failed, passed, fail_sub_count, pass_sub_count)
Johnny Chene8d9dc62011-10-31 19:04:07 +0000229
Vince Harronf8b9a1d2015-05-18 19:40:54 +0000230def getExpectedTimeouts(platform_name):
Vince Harron06381732015-05-12 23:10:36 +0000231 # returns a set of test filenames that might timeout
232 # are we running against a remote target?
Vince Harronf8b9a1d2015-05-18 19:40:54 +0000233 if platform_name is None:
Vince Harron06381732015-05-12 23:10:36 +0000234 target = sys.platform
235 remote = False
Vince Harronf8b9a1d2015-05-18 19:40:54 +0000236 else:
237 m = re.search('remote-(\w+)', platform_name)
238 target = m.group(1)
239 remote = True
Vince Harron06381732015-05-12 23:10:36 +0000240
241 expected_timeout = set()
242
243 if target.startswith("linux"):
244 expected_timeout |= {
Vince Harronde92b522015-05-13 23:59:03 +0000245 "TestAttachDenied.py",
Vince Harron06381732015-05-12 23:10:36 +0000246 "TestAttachResume.py",
247 "TestConnectRemote.py",
248 "TestCreateAfterAttach.py",
Tamas Berghammer0d0ec9f2015-05-19 10:49:40 +0000249 "TestEvents.py",
Vince Harron06381732015-05-12 23:10:36 +0000250 "TestExitDuringStep.py",
Tamas Berghammer0b11db52015-06-02 14:45:25 +0000251 "TestHelloWorld.py", # Times out in ~10% of the times on the build bot
Oleksiy Vyalov18f4c9f2015-06-10 01:34:25 +0000252 "TestMultithreaded.py",
Vince Harrone8843892015-06-22 20:54:14 +0000253 "TestRegisters.py", # ~12/600 dosep runs (build 3120-3122)
Vince Harron06381732015-05-12 23:10:36 +0000254 "TestThreadStepOut.py",
255 }
256 elif target.startswith("android"):
257 expected_timeout |= {
258 "TestExitDuringStep.py",
259 "TestHelloWorld.py",
260 }
Ed Maste4dd8fba2015-05-14 16:25:52 +0000261 elif target.startswith("freebsd"):
262 expected_timeout |= {
263 "TestBreakpointConditions.py",
Ed Maste08948132015-05-28 18:45:30 +0000264 "TestChangeProcessGroup.py",
Ed Mastebfd05632015-05-27 19:11:29 +0000265 "TestValueObjectRecursion.py",
Ed Maste4dd8fba2015-05-14 16:25:52 +0000266 "TestWatchpointConditionAPI.py",
267 }
Vince Harron0f173ac2015-05-18 19:36:33 +0000268 elif target.startswith("darwin"):
269 expected_timeout |= {
270 "TestThreadSpecificBreakpoint.py", # times out on MBP Retina, Mid 2012
271 }
Vince Harron06381732015-05-12 23:10:36 +0000272 return expected_timeout
273
Pavel Labathfad30cf2015-06-29 14:16:51 +0000274def getDefaultTimeout(platform_name):
275 if os.getenv("LLDB_TEST_TIMEOUT"):
276 return os.getenv("LLDB_TEST_TIMEOUT")
277
278 if platform_name is None:
279 platform_name = sys.platform
280
281 if platform_name.startswith("remote-"):
282 return "10m"
283 else:
284 return "4m"
285
286
Vince Harron0b9dbb52015-05-21 18:18:52 +0000287def touch(fname, times=None):
288 with open(fname, 'a'):
289 os.utime(fname, times)
290
Vince Harrondcc2b9f2015-05-27 04:40:36 +0000291def find(pattern, path):
292 result = []
293 for root, dirs, files in os.walk(path):
294 for name in files:
295 if fnmatch.fnmatch(name, pattern):
296 result.append(os.path.join(root, name))
297 return result
298
Johnny Chene8d9dc62011-10-31 19:04:07 +0000299def main():
Vince Harrond5fa1022015-05-10 15:24:12 +0000300 # We can't use sys.path[0] to determine the script directory
301 # because it doesn't work under a debugger
Vince Harrone06a7a82015-05-12 23:12:19 +0000302 test_directory = os.path.dirname(os.path.realpath(__file__))
Johnny Chene8d9dc62011-10-31 19:04:07 +0000303 parser = OptionParser(usage="""\
304Run lldb test suite using a separate process for each test file.
Vince Harronede59652015-01-08 02:11:26 +0000305
Siva Chandra2d7832e2015-05-08 23:08:53 +0000306 Each test will run with a time limit of 10 minutes by default.
Vince Harronede59652015-01-08 02:11:26 +0000307
Siva Chandra2d7832e2015-05-08 23:08:53 +0000308 Override the default time limit of 10 minutes by setting
Vince Harronede59652015-01-08 02:11:26 +0000309 the environment variable LLDB_TEST_TIMEOUT.
310
311 E.g., export LLDB_TEST_TIMEOUT=10m
312
313 Override the time limit for individual tests by setting
314 the environment variable LLDB_[TEST NAME]_TIMEOUT.
315
316 E.g., export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m
317
318 Set to "0" to run without time limit.
319
320 E.g., export LLDB_TEST_TIMEOUT=0
321 or export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0
Johnny Chene8d9dc62011-10-31 19:04:07 +0000322""")
323 parser.add_option('-o', '--options',
324 type='string', action='store',
325 dest='dotest_options',
326 help="""The options passed to 'dotest.py' if specified.""")
327
Greg Clayton2256d0d2014-03-24 23:01:57 +0000328 parser.add_option('-t', '--threads',
329 type='int',
330 dest='num_threads',
Ed Mastecec2a5b2014-11-21 02:41:25 +0000331 help="""The number of threads to use when running tests separately.""")
Greg Clayton2256d0d2014-03-24 23:01:57 +0000332
Johnny Chene8d9dc62011-10-31 19:04:07 +0000333 opts, args = parser.parse_args()
Vince Harronf8b9a1d2015-05-18 19:40:54 +0000334 dotest_option_string = opts.dotest_options
335
Vince Harron41657cc2015-05-21 18:15:09 +0000336 is_posix = (os.name == "posix")
337 dotest_argv = shlex.split(dotest_option_string, posix=is_posix) if dotest_option_string else []
Vince Harron8994fed2015-05-22 19:49:23 +0000338
339 parser = dotest_args.create_parser()
Pavel Labath05ab2372015-07-06 15:57:52 +0000340 global dotest_options
Vince Harron8994fed2015-05-22 19:49:23 +0000341 dotest_options = dotest_args.parse_args(parser, dotest_argv)
342
Vince Harron41657cc2015-05-21 18:15:09 +0000343 if not dotest_options.s:
344 # no session log directory, we need to add this to prevent
345 # every dotest invocation from creating its own directory
346 import datetime
347 # The windows platforms don't like ':' in the pathname.
348 timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S")
349 dotest_argv.append('-s')
350 dotest_argv.append(timestamp_started)
Vince Harron0b9dbb52015-05-21 18:18:52 +0000351 dotest_options.s = timestamp_started
352
353 session_dir = os.path.join(os.getcwd(), dotest_options.s)
Ed Mastecec2a5b2014-11-21 02:41:25 +0000354
Vince Harrone06a7a82015-05-12 23:12:19 +0000355 # The root directory was specified on the command line
356 if len(args) == 0:
357 test_subdir = test_directory
358 else:
359 test_subdir = os.path.join(test_directory, args[0])
360
Vince Harrondcc2b9f2015-05-27 04:40:36 +0000361 # clean core files in test tree from previous runs (Linux)
362 cores = find('core.*', test_subdir)
363 for core in cores:
364 os.unlink(core)
365
Ed Mastecec2a5b2014-11-21 02:41:25 +0000366 if opts.num_threads:
367 num_threads = opts.num_threads
368 else:
Greg Clayton2256d0d2014-03-24 23:01:57 +0000369 num_threads_str = os.environ.get("LLDB_TEST_THREADS")
370 if num_threads_str:
371 num_threads = int(num_threads_str)
Greg Clayton2256d0d2014-03-24 23:01:57 +0000372 else:
Ed Mastecec2a5b2014-11-21 02:41:25 +0000373 num_threads = multiprocessing.cpu_count()
374 if num_threads < 1:
375 num_threads = 1
Johnny Chene8d9dc62011-10-31 19:04:07 +0000376
Daniel Maleab42556f2013-04-19 18:32:53 +0000377 system_info = " ".join(platform.uname())
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000378 (timed_out, failed, passed, all_fails, all_passes) = walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads)
379
Vince Harron17f429f2014-12-13 00:08:19 +0000380 timed_out = set(timed_out)
Zachary Turnerc7a7c8a2015-05-28 19:56:26 +0000381 num_test_files = len(failed) + len(passed)
382 num_tests = all_fails + all_passes
Daniel Maleab42556f2013-04-19 18:32:53 +0000383
Vince Harrondcc2b9f2015-05-27 04:40:36 +0000384 # move core files into session dir
385 cores = find('core.*', test_subdir)
386 for core in cores:
387 dst = core.replace(test_directory, "")[1:]
388 dst = dst.replace(os.path.sep, "-")
389 os.rename(core, os.path.join(session_dir, dst))
390
Vince Harron06381732015-05-12 23:10:36 +0000391 # remove expected timeouts from failures
Vince Harronf8b9a1d2015-05-18 19:40:54 +0000392 expected_timeout = getExpectedTimeouts(dotest_options.lldb_platform_name)
Vince Harron06381732015-05-12 23:10:36 +0000393 for xtime in expected_timeout:
394 if xtime in timed_out:
395 timed_out.remove(xtime)
396 failed.remove(xtime)
Vince Harron0b9dbb52015-05-21 18:18:52 +0000397 result = "ExpectedTimeout"
398 elif xtime in passed:
399 result = "UnexpectedCompletion"
400 else:
401 result = None # failed
402
403 if result:
404 test_name = os.path.splitext(xtime)[0]
405 touch(os.path.join(session_dir, "{}-{}".format(result, test_name)))
Vince Harron06381732015-05-12 23:10:36 +0000406
Chaoren Lin5e3ab2b2015-06-01 17:49:25 +0000407 print
Chaoren Lin273aea82015-06-01 19:06:01 +0000408 print "Ran %d test suites (%d failed) (%f%%)" % (num_test_files, len(failed),
409 (100.0 * len(failed) / num_test_files) if num_test_files > 0 else float('NaN'))
410 print "Ran %d test cases (%d failed) (%f%%)" % (num_tests, all_fails,
411 (100.0 * all_fails / num_tests) if num_tests > 0 else float('NaN'))
Daniel Maleacbaef262013-02-15 21:31:37 +0000412 if len(failed) > 0:
Shawn Best13491c42014-10-22 19:29:00 +0000413 failed.sort()
Ying Chen10ed1a92015-05-28 23:51:49 +0000414 print "Failing Tests (%d)" % len(failed)
Daniel Maleacbaef262013-02-15 21:31:37 +0000415 for f in failed:
Vince Harron17f429f2014-12-13 00:08:19 +0000416 print "%s: LLDB (suite) :: %s (%s)" % (
417 "TIMEOUT" if f in timed_out else "FAIL", f, system_info
418 )
Daniel Maleacbaef262013-02-15 21:31:37 +0000419 sys.exit(1)
420 sys.exit(0)
Johnny Chene8d9dc62011-10-31 19:04:07 +0000421
422if __name__ == '__main__':
423 main()