mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Support for debugging DDC tests under devtool
R=alanknight@google.com Review URL: https://codereview.chromium.org/2501183002 .
This commit is contained in:
parent
2bec7b5adb
commit
22c27800b6
1 changed files with 24 additions and 4 deletions
|
@ -2,9 +2,23 @@
|
|||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
/// This is a utility to run and debug an individual DDC compiled test.
|
||||
/// Tests can be run with either node or devtool (a Chrome-based utility with
|
||||
/// DOM APIs and developer tools support).
|
||||
///
|
||||
/// Install devtool via:
|
||||
/// > npm install -g devtool
|
||||
///
|
||||
/// Run via:
|
||||
/// > devtool tool/run.js -- corelib/apply2_test
|
||||
/// or
|
||||
/// > node tool/run.js corelib/apply2_test
|
||||
///
|
||||
/// See TODO below on async / unittest support.
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
if (args.length != 1) {
|
||||
throw new Error("Usage: node test/run.js <test-module-name>");
|
||||
throw new Error("Usage: devtool tool/run.js <test-module-name>");
|
||||
}
|
||||
var test = args[0];
|
||||
|
||||
|
@ -27,7 +41,13 @@ requirejs.config({
|
|||
|
||||
// TODO(vsm): Factor out test framework code in test/browser/language_tests.js
|
||||
// and use here. Async tests and unittests won't work without it.
|
||||
|
||||
var sdk = requirejs('dart_sdk');
|
||||
var module = requirejs(test);
|
||||
test = test.split('/').slice(-1)[0];
|
||||
module[test].main();
|
||||
var lib = test.split('/').slice(-1)[0];
|
||||
try {
|
||||
module[lib].main();
|
||||
console.log('Test ' + test + ' passed.');
|
||||
} catch (e) {
|
||||
console.log('Test ' + test + ' failed:\n' + e.toString());
|
||||
sdk.dart.stackPrint(e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue