OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 import time | 41 import time |
42 | 42 |
43 from testrunner.local import execution | 43 from testrunner.local import execution |
44 from testrunner.local import progress | 44 from testrunner.local import progress |
45 from testrunner.local import testsuite | 45 from testrunner.local import testsuite |
46 from testrunner.local import utils | 46 from testrunner.local import utils |
47 from testrunner.local import verbose | 47 from testrunner.local import verbose |
48 from testrunner.objects import context | 48 from testrunner.objects import context |
49 | 49 |
50 | 50 |
| 51 # Base dir of the v8 checkout to be used as cwd. |
| 52 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 53 |
51 ARCH_GUESS = utils.DefaultArch() | 54 ARCH_GUESS = utils.DefaultArch() |
52 DEFAULT_TESTS = ["mjsunit", "webkit"] | 55 DEFAULT_TESTS = ["mjsunit", "webkit"] |
53 TIMEOUT_DEFAULT = 60 | 56 TIMEOUT_DEFAULT = 60 |
54 TIMEOUT_SCALEFACTOR = {"debug" : 4, | 57 TIMEOUT_SCALEFACTOR = {"debug" : 4, |
55 "release" : 1 } | 58 "release" : 1 } |
56 | 59 |
57 MODE_FLAGS = { | 60 MODE_FLAGS = { |
58 "debug" : ["--nohard-abort", "--nodead-code-elimination", | 61 "debug" : ["--nohard-abort", "--nodead-code-elimination", |
59 "--nofold-constants", "--enable-slow-asserts", | 62 "--nofold-constants", "--enable-slow-asserts", |
60 "--debug-code", "--verify-heap", | 63 "--debug-code", "--verify-heap", |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 count = 0 | 286 count = 0 |
284 shard = [] | 287 shard = [] |
285 for test in tests: | 288 for test in tests: |
286 if count % shard_count == shard_run - 1: | 289 if count % shard_count == shard_run - 1: |
287 shard.append(test) | 290 shard.append(test) |
288 count += 1 | 291 count += 1 |
289 return shard | 292 return shard |
290 | 293 |
291 | 294 |
292 def Main(): | 295 def Main(): |
| 296 # Use the v8 root as cwd as some test cases use "load" with relative paths. |
| 297 os.chdir(BASE_DIR) |
| 298 |
293 parser = BuildOptions() | 299 parser = BuildOptions() |
294 (options, args) = parser.parse_args() | 300 (options, args) = parser.parse_args() |
295 if not ProcessOptions(options): | 301 if not ProcessOptions(options): |
296 parser.print_help() | 302 parser.print_help() |
297 return 1 | 303 return 1 |
298 | 304 |
299 exit_code = 0 | 305 exit_code = 0 |
300 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) | |
301 | 306 |
302 suite_paths = utils.GetSuitePaths(join(workspace, "test")) | 307 suite_paths = utils.GetSuitePaths(join(BASE_DIR, "test")) |
303 | 308 |
304 if len(args) == 0: | 309 if len(args) == 0: |
305 suite_paths = [ s for s in suite_paths if s in DEFAULT_TESTS ] | 310 suite_paths = [ s for s in suite_paths if s in DEFAULT_TESTS ] |
306 else: | 311 else: |
307 args_suites = set() | 312 args_suites = set() |
308 for arg in args: | 313 for arg in args: |
309 suite = arg.split(os.path.sep)[0] | 314 suite = arg.split(os.path.sep)[0] |
310 if not suite in args_suites: | 315 if not suite in args_suites: |
311 args_suites.add(suite) | 316 args_suites.add(suite) |
312 suite_paths = [ s for s in suite_paths if s in args_suites ] | 317 suite_paths = [ s for s in suite_paths if s in args_suites ] |
313 | 318 |
314 suites = [] | 319 suites = [] |
315 for root in suite_paths: | 320 for root in suite_paths: |
316 suite = testsuite.TestSuite.LoadTestSuite( | 321 suite = testsuite.TestSuite.LoadTestSuite( |
317 os.path.join(workspace, "test", root)) | 322 os.path.join(BASE_DIR, "test", root)) |
318 if suite: | 323 if suite: |
319 suite.SetupWorkingDirectory() | 324 suite.SetupWorkingDirectory() |
320 suites.append(suite) | 325 suites.append(suite) |
321 | 326 |
322 if options.download_data: | 327 if options.download_data: |
323 for s in suites: | 328 for s in suites: |
324 s.DownloadData() | 329 s.DownloadData() |
325 | 330 |
326 for mode in options.mode: | 331 for mode in options.mode: |
327 for arch in options.arch: | 332 for arch in options.arch: |
328 try: | 333 try: |
329 code = Execute(arch, mode, args, options, suites, workspace) | 334 code = Execute(arch, mode, args, options, suites, BASE_DIR) |
330 exit_code = exit_code or code | 335 exit_code = exit_code or code |
331 except KeyboardInterrupt: | 336 except KeyboardInterrupt: |
332 return 2 | 337 return 2 |
333 return exit_code | 338 return exit_code |
334 | 339 |
335 | 340 |
336 def CalculateNTests(m, options): | 341 def CalculateNTests(m, options): |
337 """Calculates the number of tests from m deopt points with exponential | 342 """Calculates the number of tests from m deopt points with exponential |
338 coverage. | 343 coverage. |
339 The coverage is expected to be between 0.0 and 1.0. | 344 The coverage is expected to be between 0.0 and 1.0. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 print(">>> Deopt fuzzing phase (%d test cases)" % num_tests) | 487 print(">>> Deopt fuzzing phase (%d test cases)" % num_tests) |
483 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]() | 488 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]() |
484 runner = execution.Runner(suites, progress_indicator, ctx) | 489 runner = execution.Runner(suites, progress_indicator, ctx) |
485 | 490 |
486 code = runner.Run(options.j) | 491 code = runner.Run(options.j) |
487 return exit_code or code | 492 return exit_code or code |
488 | 493 |
489 | 494 |
490 if __name__ == "__main__": | 495 if __name__ == "__main__": |
491 sys.exit(Main()) | 496 sys.exit(Main()) |
OLD | NEW |