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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 return 0 # We're done here. | 456 return 0 # We're done here. |
457 | 457 |
458 if options.report: | 458 if options.report: |
459 verbose.PrintReport(all_tests) | 459 verbose.PrintReport(all_tests) |
460 | 460 |
461 if num_tests == 0: | 461 if num_tests == 0: |
462 print "No tests to run." | 462 print "No tests to run." |
463 return 0 | 463 return 0 |
464 | 464 |
465 # Run the tests, either locally or distributed on the network. | 465 # Run the tests, either locally or distributed on the network. |
466 try: | 466 start_time = time.time() |
467 start_time = time.time() | 467 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]() |
468 progress_indicator = progress.PROGRESS_INDICATORS[options.progress]() | 468 if options.junitout: |
469 if options.junitout: | 469 progress_indicator = progress.JUnitTestProgressIndicator( |
470 progress_indicator = progress.JUnitTestProgressIndicator( | 470 progress_indicator, options.junitout, options.junittestsuite) |
471 progress_indicator, options.junitout, options.junittestsuite) | |
472 | 471 |
473 run_networked = not options.no_network | 472 run_networked = not options.no_network |
474 if not run_networked: | 473 if not run_networked: |
475 print("Network distribution disabled, running tests locally.") | 474 print("Network distribution disabled, running tests locally.") |
476 elif utils.GuessOS() != "linux": | 475 elif utils.GuessOS() != "linux": |
477 print("Network distribution is only supported on Linux, sorry!") | 476 print("Network distribution is only supported on Linux, sorry!") |
| 477 run_networked = False |
| 478 peers = [] |
| 479 if run_networked: |
| 480 peers = network_execution.GetPeers() |
| 481 if not peers: |
| 482 print("No connection to distribution server; running tests locally.") |
478 run_networked = False | 483 run_networked = False |
479 peers = [] | 484 elif len(peers) == 1: |
480 if run_networked: | 485 print("No other peers on the network; running tests locally.") |
481 peers = network_execution.GetPeers() | 486 run_networked = False |
482 if not peers: | 487 elif num_tests <= 100: |
483 print("No connection to distribution server; running tests locally.") | 488 print("Less than 100 tests, running them locally.") |
484 run_networked = False | 489 run_networked = False |
485 elif len(peers) == 1: | |
486 print("No other peers on the network; running tests locally.") | |
487 run_networked = False | |
488 elif num_tests <= 100: | |
489 print("Less than 100 tests, running them locally.") | |
490 run_networked = False | |
491 | 490 |
492 if run_networked: | 491 if run_networked: |
493 runner = network_execution.NetworkedRunner(suites, progress_indicator, | 492 runner = network_execution.NetworkedRunner(suites, progress_indicator, |
494 ctx, peers, workspace) | 493 ctx, peers, workspace) |
495 else: | 494 else: |
496 runner = execution.Runner(suites, progress_indicator, ctx) | 495 runner = execution.Runner(suites, progress_indicator, ctx) |
497 | 496 |
498 exit_code = runner.Run(options.j) | 497 exit_code = runner.Run(options.j) |
499 if runner.terminate: | 498 overall_duration = time.time() - start_time |
500 return exit_code | |
501 overall_duration = time.time() - start_time | |
502 except KeyboardInterrupt: | |
503 raise | |
504 | 499 |
505 if options.time: | 500 if options.time: |
506 verbose.PrintTestDurations(suites, overall_duration) | 501 verbose.PrintTestDurations(suites, overall_duration) |
507 return exit_code | 502 return exit_code |
508 | 503 |
509 | 504 |
510 if __name__ == "__main__": | 505 if __name__ == "__main__": |
511 sys.exit(Main()) | 506 sys.exit(Main()) |
OLD | NEW |