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