Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 18174010: Test running changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 List<String> staticWarnings = []; 841 List<String> staticWarnings = [];
842 842
843 // Read the returned list of errors and stuff them away. 843 // Read the returned list of errors and stuff them away.
844 var stderrLines = decodeUtf8(super.stderr).split("\n"); 844 var stderrLines = decodeUtf8(super.stderr).split("\n");
845 for (String line in stderrLines) { 845 for (String line in stderrLines) {
846 if (line.length == 0) continue; 846 if (line.length == 0) continue;
847 List<String> fields = splitMachineError(line); 847 List<String> fields = splitMachineError(line);
848 if (fields[ERROR_LEVEL] == 'ERROR') { 848 if (fields[ERROR_LEVEL] == 'ERROR') {
849 errors.add(fields[FORMATTED_ERROR]); 849 errors.add(fields[FORMATTED_ERROR]);
850 } else if (fields[ERROR_LEVEL] == 'WARNING') { 850 } else if (fields[ERROR_LEVEL] == 'WARNING') {
851 // We only care about testing Static type warnings 851 staticWarnings.add(fields[FORMATTED_ERROR]);
852 // ignore all others
853 if (fields[ERROR_TYPE] == 'STATIC_TYPE' || fields[ERROR_TYPE] == 'STATIC _TYPE_WARNING') {
854 staticWarnings.add(fields[FORMATTED_ERROR]);
855 }
856 } 852 }
857 // OK to Skip error output that doesn't match the machine format 853 // OK to Skip error output that doesn't match the machine format
858 } 854 }
859 if (testCase.info != null 855 if (testCase.info != null
860 && testCase.info.optionsFromFile['isMultitest']) { 856 && testCase.info.optionsFromFile['isMultitest']) {
861 return _didMultitestFail(errors, staticWarnings); 857 return _didMultitestFail(errors, staticWarnings);
862 } 858 }
863 return _didStandardTestFail(errors, staticWarnings); 859 return _didStandardTestFail(errors, staticWarnings);
864 } 860 }
865 861
866 bool _didMultitestFail(List errors, List staticWarnings) { 862 bool _didMultitestFail(List errors, List staticWarnings) {
867 Set<String> outcome = testCase.info.multitestOutcome; 863 Set<String> outcome = testCase.info.multitestOutcome;
868 if (outcome == null) throw "outcome must not be null"; 864 if (outcome == null) throw "outcome must not be null";
869 if (outcome.contains('compile-time error') && errors.length > 0) { 865 if (outcome.contains('compile-time error') && errors.length > 0) {
870 return true; 866 return true;
871 } else if (outcome.contains('static type warning') 867 } else if (outcome.contains('static type warning')
872 && staticWarnings.length > 0) { 868 && staticWarnings.length > 0) {
873 return true; 869 return true;
874 } else if (outcome.isEmpty 870 } else if (outcome.isEmpty
875 && (errors.length > 0 || staticWarnings.length > 0)) { 871 && (errors.length > 0 || staticWarnings.length > 0)) {
876 return true; 872 return true;
877 } 873 }
878 return false; 874 return false;
879 } 875 }
880 876
881 bool _didStandardTestFail(List errors, List staticWarnings) { 877 bool _didStandardTestFail(List errors, List staticWarnings) {
882 bool hasFatalTypeErrors = false; 878 bool hasFatalTypeErrors = false;
kustermann 2013/07/01 11:58:38 I wouldn't be surprised if this complex logic down
883 int numStaticTypeAnnotations = 0; 879 int numStaticTypeAnnotations = 0;
884 int numCompileTimeAnnotations = 0; 880 int numCompileTimeAnnotations = 0;
885 var isStaticClean = false; 881 var isStaticClean = false;
886 if (testCase.info != null) { 882 if (testCase.info != null) {
887 var optionsFromFile = testCase.info.optionsFromFile; 883 var optionsFromFile = testCase.info.optionsFromFile;
888 hasFatalTypeErrors = testCase.info.hasFatalTypeErrors; 884 hasFatalTypeErrors = testCase.info.hasFatalTypeErrors;
889 for (Command c in testCase.commands) { 885 for (Command c in testCase.commands) {
890 for (String arg in c.arguments) { 886 for (String arg in c.arguments) {
891 if (arg == '--fatal-type-errors') { 887 if (arg == '--fatal-type-errors') {
892 hasFatalTypeErrors = true; 888 hasFatalTypeErrors = true;
(...skipping 23 matching lines...) Expand all
916 if (numStaticTypeAnnotations > 0 && isStaticClean) { 912 if (numStaticTypeAnnotations > 0 && isStaticClean) {
917 diagnostics.add("Cannot have both @static-clean and /// static " 913 diagnostics.add("Cannot have both @static-clean and /// static "
918 "type warning annotations."); 914 "type warning annotations.");
919 return true; 915 return true;
920 } 916 }
921 917
922 if (isStaticClean && staticWarnings.length > 0) { 918 if (isStaticClean && staticWarnings.length > 0) {
923 diagnostics.add( 919 diagnostics.add(
924 "@static-clean annotation found but analyzer returned warnings."); 920 "@static-clean annotation found but analyzer returned warnings.");
925 return true; 921 return true;
926 } 922 }
kustermann 2013/07/01 11:58:38 With your second change, you may want to change th
scheglov 2013/07/02 21:19:42 There is check for errors below, but it is done wi
927 923
928 if (numCompileTimeAnnotations > 0 924 if (numCompileTimeAnnotations > 0
929 && numCompileTimeAnnotations < errors.length) { 925 && numCompileTimeAnnotations < errors.length) {
930 // Expected compile-time errors were not returned. 926 // Expected compile-time errors were not returned.
931 // The test did not 'fail' in the way intended so don't return failed. 927 // The test did not 'fail' in the way intended so don't return failed.
932 diagnostics.add("Fewer compile time errors than annotated: " 928 diagnostics.add("Fewer compile time errors than annotated: "
933 "$numCompileTimeAnnotations"); 929 "$numCompileTimeAnnotations");
934 return false; 930 return false;
935 } 931 }
936 932
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1913 } 1909 }
1914 } 1910 }
1915 1911
1916 void eventAllTestsDone() { 1912 void eventAllTestsDone() {
1917 for (var listener in _eventListener) { 1913 for (var listener in _eventListener) {
1918 listener.allDone(); 1914 listener.allDone();
1919 } 1915 }
1920 } 1916 }
1921 } 1917 }
1922 1918
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698