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

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

Issue 26162007: Remove unittest-based wrapping from our testing scripts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « tools/testing/dart/browser_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 configurationDir, 265 configurationDir,
266 _getEnvironment(dartFlags)); 266 _getEnvironment(dartFlags));
267 267
268 static Map _getEnvironment(List<String> dartFlags) { 268 static Map _getEnvironment(List<String> dartFlags) {
269 var needDartFlags = dartFlags != null && dartFlags.length > 0; 269 var needDartFlags = dartFlags != null && dartFlags.length > 0;
270 270
271 var env = null; 271 var env = null;
272 if (needDartFlags) { 272 if (needDartFlags) {
273 env = new Map<String, String>(); 273 env = new Map<String, String>();
274 env['DART_FLAGS'] = dartFlags.join(" "); 274 env['DART_FLAGS'] = dartFlags.join(" ");
275 env['DART_FORWARDING_PRINT'] = '1';
275 } 276 }
276 277
277 return env; 278 return env;
278 } 279 }
279 280
280 static List<String> _getArguments(List<String> options, String htmlFile) { 281 static List<String> _getArguments(List<String> options, String htmlFile) {
281 var arguments = new List.from(options); 282 var arguments = new List.from(options);
282 arguments.add(htmlFile); 283 arguments.add(htmlFile);
283 return arguments; 284 return arguments;
284 } 285 }
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (hasCrashed) return Expectation.CRASH; 795 if (hasCrashed) return Expectation.CRASH;
795 if (hasTimedOut) return Expectation.TIMEOUT; 796 if (hasTimedOut) return Expectation.TIMEOUT;
796 797
797 var outcome = _getOutcome(); 798 var outcome = _getOutcome();
798 799
799 if (testCase.info != null && testCase.info.hasRuntimeError) { 800 if (testCase.info != null && testCase.info.hasRuntimeError) {
800 if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) { 801 if (!outcome.canBeOutcomeOf(Expectation.RUNTIME_ERROR)) {
801 return Expectation.MISSING_RUNTIME_ERROR; 802 return Expectation.MISSING_RUNTIME_ERROR;
802 } 803 }
803 } 804 }
804
805 if (testCase.isNegative) { 805 if (testCase.isNegative) {
806 if (outcome.canBeOutcomeOf(Expectation.FAIL)) return Expectation.PASS; 806 if (outcome.canBeOutcomeOf(Expectation.FAIL)) return Expectation.PASS;
807 return Expectation.FAIL; 807 return Expectation.FAIL;
808 } 808 }
809 return outcome; 809 return outcome;
810 } 810 }
811 811
812 bool get successful => canRunDependendCommands; 812 bool get successful => canRunDependendCommands;
813 813
814 bool get canRunDependendCommands { 814 bool get canRunDependendCommands {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 stdout, 0, 907 stdout, 0,
908 stdout.length); 908 stdout.length);
909 } 909 }
910 } 910 }
911 return true; 911 return true;
912 } 912 }
913 913
914 bool get _browserTestFailure { 914 bool get _browserTestFailure {
915 // Browser tests fail unless stdout contains 915 // Browser tests fail unless stdout contains
916 // 'Content-Type: text/plain' followed by 'PASS'. 916 // 'Content-Type: text/plain' followed by 'PASS'.
917 bool has_content_type = false; 917 bool hasContentType = false;
918 var stdoutLines = decodeUtf8(super.stdout).split("\n"); 918 var stdoutLines = decodeUtf8(super.stdout).split("\n");
919 var containsFail = false;
920 var containsPass = false;
919 for (String line in stdoutLines) { 921 for (String line in stdoutLines) {
920 switch (line) { 922 switch (line) {
921 case 'Content-Type: text/plain': 923 case 'Content-Type: text/plain':
922 has_content_type = true; 924 hasContentType = true;
925 break;
926 case 'FAIL':
927 if (hasContentType) {
928 containsFail = true;
929 }
923 break; 930 break;
924 case 'PASS': 931 case 'PASS':
925 if (has_content_type) { 932 if (hasContentType) {
926 if (exitCode != 0) { 933 containsPass = true;
927 print("Warning: All tests passed, but exitCode != 0 ($this)");
928 }
929 return (exitCode != 0 && !hasCrashed);
930 } 934 }
931 break; 935 break;
932 } 936 }
933 } 937 }
938 if (hasContentType) {
939 if (containsFail && containsPass) {
940 DebugLogger.warning("Test had 'FAIL' and 'PASS' in stdout. ($command)");
941 }
942 if (!containsFail && !containsPass) {
943 DebugLogger.warning("Test had neither 'FAIL' nor 'PASS' in stdout. "
944 "($command)");
945 return true;
946 }
947 if (containsFail) {
948 return true;
949 }
950 assert(containsPass);
951 if (exitCode != 0) {
952 DebugLogger.warning("All tests passed, but exitCode != 0. "
953 "($command)");
954 }
955 return (exitCode != 0 && !hasCrashed);
956 }
957 DebugLogger.warning("Couldn't find 'Content-Type: text/plain' in output. "
958 "($command).");
934 return true; 959 return true;
935 } 960 }
936 } 961 }
937 962
938 class HTMLBrowserCommandOutputImpl extends BrowserCommandOutputImpl { 963 class HTMLBrowserCommandOutputImpl extends BrowserCommandOutputImpl {
939 HTMLBrowserCommandOutputImpl( 964 HTMLBrowserCommandOutputImpl(
940 command, 965 command,
941 exitCode, 966 exitCode,
942 timedOut, 967 timedOut,
943 stdout, 968 stdout,
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 } 2399 }
2375 } 2400 }
2376 2401
2377 void eventAllTestsDone() { 2402 void eventAllTestsDone() {
2378 for (var listener in _eventListener) { 2403 for (var listener in _eventListener) {
2379 listener.allDone(); 2404 listener.allDone();
2380 } 2405 }
2381 _allDone(); 2406 _allDone();
2382 } 2407 }
2383 } 2408 }
OLDNEW
« no previous file with comments | « tools/testing/dart/browser_test.dart ('k') | tools/testing/dart/test_suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698