OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 | 551 |
552 // Cache information about test cases per test suite. For multiple | 552 // Cache information about test cases per test suite. For multiple |
553 // configurations there is no need to repeatedly search the file | 553 // configurations there is no need to repeatedly search the file |
554 // system, generate tests, and search test files for options. | 554 // system, generate tests, and search test files for options. |
555 Map<String, List<TestInformation>> _testCache; | 555 Map<String, List<TestInformation>> _testCache; |
556 /** | 556 /** |
557 * String indicating the browser used to run the tests. Empty if no browser | 557 * String indicating the browser used to run the tests. Empty if no browser |
558 * used. | 558 * used. |
559 */ | 559 */ |
560 String browserUsed; | 560 String browserUsed; |
561 Process selenium_server; | |
561 | 562 |
562 ProcessQueue(int this._maxProcesses, | 563 ProcessQueue(int this._maxProcesses, |
563 String progress, | 564 String progress, |
564 Date startTime, | 565 Date startTime, |
565 bool printTiming, | 566 bool printTiming, |
566 Function this._enqueueMoreWork, | 567 Function this._enqueueMoreWork, |
567 [bool this._verbose = false, | 568 [bool this._verbose = false, |
568 bool this._listTests = false, | 569 bool this._listTests = false, |
569 bool this._keepGeneratedTests = false]) | 570 bool this._keepGeneratedTests = false]) |
570 : _tests = new Queue<TestCase>(), | 571 : _tests = new Queue<TestCase>(), |
571 _progress = new ProgressIndicator.fromName(progress, | 572 _progress = new ProgressIndicator.fromName(progress, |
572 startTime, | 573 startTime, |
573 printTiming), | 574 printTiming), |
574 _batchProcesses = new Map<String, List<BatchRunnerProcess>>(), | 575 _batchProcesses = new Map<String, List<BatchRunnerProcess>>(), |
575 _testCache = new Map<String, List<TestInformation>>() { | 576 _testCache = new Map<String, List<TestInformation>>() { |
576 if (!_enqueueMoreWork(this)) _progress.allDone(); | 577 if (!_enqueueMoreWork(this)) _progress.allDone(); |
577 browserUsed = ''; | 578 browserUsed = ''; |
579 selenium_server = null; | |
578 } | 580 } |
579 | 581 |
580 /** | 582 /** |
581 * Registers a TestSuite so that all of its tests will be run. | 583 * Registers a TestSuite so that all of its tests will be run. |
582 */ | 584 */ |
583 void addTestSuite(TestSuite testSuite) { | 585 void addTestSuite(TestSuite testSuite) { |
584 _activeTestListers++; | 586 _activeTestListers++; |
585 testSuite.forEachTest(_runTest, _testCache, globalTemporaryDirectory, | 587 testSuite.forEachTest(_runTest, _testCache, globalTemporaryDirectory, |
586 _testListerDone); | 588 _testListerDone); |
587 } | 589 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 } | 645 } |
644 } | 646 } |
645 | 647 |
646 /** | 648 /** |
647 * Perform any cleanup needed once all tests in a TestSuite have completed | 649 * Perform any cleanup needed once all tests in a TestSuite have completed |
648 * and notify our progress indicator that we are done. | 650 * and notify our progress indicator that we are done. |
649 */ | 651 */ |
650 void _cleanupAndMarkDone() { | 652 void _cleanupAndMarkDone() { |
651 if (browserUsed != '') { | 653 if (browserUsed != '') { |
652 killZombieBrowsers(); | 654 killZombieBrowsers(); |
655 if (selenium_server != null) { | |
656 selenium_server.close(); | |
657 } | |
653 } else { | 658 } else { |
654 _progress.allDone(); | 659 _progress.allDone(); |
655 } | 660 } |
656 } | 661 } |
657 | 662 |
658 void _checkDone() { | 663 void _checkDone() { |
659 // When there are no more active test listers ask for more work | 664 // When there are no more active test listers ask for more work |
660 // from process queue users. | 665 // from process queue users. |
661 if (_activeTestListers == 0 && !_enqueueMoreWork(this)) { | 666 if (_activeTestListers == 0 && !_enqueueMoreWork(this)) { |
662 _progress.allTestsKnown(); | 667 _progress.allTestsKnown(); |
(...skipping 22 matching lines...) Expand all Loading... | |
685 _cleanupAndMarkDone(); | 690 _cleanupAndMarkDone(); |
686 }; | 691 }; |
687 } | 692 } |
688 } | 693 } |
689 } | 694 } |
690 } | 695 } |
691 | 696 |
692 void _runTest(TestCase test) { | 697 void _runTest(TestCase test) { |
693 if (test.configuration['component'] == 'webdriver') { | 698 if (test.configuration['component'] == 'webdriver') { |
694 browserUsed = test.configuration['browser']; | 699 browserUsed = test.configuration['browser']; |
700 if (new Platform().operatingSystem() == 'mac') { | |
701 selenium_server = new Process.start('java', ['-jar', ]);//TODO(efortuna) | |
Emily Fortuna
2012/02/28 07:06:51
This section isn't done (I need to find the correc
Jennifer Messerly
2012/02/28 16:56:56
maybe require it to be downloaded to a particular
Emily Fortuna
2012/02/29 01:10:34
Yes, I will have it downloaded in a particular loc
| |
702 } | |
695 } | 703 } |
696 _progress.testAdded(); | 704 _progress.testAdded(); |
697 _tests.add(test); | 705 _tests.add(test); |
698 _tryRunTest(); | 706 _tryRunTest(); |
699 } | 707 } |
700 | 708 |
701 void _terminateBatchRunners() { | 709 void _terminateBatchRunners() { |
702 for (var runners in _batchProcesses.getValues()) { | 710 for (var runners in _batchProcesses.getValues()) { |
703 for (var runner in runners) { | 711 for (var runner in runners) { |
704 runner.terminate(); | 712 runner.terminate(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 // the developer doesn't waste his or her time trying to fix a bunch of | 765 // the developer doesn't waste his or her time trying to fix a bunch of |
758 // tests that appear to be broken but were actually just flakes that | 766 // tests that appear to be broken but were actually just flakes that |
759 // didn't get retried because there had already been one failure. | 767 // didn't get retried because there had already been one failure. |
760 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 768 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
761 new RunningProcess(test, allowRetry, this).start(); | 769 new RunningProcess(test, allowRetry, this).start(); |
762 } | 770 } |
763 _numProcesses++; | 771 _numProcesses++; |
764 } | 772 } |
765 } | 773 } |
766 } | 774 } |
OLD | NEW |