Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """ |
| 4 | Run the test suite using a separate process for each test file. |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 5 | |
Siva Chandra | 2d7832e | 2015-05-08 23:08:53 +0000 | [diff] [blame] | 6 | Each test will run with a time limit of 10 minutes by default. |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 7 | |
Siva Chandra | 2d7832e | 2015-05-08 23:08:53 +0000 | [diff] [blame] | 8 | Override the default time limit of 10 minutes by setting |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 9 | the environment variable LLDB_TEST_TIMEOUT. |
| 10 | |
| 11 | E.g., export LLDB_TEST_TIMEOUT=10m |
| 12 | |
| 13 | Override the time limit for individual tests by setting |
| 14 | the environment variable LLDB_[TEST NAME]_TIMEOUT. |
| 15 | |
| 16 | E.g., export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m |
| 17 | |
| 18 | Set to "0" to run without time limit. |
| 19 | |
| 20 | E.g., export LLDB_TEST_TIMEOUT=0 |
| 21 | or export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0 |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 22 | |
| 23 | To collect core files for timed out tests, do the following before running dosep.py |
| 24 | |
| 25 | OSX |
| 26 | ulimit -c unlimited |
| 27 | sudo sysctl -w kern.corefile=core.%P |
| 28 | |
| 29 | Linux: |
| 30 | ulimit -c unlimited |
| 31 | echo core.%p | sudo tee /proc/sys/kernel/core_pattern |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 32 | """ |
| 33 | |
Greg Clayton | 2256d0d | 2014-03-24 23:01:57 +0000 | [diff] [blame] | 34 | import multiprocessing |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 35 | import os |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 36 | import fnmatch |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 37 | import platform |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 38 | import re |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 39 | import dotest_args |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 40 | import shlex |
| 41 | import subprocess |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 42 | import sys |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 43 | |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 44 | from optparse import OptionParser |
| 45 | |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 46 | def get_timeout_command(): |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 47 | """Search for a suitable timeout command.""" |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 48 | if sys.platform.startswith("win32"): |
| 49 | return None |
| 50 | try: |
| 51 | subprocess.call("timeout") |
| 52 | return "timeout" |
| 53 | except OSError: |
| 54 | pass |
| 55 | try: |
| 56 | subprocess.call("gtimeout") |
| 57 | return "gtimeout" |
| 58 | except OSError: |
| 59 | pass |
| 60 | return None |
| 61 | |
| 62 | timeout_command = get_timeout_command() |
| 63 | |
Siva Chandra | 2d7832e | 2015-05-08 23:08:53 +0000 | [diff] [blame] | 64 | default_timeout = os.getenv("LLDB_TEST_TIMEOUT") or "10m" |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 65 | |
| 66 | # Status codes for running command with timeout. |
| 67 | eTimedOut, ePassed, eFailed = 124, 0, 1 |
| 68 | |
| 69 | def call_with_timeout(command, timeout): |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 70 | """Run command with a timeout if possible.""" |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 71 | """-s QUIT will create a coredump if they are enabled on your system""" |
Zachary Turner | dc494d5 | 2015-02-07 00:14:55 +0000 | [diff] [blame] | 72 | if os.name != "nt": |
| 73 | if timeout_command and timeout != "0": |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 74 | return subprocess.call([timeout_command, '-s', 'QUIT', timeout] + command, |
Zachary Turner | dc494d5 | 2015-02-07 00:14:55 +0000 | [diff] [blame] | 75 | stdin=subprocess.PIPE, close_fds=True) |
| 76 | return (ePassed if subprocess.call(command, stdin=subprocess.PIPE, close_fds=True) == 0 |
| 77 | else eFailed) |
| 78 | else: |
| 79 | if timeout_command and timeout != "0": |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 80 | return subprocess.call([timeout_command, '-s', 'QUIT', timeout] + command, |
Zachary Turner | dc494d5 | 2015-02-07 00:14:55 +0000 | [diff] [blame] | 81 | stdin=subprocess.PIPE) |
| 82 | return (ePassed if subprocess.call(command, stdin=subprocess.PIPE) == 0 |
| 83 | else eFailed) |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 84 | |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 85 | def process_dir(root, files, test_root, dotest_argv): |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 86 | """Examine a directory for tests, and invoke any found within it.""" |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 87 | timed_out = [] |
Daniel Malea | cbaef26 | 2013-02-15 21:31:37 +0000 | [diff] [blame] | 88 | failed = [] |
| 89 | passed = [] |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 90 | for name in files: |
| 91 | path = os.path.join(root, name) |
| 92 | |
| 93 | # We're only interested in the test file with the "Test*.py" naming pattern. |
| 94 | if not name.startswith("Test") or not name.endswith(".py"): |
| 95 | continue |
| 96 | |
| 97 | # Neither a symbolically linked file. |
| 98 | if os.path.islink(path): |
| 99 | continue |
| 100 | |
Zachary Turner | f6896b0 | 2015-01-05 19:37:03 +0000 | [diff] [blame] | 101 | script_file = os.path.join(test_root, "dotest.py") |
Zachary Turner | f6896b0 | 2015-01-05 19:37:03 +0000 | [diff] [blame] | 102 | command = ([sys.executable, script_file] + |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 103 | dotest_argv + |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 104 | ["-p", name, root]) |
| 105 | |
| 106 | timeout_name = os.path.basename(os.path.splitext(name)[0]).upper() |
| 107 | |
| 108 | timeout = os.getenv("LLDB_%s_TIMEOUT" % timeout_name) or default_timeout |
| 109 | |
| 110 | exit_status = call_with_timeout(command, timeout) |
| 111 | |
| 112 | if ePassed == exit_status: |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 113 | passed.append(name) |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 114 | else: |
| 115 | if eTimedOut == exit_status: |
| 116 | timed_out.append(name) |
| 117 | failed.append(name) |
| 118 | return (timed_out, failed, passed) |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 119 | |
| 120 | in_q = None |
| 121 | out_q = None |
| 122 | |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 123 | def process_dir_worker(arg_tuple): |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 124 | """Worker thread main loop when in multithreaded mode. |
| 125 | Takes one directory specification at a time and works on it.""" |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 126 | (root, files, test_root, dotest_argv) = arg_tuple |
| 127 | return process_dir(root, files, test_root, dotest_argv) |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 128 | |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 129 | def walk_and_invoke(test_directory, test_subdir, dotest_argv, num_threads): |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 130 | """Look for matched files and invoke test driver on each one. |
| 131 | In single-threaded mode, each test driver is invoked directly. |
| 132 | In multi-threaded mode, submit each test driver to a worker |
Vince Harron | e06a7a8 | 2015-05-12 23:12:19 +0000 | [diff] [blame] | 133 | queue, and then wait for all to complete. |
| 134 | |
| 135 | test_directory - lldb/test/ directory |
| 136 | test_subdir - lldb/test/ or a subfolder with the tests we're interested in running |
| 137 | """ |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 138 | |
| 139 | # Collect the test files that we'll run. |
| 140 | test_work_items = [] |
Vince Harron | e06a7a8 | 2015-05-12 23:12:19 +0000 | [diff] [blame] | 141 | for root, dirs, files in os.walk(test_subdir, topdown=False): |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 142 | test_work_items.append((root, files, test_directory, dotest_argv)) |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 143 | |
| 144 | # Run the items, either in a pool (for multicore speedup) or |
| 145 | # calling each individually. |
| 146 | if num_threads > 1: |
| 147 | pool = multiprocessing.Pool(num_threads) |
| 148 | test_results = pool.map(process_dir_worker, test_work_items) |
| 149 | else: |
| 150 | test_results = [] |
| 151 | for work_item in test_work_items: |
| 152 | test_results.append(process_dir_worker(work_item)) |
| 153 | |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 154 | timed_out = [] |
Steve Pucci | befe2b1 | 2014-03-07 00:01:11 +0000 | [diff] [blame] | 155 | failed = [] |
| 156 | passed = [] |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 157 | |
| 158 | for test_result in test_results: |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 159 | (dir_timed_out, dir_failed, dir_passed) = test_result |
| 160 | timed_out += dir_timed_out |
Todd Fiala | 3f0a360 | 2014-07-08 06:42:37 +0000 | [diff] [blame] | 161 | failed += dir_failed |
| 162 | passed += dir_passed |
| 163 | |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 164 | return (timed_out, failed, passed) |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 165 | |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 166 | def getExpectedTimeouts(platform_name): |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 167 | # returns a set of test filenames that might timeout |
| 168 | # are we running against a remote target? |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 169 | if platform_name is None: |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 170 | target = sys.platform |
| 171 | remote = False |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 172 | else: |
| 173 | m = re.search('remote-(\w+)', platform_name) |
| 174 | target = m.group(1) |
| 175 | remote = True |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 176 | |
| 177 | expected_timeout = set() |
| 178 | |
| 179 | if target.startswith("linux"): |
| 180 | expected_timeout |= { |
Vince Harron | de92b52 | 2015-05-13 23:59:03 +0000 | [diff] [blame] | 181 | "TestAttachDenied.py", |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 182 | "TestAttachResume.py", |
| 183 | "TestConnectRemote.py", |
| 184 | "TestCreateAfterAttach.py", |
Tamas Berghammer | 0d0ec9f | 2015-05-19 10:49:40 +0000 | [diff] [blame] | 185 | "TestEvents.py", |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 186 | "TestExitDuringStep.py", |
| 187 | "TestThreadStepOut.py", |
| 188 | } |
| 189 | elif target.startswith("android"): |
| 190 | expected_timeout |= { |
| 191 | "TestExitDuringStep.py", |
| 192 | "TestHelloWorld.py", |
| 193 | } |
Ed Maste | 4dd8fba | 2015-05-14 16:25:52 +0000 | [diff] [blame] | 194 | elif target.startswith("freebsd"): |
| 195 | expected_timeout |= { |
| 196 | "TestBreakpointConditions.py", |
Ed Maste | 0894813 | 2015-05-28 18:45:30 +0000 | [diff] [blame] | 197 | "TestChangeProcessGroup.py", |
Ed Maste | bfd0563 | 2015-05-27 19:11:29 +0000 | [diff] [blame] | 198 | "TestValueObjectRecursion.py", |
Ed Maste | 4dd8fba | 2015-05-14 16:25:52 +0000 | [diff] [blame] | 199 | "TestWatchpointConditionAPI.py", |
| 200 | } |
Vince Harron | 0f173ac | 2015-05-18 19:36:33 +0000 | [diff] [blame] | 201 | elif target.startswith("darwin"): |
| 202 | expected_timeout |= { |
| 203 | "TestThreadSpecificBreakpoint.py", # times out on MBP Retina, Mid 2012 |
| 204 | } |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 205 | return expected_timeout |
| 206 | |
Vince Harron | 0b9dbb5 | 2015-05-21 18:18:52 +0000 | [diff] [blame] | 207 | def touch(fname, times=None): |
| 208 | with open(fname, 'a'): |
| 209 | os.utime(fname, times) |
| 210 | |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 211 | def find(pattern, path): |
| 212 | result = [] |
| 213 | for root, dirs, files in os.walk(path): |
| 214 | for name in files: |
| 215 | if fnmatch.fnmatch(name, pattern): |
| 216 | result.append(os.path.join(root, name)) |
| 217 | return result |
| 218 | |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 219 | def main(): |
Vince Harron | d5fa102 | 2015-05-10 15:24:12 +0000 | [diff] [blame] | 220 | # We can't use sys.path[0] to determine the script directory |
| 221 | # because it doesn't work under a debugger |
Vince Harron | e06a7a8 | 2015-05-12 23:12:19 +0000 | [diff] [blame] | 222 | test_directory = os.path.dirname(os.path.realpath(__file__)) |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 223 | parser = OptionParser(usage="""\ |
| 224 | Run lldb test suite using a separate process for each test file. |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 225 | |
Siva Chandra | 2d7832e | 2015-05-08 23:08:53 +0000 | [diff] [blame] | 226 | Each test will run with a time limit of 10 minutes by default. |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 227 | |
Siva Chandra | 2d7832e | 2015-05-08 23:08:53 +0000 | [diff] [blame] | 228 | Override the default time limit of 10 minutes by setting |
Vince Harron | ede5965 | 2015-01-08 02:11:26 +0000 | [diff] [blame] | 229 | the environment variable LLDB_TEST_TIMEOUT. |
| 230 | |
| 231 | E.g., export LLDB_TEST_TIMEOUT=10m |
| 232 | |
| 233 | Override the time limit for individual tests by setting |
| 234 | the environment variable LLDB_[TEST NAME]_TIMEOUT. |
| 235 | |
| 236 | E.g., export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=2m |
| 237 | |
| 238 | Set to "0" to run without time limit. |
| 239 | |
| 240 | E.g., export LLDB_TEST_TIMEOUT=0 |
| 241 | or export LLDB_TESTCONCURRENTEVENTS_TIMEOUT=0 |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 242 | """) |
| 243 | parser.add_option('-o', '--options', |
| 244 | type='string', action='store', |
| 245 | dest='dotest_options', |
| 246 | help="""The options passed to 'dotest.py' if specified.""") |
| 247 | |
Greg Clayton | 2256d0d | 2014-03-24 23:01:57 +0000 | [diff] [blame] | 248 | parser.add_option('-t', '--threads', |
| 249 | type='int', |
| 250 | dest='num_threads', |
Ed Maste | cec2a5b | 2014-11-21 02:41:25 +0000 | [diff] [blame] | 251 | help="""The number of threads to use when running tests separately.""") |
Greg Clayton | 2256d0d | 2014-03-24 23:01:57 +0000 | [diff] [blame] | 252 | |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 253 | opts, args = parser.parse_args() |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 254 | dotest_option_string = opts.dotest_options |
| 255 | |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 256 | is_posix = (os.name == "posix") |
| 257 | dotest_argv = shlex.split(dotest_option_string, posix=is_posix) if dotest_option_string else [] |
Vince Harron | 8994fed | 2015-05-22 19:49:23 +0000 | [diff] [blame] | 258 | |
| 259 | parser = dotest_args.create_parser() |
| 260 | dotest_options = dotest_args.parse_args(parser, dotest_argv) |
| 261 | |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 262 | if not dotest_options.s: |
| 263 | # no session log directory, we need to add this to prevent |
| 264 | # every dotest invocation from creating its own directory |
| 265 | import datetime |
| 266 | # The windows platforms don't like ':' in the pathname. |
| 267 | timestamp_started = datetime.datetime.now().strftime("%Y-%m-%d-%H_%M_%S") |
| 268 | dotest_argv.append('-s') |
| 269 | dotest_argv.append(timestamp_started) |
Vince Harron | 0b9dbb5 | 2015-05-21 18:18:52 +0000 | [diff] [blame] | 270 | dotest_options.s = timestamp_started |
| 271 | |
| 272 | session_dir = os.path.join(os.getcwd(), dotest_options.s) |
Ed Maste | cec2a5b | 2014-11-21 02:41:25 +0000 | [diff] [blame] | 273 | |
Vince Harron | e06a7a8 | 2015-05-12 23:12:19 +0000 | [diff] [blame] | 274 | # The root directory was specified on the command line |
| 275 | if len(args) == 0: |
| 276 | test_subdir = test_directory |
| 277 | else: |
| 278 | test_subdir = os.path.join(test_directory, args[0]) |
| 279 | |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 280 | # clean core files in test tree from previous runs (Linux) |
| 281 | cores = find('core.*', test_subdir) |
| 282 | for core in cores: |
| 283 | os.unlink(core) |
| 284 | |
Ed Maste | cec2a5b | 2014-11-21 02:41:25 +0000 | [diff] [blame] | 285 | if opts.num_threads: |
| 286 | num_threads = opts.num_threads |
| 287 | else: |
Greg Clayton | 2256d0d | 2014-03-24 23:01:57 +0000 | [diff] [blame] | 288 | num_threads_str = os.environ.get("LLDB_TEST_THREADS") |
| 289 | if num_threads_str: |
| 290 | num_threads = int(num_threads_str) |
Greg Clayton | 2256d0d | 2014-03-24 23:01:57 +0000 | [diff] [blame] | 291 | else: |
Ed Maste | cec2a5b | 2014-11-21 02:41:25 +0000 | [diff] [blame] | 292 | num_threads = multiprocessing.cpu_count() |
| 293 | if num_threads < 1: |
| 294 | num_threads = 1 |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 295 | |
Daniel Malea | b42556f | 2013-04-19 18:32:53 +0000 | [diff] [blame] | 296 | system_info = " ".join(platform.uname()) |
Vince Harron | 41657cc | 2015-05-21 18:15:09 +0000 | [diff] [blame] | 297 | (timed_out, failed, passed) = walk_and_invoke(test_directory, test_subdir, dotest_argv, |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 298 | num_threads) |
| 299 | timed_out = set(timed_out) |
Daniel Malea | cbaef26 | 2013-02-15 21:31:37 +0000 | [diff] [blame] | 300 | num_tests = len(failed) + len(passed) |
Daniel Malea | b42556f | 2013-04-19 18:32:53 +0000 | [diff] [blame] | 301 | |
Vince Harron | dcc2b9f | 2015-05-27 04:40:36 +0000 | [diff] [blame] | 302 | # move core files into session dir |
| 303 | cores = find('core.*', test_subdir) |
| 304 | for core in cores: |
| 305 | dst = core.replace(test_directory, "")[1:] |
| 306 | dst = dst.replace(os.path.sep, "-") |
| 307 | os.rename(core, os.path.join(session_dir, dst)) |
| 308 | |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 309 | # remove expected timeouts from failures |
Vince Harron | f8b9a1d | 2015-05-18 19:40:54 +0000 | [diff] [blame] | 310 | expected_timeout = getExpectedTimeouts(dotest_options.lldb_platform_name) |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 311 | for xtime in expected_timeout: |
| 312 | if xtime in timed_out: |
| 313 | timed_out.remove(xtime) |
| 314 | failed.remove(xtime) |
Vince Harron | 0b9dbb5 | 2015-05-21 18:18:52 +0000 | [diff] [blame] | 315 | result = "ExpectedTimeout" |
| 316 | elif xtime in passed: |
| 317 | result = "UnexpectedCompletion" |
| 318 | else: |
| 319 | result = None # failed |
| 320 | |
| 321 | if result: |
| 322 | test_name = os.path.splitext(xtime)[0] |
| 323 | touch(os.path.join(session_dir, "{}-{}".format(result, test_name))) |
Vince Harron | 0638173 | 2015-05-12 23:10:36 +0000 | [diff] [blame] | 324 | |
Daniel Malea | cbaef26 | 2013-02-15 21:31:37 +0000 | [diff] [blame] | 325 | print "Ran %d tests." % num_tests |
| 326 | if len(failed) > 0: |
Shawn Best | 13491c4 | 2014-10-22 19:29:00 +0000 | [diff] [blame] | 327 | failed.sort() |
Daniel Malea | cbaef26 | 2013-02-15 21:31:37 +0000 | [diff] [blame] | 328 | print "Failing Tests (%d)" % len(failed) |
| 329 | for f in failed: |
Vince Harron | 17f429f | 2014-12-13 00:08:19 +0000 | [diff] [blame] | 330 | print "%s: LLDB (suite) :: %s (%s)" % ( |
| 331 | "TIMEOUT" if f in timed_out else "FAIL", f, system_info |
| 332 | ) |
Daniel Malea | cbaef26 | 2013-02-15 21:31:37 +0000 | [diff] [blame] | 333 | sys.exit(1) |
| 334 | sys.exit(0) |
Johnny Chen | e8d9dc6 | 2011-10-31 19:04:07 +0000 | [diff] [blame] | 335 | |
| 336 | if __name__ == '__main__': |
| 337 | main() |