OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// This is a utility to run and debug an individual DDC compiled test. | 5 /// This is a utility to run and debug an individual DDC compiled test. |
6 /// Tests can be run with either node or devtool (a Chrome-based utility with | 6 /// Tests can be run with either node or devtool (a Chrome-based utility with |
7 /// DOM APIs and developer tools support). | 7 /// DOM APIs and developer tools support). |
8 /// | 8 /// |
9 /// Install devtool via: | 9 /// Install devtool via: |
10 /// > npm install -g devtool | 10 /// > npm install -g devtool |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 function finish(e) { | 47 function finish(e) { |
48 if (e) { | 48 if (e) { |
49 console.log('Test ' + test + ' failed:\n' + e.toString()); | 49 console.log('Test ' + test + ' failed:\n' + e.toString()); |
50 sdk.dart.stackPrint(e); | 50 sdk.dart.stackPrint(e); |
51 } else { | 51 } else { |
52 console.log('Test ' + test + ' passed.'); | 52 console.log('Test ' + test + ' passed.'); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
| 56 sdk.dart.ignoreWhitelistedErrors(false); |
| 57 sdk.dart.failForWeakModeIsChecks(false); |
| 58 sdk._isolate_helper.startRootIsolate(() => {}, []); |
| 59 // Make it easier to debug test failures and required for formatter test that |
| 60 // assumes custom formatters are enabled. |
| 61 sdk._debugger.registerDevtoolsFormatter(); |
| 62 |
56 var async_helper = requirejs('async_helper').async_helper; | 63 var async_helper = requirejs('async_helper').async_helper; |
57 sdk._isolate_helper.startRootIsolate(() => {}, []); | |
58 async_helper.asyncTestInitialize(finish); | 64 async_helper.asyncTestInitialize(finish); |
59 | 65 |
60 var module = requirejs(test); | 66 var module = requirejs(test); |
61 var lib = test.split('/').slice(-1)[0]; | 67 var lib = test.split('/').slice(-1)[0]; |
62 try { | 68 try { |
63 var result = module[lib].main(); | 69 var result = module[lib].main(); |
64 // async_helper tests call finish directly - call here for all other | 70 // async_helper tests call finish directly - call here for all other |
65 // tests. | 71 // tests. |
66 if (!async_helper.asyncTestStarted) { | 72 if (!async_helper.asyncTestStarted) { |
67 if (!result || !(sdk.async.Future.is(result))) { | 73 if (!result || !(sdk.async.Future.is(result))) { |
68 finish(); | 74 finish(); |
69 } else { | 75 } else { |
70 // Wait iff result is a future | 76 // Wait iff result is a future |
71 result.then(sdk.dart.dynamic)(() => finish(), { onError: (e) => finish(e)
}); | 77 result.then(sdk.dart.dynamic)(() => finish(), { onError: (e) => finish(e)
}); |
72 } | 78 } |
73 } | 79 } |
74 } catch (e) { | 80 } catch (e) { |
75 finish(e); | 81 finish(e); |
76 } | 82 } |
OLD | NEW |