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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 173 } |
174 } | 174 } |
175 return true; | 175 return true; |
176 } | 176 } |
177 } | 177 } |
178 return false; | 178 return false; |
179 }); | 179 }); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 class DumpRenderTreeCommand extends Command { | 183 class ContentShellCommand extends Command { |
184 /** | 184 /** |
185 * If [expectedOutputPath] is set, the output of DumpRenderTree is compared | 185 * If [expectedOutputPath] is set, the output of content shell is compared |
186 * with the content of [expectedOutputPath]. | 186 * with the content of [expectedOutputPath]. |
187 * This is used for example for pixel tests, where [expectedOutputPath] points | 187 * This is used for example for pixel tests, where [expectedOutputPath] points |
188 * to a *png file. | 188 * to a *png file. |
189 */ | 189 */ |
190 io.Path expectedOutputPath; | 190 io.Path expectedOutputPath; |
191 | 191 |
192 DumpRenderTreeCommand(String executable, | 192 ContentShellCommand(String executable, |
193 String htmlFile, | 193 String htmlFile, |
194 List<String> options, | 194 List<String> options, |
195 List<String> dartFlags, | 195 List<String> dartFlags, |
196 io.Path this.expectedOutputPath) | 196 io.Path this.expectedOutputPath) |
197 : super(executable, | 197 : super(executable, |
198 _getArguments(options, htmlFile), | 198 _getArguments(options, htmlFile), |
199 _getEnvironment(dartFlags)); | 199 _getEnvironment(dartFlags)); |
200 | 200 |
201 static Map _getEnvironment(List<String> dartFlags) { | 201 static Map _getEnvironment(List<String> dartFlags) { |
202 var needDartFlags = dartFlags != null && dartFlags.length > 0; | 202 var needDartFlags = dartFlags != null && dartFlags.length > 0; |
203 | 203 |
204 var env = null; | 204 var env = null; |
205 if (needDartFlags) { | 205 if (needDartFlags) { |
206 env = new Map.from(io.Platform.environment); | 206 env = new Map.from(io.Platform.environment); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 stderr, | 638 stderr, |
639 time, | 639 time, |
640 compilationSkipped); | 640 compilationSkipped); |
641 | 641 |
642 bool get didFail { | 642 bool get didFail { |
643 if (_failedBecauseOfMissingXDisplay) { | 643 if (_failedBecauseOfMissingXDisplay) { |
644 return true; | 644 return true; |
645 } | 645 } |
646 | 646 |
647 if (command.expectedOutputFile != null) { | 647 if (command.expectedOutputFile != null) { |
648 // We are either doing a pixel test or a layout test with DumpRenderTree | 648 // We are either doing a pixel test or a layout test with content shell |
649 return _failedBecauseOfUnexpectedDRTOutput; | 649 return _failedBecauseOfUnexpectedDRTOutput; |
650 } | 650 } |
651 return _browserTestFailure; | 651 return _browserTestFailure; |
652 } | 652 } |
653 | 653 |
654 bool get _failedBecauseOfMissingXDisplay { | 654 bool get _failedBecauseOfMissingXDisplay { |
655 // Browser case: | 655 // Browser case: |
656 // If the browser test failed, it may have been because DumpRenderTree | 656 // If the browser test failed, it may have been because content shell |
657 // and the virtual framebuffer X server didn't hook up, or DRT crashed with | 657 // and the virtual framebuffer X server didn't hook up, or it crashed with |
658 // a core dump. Sometimes DRT crashes after it has set the stdout to PASS, | 658 // a core dump. Sometimes content shell crashes after it has set the stdout |
659 // so we have to do this check first. | 659 // to PASS, so we have to do this check first. |
660 var stderrLines = decodeUtf8(super.stderr).split("\n"); | 660 var stderrLines = decodeUtf8(super.stderr).split("\n"); |
661 for (String line in stderrLines) { | 661 for (String line in stderrLines) { |
662 // TODO(kustermann,ricow): Issue: 7564 | 662 // TODO(kustermann,ricow): Issue: 7564 |
663 // This seems to happen quite frequently, we need to figure out why. | 663 // This seems to happen quite frequently, we need to figure out why. |
664 if (line.contains('Gtk-WARNING **: cannot open display') || | 664 if (line.contains('Gtk-WARNING **: cannot open display') || |
665 line.contains('Failed to run command. return code=1')) { | 665 line.contains('Failed to run command. return code=1')) { |
666 // If we get the X server error, or DRT crashes with a core dump, retry | 666 // If we get the X server error, or DRT crashes with a core dump, retry |
667 // the test. | 667 // the test. |
668 if ((testCase as BrowserTestCase).numRetries > 0) { | 668 if ((testCase as BrowserTestCase).numRetries > 0) { |
669 requestRetry = true; | 669 requestRetry = true; |
670 } | 670 } |
671 print("Warning: Test failure because of missing XDisplay"); | 671 print("Warning: Test failure because of missing XDisplay"); |
672 return true; | 672 return true; |
673 } | 673 } |
674 } | 674 } |
675 return false; | 675 return false; |
676 } | 676 } |
677 | 677 |
678 bool get _failedBecauseOfUnexpectedDRTOutput { | 678 bool get _failedBecauseOfUnexpectedDRTOutput { |
679 /* | 679 /* |
680 * The output of DumpRenderTree is different for pixel tests than for | 680 * The output of content shell is different for pixel tests than for |
681 * layout tests. | 681 * layout tests. |
682 * | 682 * |
683 * On a pixel test, the DRT output has the following format | 683 * On a pixel test, the DRT output has the following format |
684 * ...... | 684 * ...... |
685 * ...... | 685 * ...... |
686 * Content-Length: ...\n | 686 * Content-Length: ...\n |
687 * <*png data> | 687 * <*png data> |
688 * #EOF\n | 688 * #EOF\n |
689 * So we need to get the byte-range of the png data first, before | 689 * So we need to get the byte-range of the png data first, before |
690 * comparing it with the content of the expected output file. | 690 * comparing it with the content of the expected output file. |
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 } | 1859 } |
1860 } | 1860 } |
1861 | 1861 |
1862 void eventAllTestsDone() { | 1862 void eventAllTestsDone() { |
1863 for (var listener in _eventListener) { | 1863 for (var listener in _eventListener) { |
1864 listener.allDone(); | 1864 listener.allDone(); |
1865 } | 1865 } |
1866 } | 1866 } |
1867 } | 1867 } |
1868 | 1868 |
OLD | NEW |