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

Side by Side Diff: lib/src/executable.dart

Issue 1055083004: Normalize handling of the package root in the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Unused import Created 5 years, 8 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
« no previous file with comments | « no previous file | lib/src/runner/application_exception.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 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy 5 // TODO(nweiz): This is under lib so that it can be used by the unittest dummy
6 // package. Once that package is no longer being updated, move this back into 6 // package. Once that package is no longer being updated, move this back into
7 // bin. 7 // bin.
8 library test.executable; 8 library test.executable;
9 9
10 import 'dart:async'; 10 import 'dart:async';
11 import 'dart:io'; 11 import 'dart:io';
12 import 'dart:math' as math; 12 import 'dart:math' as math;
13 13
14 import 'package:args/args.dart'; 14 import 'package:args/args.dart';
15 import 'package:stack_trace/stack_trace.dart'; 15 import 'package:stack_trace/stack_trace.dart';
16 import 'package:yaml/yaml.dart'; 16 import 'package:yaml/yaml.dart';
17 17
18 import 'backend/test_platform.dart'; 18 import 'backend/test_platform.dart';
19 import 'runner/reporter/compact.dart'; 19 import 'runner/reporter/compact.dart';
20 import 'runner/application_exception.dart';
20 import 'runner/load_exception.dart'; 21 import 'runner/load_exception.dart';
21 import 'runner/load_exception_suite.dart'; 22 import 'runner/load_exception_suite.dart';
22 import 'runner/loader.dart'; 23 import 'runner/loader.dart';
23 import 'util/exit_codes.dart' as exit_codes; 24 import 'util/exit_codes.dart' as exit_codes;
24 import 'util/io.dart'; 25 import 'util/io.dart';
25 import 'utils.dart'; 26 import 'utils.dart';
26 27
27 /// The argument parser used to parse the executable arguments. 28 /// The argument parser used to parse the executable arguments.
28 final _parser = new ArgParser(allowTrailingOptions: true); 29 final _parser = new ArgParser(allowTrailingOptions: true);
29 30
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 reporter.close().then((_) => timer.cancel()); 243 reporter.close().then((_) => timer.cancel());
243 }); 244 });
244 245
245 return reporter.run().then((success) { 246 return reporter.run().then((success) {
246 exitCode = success ? 0 : 1; 247 exitCode = success ? 0 : 1;
247 }).whenComplete(() { 248 }).whenComplete(() {
248 signalSubscription.cancel(); 249 signalSubscription.cancel();
249 return reporter.close(); 250 return reporter.close();
250 }); 251 });
251 }).whenComplete(signalSubscription.cancel).catchError((error, stackTrace) { 252 }).whenComplete(signalSubscription.cancel).catchError((error, stackTrace) {
253 if (error is ApplicationException) {
254 stderr.writeln(error.message);
255 exitCode = exit_codes.data;
256 return;
257 }
258
252 stderr.writeln(getErrorMessage(error)); 259 stderr.writeln(getErrorMessage(error));
253 stderr.writeln(new Trace.from(stackTrace).terse); 260 stderr.writeln(new Trace.from(stackTrace).terse);
254 stderr.writeln( 261 stderr.writeln(
255 "This is an unexpected error. Please file an issue at " 262 "This is an unexpected error. Please file an issue at "
256 "http://github.com/dart-lang/test\n" 263 "http://github.com/dart-lang/test\n"
257 "with the stack trace and instructions for reproducing the error."); 264 "with the stack trace and instructions for reproducing the error.");
258 exitCode = exit_codes.software; 265 exitCode = exit_codes.software;
259 }).whenComplete(() { 266 }).whenComplete(() {
260 return loader.close().then((_) { 267 return loader.close().then((_) {
261 // If we're on a Dart version that doesn't support Isolate.kill(), we have 268 // If we're on a Dart version that doesn't support Isolate.kill(), we have
(...skipping 16 matching lines...) Expand all
278 output = stderr; 285 output = stderr;
279 } 286 }
280 287
281 output.write("""$message 288 output.write("""$message
282 289
283 Usage: pub run test:test [files or directories...] 290 Usage: pub run test:test [files or directories...]
284 291
285 ${_parser.usage} 292 ${_parser.usage}
286 """); 293 """);
287 } 294 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/runner/application_exception.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698