Chromium Code Reviews

Side by Side Diff: lib/src/backend/invoker.dart

Issue 2099503002: Add a dedicated Result for skipped tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « json_reporter.schema.json ('k') | lib/src/backend/state.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:stack_trace/stack_trace.dart'; 7 import 'package:stack_trace/stack_trace.dart';
8 8
9 import '../backend/group.dart'; 9 import '../backend/group.dart';
10 import '../frontend/expect.dart'; 10 import '../frontend/expect.dart';
(...skipping 216 matching lines...)
227 new TimeoutException( 227 new TimeoutException(
228 "Test timed out after ${niceDuration(timeout)}.", timeout)); 228 "Test timed out after ${niceDuration(timeout)}.", timeout));
229 }); 229 });
230 }); 230 });
231 } 231 }
232 232
233 /// Notifies the invoker of an asynchronous error. 233 /// Notifies the invoker of an asynchronous error.
234 void _handleError(error, [StackTrace stackTrace]) { 234 void _handleError(error, [StackTrace stackTrace]) {
235 if (stackTrace == null) stackTrace = new Chain.current(); 235 if (stackTrace == null) stackTrace = new Chain.current();
236 236
237 var afterSuccess = liveTest.isComplete && 237 // Store this here because it'll change when we set the state below.
238 liveTest.state.result == Result.success; 238 var shouldBeDone = liveTest.state.shouldBeDone;
239 239
240 if (error is! TestFailure) { 240 if (error is! TestFailure) {
241 _controller.setState(const State(Status.complete, Result.error)); 241 _controller.setState(const State(Status.complete, Result.error));
242 } else if (liveTest.state.result != Result.error) { 242 } else if (liveTest.state.result != Result.error) {
243 _controller.setState(const State(Status.complete, Result.failure)); 243 _controller.setState(const State(Status.complete, Result.failure));
244 } 244 }
245 245
246 _controller.addError(error, stackTrace); 246 _controller.addError(error, stackTrace);
247 removeAllOutstandingCallbacks(); 247 removeAllOutstandingCallbacks();
248 248
249 // If a test was marked as success but then had an error, that indicates 249 // If a test was supposed to be done but then had an error, that indicates
250 // that it was poorly-written and could be flaky. 250 // that it was poorly-written and could be flaky.
251 if (!afterSuccess) return; 251 if (!shouldBeDone) return;
252 252
253 // However, users don't think of load tests as "tests", so the error isn't 253 // However, users don't think of load tests as "tests", so the error isn't
254 // helpful for them. 254 // helpful for them.
255 // 255 //
256 // TODO(nweiz): Find a way of avoiding this error that doesn't require 256 // TODO(nweiz): Find a way of avoiding this error that doesn't require
257 // Invoker to refer to a class from the runner. 257 // Invoker to refer to a class from the runner.
258 if (liveTest.suite is LoadSuite) return; 258 if (liveTest.suite is LoadSuite) return;
259 259
260 _handleError( 260 _handleError(
261 "This test failed after it had already completed. Make sure to use " 261 "This test failed after it had already completed. Make sure to use "
(...skipping 38 matching lines...)
300 // outstanding callback counters at once. 300 // outstanding callback counters at once.
301 _counterKey: outstandingCallbacksForBody, 301 _counterKey: outstandingCallbacksForBody,
302 _closableKey: true 302 _closableKey: true
303 }, 303 },
304 zoneSpecification: new ZoneSpecification( 304 zoneSpecification: new ZoneSpecification(
305 print: (self, parent, zone, line) => _controller.print(line)), 305 print: (self, parent, zone, line) => _controller.print(line)),
306 onError: _handleError); 306 onError: _handleError);
307 }); 307 });
308 } 308 }
309 } 309 }
OLDNEW
« no previous file with comments | « json_reporter.schema.json ('k') | lib/src/backend/state.dart » ('j') | no next file with comments »

Powered by Google App Engine