* Delete unused stuff * rename 'path' to 'root' * accept 'includeEndsWith' as a plain text string so we often can avoid using regexp * accept 'subRoots' to filter to directories faster and more precisly than when using regexps in 'pattern' * make 'list' async instead of async* (no more yield stuff which we promptly turn into a list when actually using it) Note that some changes in testing.json is not 100% semantic-preserving, e.g. the "parser_all" suite previously had a pattern "/tests/.*\\.dart$" which was probably meant to include all dart files in the "tests" folder in the root, but in fact included all dart files in a "tests" folder anywhere. The updated version does not. Change-Id: Idd014274f86bf6214dee0753a7738ec80bc6a49e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358442 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
Testing of source maps
This folder contains two types of tests for validating sourcemaps: the debugging behavior and the stacktrace behavior.
Running the tests requires the compilation of the correct targets. DDC currently
also requires ddc_outline_unsound.dill inside
{sdkroot}/{out,xcodebuild}/{ReleaseX64,ReleaseARM64}/ddc_outline_unsound.dill.
Except for that, running them should simply be a matter of executing the *_suite.dart files.
All tests are plain Dart files and goes in "testfiles" (debugging tests) or "stacktrace_testfiles" (stacktrace tests). They are automatically picked up by the testing framework.
Debugging tests (step tests)
See README.md in pkg/sourcemap_testing.
Debugging a test
One can filter which tests are run by running (from the sourcemap folder):
dart sourcemaps_suite.dart -- sourcemaps/printing_class_fields
One can additionally get debug output for failing tests (i.e. tests with different outcome than expected), e.g.:
dart sourcemaps_suite.dart -Ddebug=true -- sourcemaps/printing_class_fields
The latter is also useful in combination with /*fail*/ when adding new tests to see all the places
where the debugger stopped (both in JS positions and translated to dart positions).
For instance -Ddebug=true -- sourcemaps/next_through_catch_test with a /*fail*/
currently gives output like the following:
Stop #1
test.main = function() { | main() {
try { | try {
let value = /*STOP*/"world"; | var value = /*STOP*/"world";
dart.throw(dart.str`Hello, ${value}`); | // Comment
} catch (e) { | throw "Hello, $value";
Stop #2
try { | var value = "world";
let value = "world"; | // Comment
/*STOP*/dart.throw(dart.str`Hello, ${value}`); | /*STOP*/throw "Hello, $value";
} catch (e) { | }
let st = dart.stackTrace(e); | // Comment
Stop #3
dart.throw(dart.str`Hello, ${value}`); | }
} catch (e) { | // Comment
let st = /*STOP*/dart.stackTrace(e); | catch (e, /*STOP*/st) {
{ | print(e);
core.print(e); | print(st);
[...]