Skip to content
Permalink
Browse files

[dart2js] Add support for BabelJS to test.py

This adds support for BabelJS to test.py's dart2js compiler
configuration. When --babel is specified directly or through a named
configuration, test.py will run an additional step after dart2js that
post-processes the javascript output by running it through BabelJS with
the specified Babel configuration. BabelJS is added to the DEPS in its
standalone form. d8 is used to run BabelJS standalone to avoid adding
a dependency on NodeJS. d8 can only write to stdout but not to files or
stderr, which makes it necessary to change the test_runner to handle
commands that expect their output to be piped to a file.

Changes:
* Add --babel option to test.py.
* Add babel option to pkg/smith.
* Switch IE11 builder to use babel transformation.
* Fix option list comparison bugs in pkg/smith.
* Change dart2js compiler configuration to generate files using the
  test name rather than just "out.js" (update test that relied on this).
* Remove runtime_configuration dependency on test_suite.
* Remove obsolete blocks adding --preview-dart-2 dart2js arguments.
* Make dart2js' compiler configuration more like DDC's.
* Remove createCommand method that is no longer used.
* Remove support for "OtherResources" which was only used for
  dart:isolate tests on dart2js and DDC.
* Skip co19_2 tests that are slow to transform with babel.
* Simplify the timeout handling in the test runner with Future.timeout.

Change-Id: I32e4917b2a57ecbe684538e40d744f0101c552a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/90402
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
  • Loading branch information...
athomas authored and commit-bot@chromium.org committed May 29, 2019
1 parent b1d3a21 commit 182d55dfda5b8d7c9919b747ccb703c684100c67
Showing with 364 additions and 434 deletions.
  1. +7 −3 DEPS
  2. +35 −21 pkg/smith/lib/configuration.dart
  3. +11 −0 tests/co19_2/co19_2-dart2js.status
  4. +1 −1 tests/compiler/dart2js_native/compute_this_script_test.dart
  5. +0 −37 tests/lib_2/html/async_spawnuri_test.dart
  6. +0 −5 tests/lib_2/isolate/browser/issue_12474_test.dart
  7. +0 −2 tests/lib_2/isolate/error_at_spawnuri_test.dart
  8. +0 −2 tests/lib_2/isolate/error_exit_at_spawnuri_test.dart
  9. +0 −2 tests/lib_2/isolate/exit_at_spawnuri_test.dart
  10. +0 −6 tests/lib_2/isolate/issue_21398_parent_isolate1_test.dart
  11. +0 −5 tests/lib_2/isolate/issue_21398_parent_isolate2_test.dart
  12. +0 −5 tests/lib_2/isolate/issue_21398_parent_isolate_test.dart
  13. +0 −6 tests/lib_2/isolate/issue_24243_parent_isolate_test.dart
  14. +0 −3 tests/lib_2/isolate/spawn_uri_multi_test.dart
  15. +0 −3 tests/lib_2/isolate/spawn_uri_nested_vm_test.dart
  16. +0 −3 tests/lib_2/isolate/spawn_uri_test.dart
  17. +0 −3 tests/lib_2/isolate/spawn_uri_vm_test.dart
  18. +0 −3 tests/lib_2/lib_2_dart2js.status
  19. +0 −1 tests/lib_2/lib_2_dartdevc.status
  20. +29 −0 third_party/babel/update.sh
  21. +7 −1 tools/bots/test_matrix.json
  22. +12 −0 tools/testing/dart/babel_transform.js
  23. +10 −9 tools/testing/dart/command.dart
  24. +38 −23 tools/testing/dart/compiler_configuration.dart
  25. +19 −12 tools/testing/dart/configuration.dart
  26. +9 −3 tools/testing/dart/options.dart
  27. +77 −25 tools/testing/dart/runtime_configuration.dart
  28. +88 −71 tools/testing/dart/test_runner.dart
  29. +21 −179 tools/testing/dart/test_suite.dart
10 DEPS
@@ -168,19 +168,23 @@ deps = {
}],
"dep_type": "cipd",
},

Var("dart_root") + "/tests/co19_2/src": {
"packages": [{
"package": "dart/third_party/co19",
"version": "git_revision:" + Var("co19_2_rev"),
}],
"dep_type": "cipd",
},

Var("dart_root") + "/third_party/markupsafe":
Var("chromium_git") + "/chromium/src/third_party/markupsafe.git" +
"@" + Var("markupsafe_rev"),

Var("dart_root") + "/third_party/babel": {
"packages": [{
"package": "dart/third_party/babel",
"version": "version:7.4.5",
}],
"dep_type": "cipd",
},
Var("dart_root") + "/third_party/zlib":
Var("chromium_git") + "/chromium/src/third_party/zlib.git" +
"@" + Var("zlib_rev"),
@@ -8,7 +8,7 @@ import 'dart:io';
// - "windows" -> "win".
// - "macos" -> "mac".
// - toString() on enum classes is just name.
// - builderTag defaults to empty string, not null.
// - builderTag and babel default to empty string, not null.
// Need to migrate test.dart to not expect the above before it can use this.

// READ ME! If you add a new field to this, make sure to add it to
@@ -247,6 +247,7 @@ class Configuration {

var configuration = Configuration(
name, architecture, compiler, mode, runtime, system,
babel: stringOption("babel"),
builderTag: stringOption("builder-tag"),
vmOptions: stringListOption("vm-options"),
dart2jsOptions: stringListOption("dart2js-options"),
@@ -285,13 +286,15 @@ class Configuration {

final System system;

final String babel;

final String builderTag;

final List<String> vmOptions;

final List<String> dart2jsOptions;

int timeout;
final int timeout;

final bool enableAsserts;

@@ -323,7 +326,8 @@ class Configuration {

Configuration(this.name, this.architecture, this.compiler, this.mode,
this.runtime, this.system,
{String builderTag,
{String babel,
String builderTag,
List<String> vmOptions,
List<String> dart2jsOptions,
int timeout,
@@ -340,10 +344,11 @@ class Configuration {
bool useHotReload,
bool useHotReloadRollback,
bool useSdk})
: builderTag = builderTag ?? "",
: babel = babel ?? "",
builderTag = builderTag ?? "",
vmOptions = vmOptions ?? <String>[],
dart2jsOptions = dart2jsOptions ?? <String>[],
timeout = timeout,
timeout = timeout ?? -1,
enableAsserts = enableAsserts ?? false,
isChecked = isChecked ?? false,
isCsp = isCsp ?? false,
@@ -366,6 +371,7 @@ class Configuration {
mode == other.mode &&
runtime == other.runtime &&
system == other.system &&
babel == other.babel &&
builderTag == other.builderTag &&
vmOptions.join(" & ") == other.vmOptions.join(" & ") &&
dart2jsOptions.join(" & ") == other.dart2jsOptions.join(" & ") &&
@@ -397,6 +403,7 @@ class Configuration {
mode.hashCode ^
runtime.hashCode ^
system.hashCode ^
babel.hashCode ^
builderTag.hashCode ^
vmOptions.join(" & ").hashCode ^
dart2jsOptions.join(" & ").hashCode ^
@@ -429,11 +436,13 @@ class Configuration {
fields.add("runtime: $runtime");
fields.add("system: $system");

if (builderTag != "") fields.add("builder-tag: $builderTag");
if (vmOptions != "") fields.add("vm-options: [${vmOptions.join(", ")}]");
if (dart2jsOptions != "")
if (babel.isNotEmpty) fields.add("babel: $babel");
if (builderTag.isNotEmpty) fields.add("builder-tag: $builderTag");
if (vmOptions.isNotEmpty)
fields.add("vm-options: [${vmOptions.join(", ")}]");
if (dart2jsOptions.isNotEmpty)
fields.add("dart2js-options: [${dart2jsOptions.join(", ")}]");
if (timeout != 0) fields.add("timeout: $timeout");
if (timeout > 0) fields.add("timeout: $timeout");
if (enableAsserts) fields.add("enable-asserts");
if (isChecked) fields.add("checked");
if (isCsp) fields.add("csp");
@@ -464,20 +473,25 @@ class Configuration {
fields.add("runtime: $runtime ${other.runtime}");
fields.add("system: $system ${other.system}");

if (builderTag != "" || other.builderTag != "") {
var tag = builderTag == "" ? "(none)" : builderTag;
var otherTag = other.builderTag == "" ? "(none)" : other.builderTag;
fields.add("builder-tag: $tag $otherTag");
if (babel.isNotEmpty || other.babel.isNotEmpty) {
var ours = babel == "" ? "(none)" : babel;
var theirs = other.babel == "" ? "(none)" : other.babel;
fields.add("babel: $ours $theirs");
}
if (builderTag.isNotEmpty || other.builderTag.isNotEmpty) {
var ours = builderTag == "" ? "(none)" : builderTag;
var theirs = other.builderTag == "" ? "(none)" : other.builderTag;
fields.add("builder-tag: $ours $theirs");
}
if (vmOptions != "" || other.vmOptions != "") {
var tag = "[${vmOptions.join(", ")}]";
var otherTag = "[${other.vmOptions.join(", ")}]";
fields.add("vm-options: $tag $otherTag");
if (vmOptions.isNotEmpty || other.vmOptions.isNotEmpty) {
var ours = "[${vmOptions.join(", ")}]";
var theirs = "[${other.vmOptions.join(", ")}]";
fields.add("vm-options: $ours $theirs");
}
if (dart2jsOptions != "" || other.dart2jsOptions != "") {
var tag = "[${dart2jsOptions.join(", ")}]";
var otherTag = "[${other.dart2jsOptions.join(", ")}]";
fields.add("dart2js-options: $tag $otherTag");
if (dart2jsOptions.isNotEmpty || other.dart2jsOptions.isNotEmpty) {
var ours = "[${dart2jsOptions.join(", ")}]";
var theirs = "[${other.dart2jsOptions.join(", ")}]";
fields.add("dart2js-options: $ours $theirs");
}
fields.add("timeout: $timeout ${other.timeout}");
if (enableAsserts || other.enableAsserts) {
@@ -10,6 +10,17 @@ LayoutTests/*: SkipByDesign # d8 is not a browser
LibTest/html/*: SkipByDesign # d8 is not a browser
WebPlatformTest/*: SkipByDesign # d8 is not a browser

[ $compiler == dart2js && $runtime == ie11 ]
LibTest/collection/ListBase/ListBase_class_A01_t04: SkipSlow # slow babeljs transformation
LibTest/collection/ListBase/ListBase_class_A01_t05: SkipSlow # slow babeljs transformation
LibTest/collection/ListBase/ListBase_class_A01_t06: SkipSlow # slow babeljs transformation
LibTest/collection/ListMixin/ListMixin_class_A01_t04: SkipSlow # slow babeljs transformation
LibTest/collection/ListMixin/ListMixin_class_A01_t05: SkipSlow # slow babeljs transformation
LibTest/collection/ListMixin/ListMixin_class_A01_t06: SkipSlow # slow babeljs transformation
LibTest/core/List/List_class_A01_t04: SkipSlow # slow babeljs transformation
LibTest/core/List/List_class_A01_t05: SkipSlow # slow babeljs transformation
LibTest/core/List/List_class_A01_t06: SkipSlow # slow babeljs transformation

[ $compiler == dart2js || $compiler == dartdevc || $compiler == dartdevk ]
Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
LibTest/io/*: SkipByDesign # dart:io not supported.
@@ -10,7 +10,7 @@ main() {
// This is somewhat brittle and relies on an implementation detail
// of our test runner, but I can think of no other way to test this.
// -- ahe
if (!thisScript.endsWith('/out.js')) {
if (!thisScript.endsWith('/compute_this_script_test.js')) {
throw 'Unexpected script: "$thisScript"';
}
}

This file was deleted.

@@ -2,11 +2,6 @@
// 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.

// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=issue_12474_child.dart
// OtherScripts=package/issue_12474_lib.dart

import 'dart:isolate';

final SPAWN_PACKAGE_ROOT = Uri.parse(".");
@@ -1,8 +1,6 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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.
//
// OtherScripts=error_at_spawnuri_iso.dart

library error_at_spawnuri;

@@ -1,8 +1,6 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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.
//
// OtherScripts=error_exit_at_spawning_shared.dart

library error_exit_at_spawnuri;

@@ -1,8 +1,6 @@
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// 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.
//
// OtherScripts=exit_at_spawnuri_iso.dart

library exit_at_spawn;

@@ -2,13 +2,7 @@
// 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.

// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=issue_21398_child_isolate1.dart
// OtherScripts=issue_21398_child_isolate11.dart

import 'dart:isolate';
import 'dart:async';
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';

@@ -2,12 +2,7 @@
// 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.

// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=deferred_loaded_lib.dart

import 'dart:isolate';
import 'dart:async';
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';

@@ -2,12 +2,7 @@
// 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.

// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=issue_21398_child_isolate.dart

import 'dart:isolate';
import 'dart:async';
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';

@@ -2,12 +2,6 @@
// 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.

// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=issue_24243_child1_isolate.dart
// OtherScripts=issue_24243_child2_isolate.dart
// OtherScripts=issue_24243_child3_isolate.dart

import 'dart:collection';
import 'dart:isolate';

@@ -3,9 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

// Negative test to make sure that we are reaching all assertions.
// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=spawn_uri_child_isolate.dart
library spawn_tests;

import 'dart:isolate';
@@ -3,9 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

// Example of nested spawning of isolates from a URI
// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=spawn_uri_nested_child1_vm_isolate.dart spawn_uri_nested_child2_vm_isolate.dart
library NestedSpawnUriLibrary;

import 'dart:isolate';
@@ -3,9 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

// Example of spawning an isolate from a URI
// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=spawn_uri_child_isolate.dart
library spawn_tests;

import 'dart:isolate';
@@ -3,9 +3,6 @@
// BSD-style license that can be found in the LICENSE file.

// Example of spawning an isolate from a URI
// Note: the following comment is used by test.dart to additionally compile the
// other isolate's code.
// OtherScripts=spawn_uri_child_isolate.dart
library spawn_tests;

import 'dart:isolate';
@@ -10,7 +10,6 @@ collection/list_test: RuntimeError
convert/chunked_conversion_utf88_test: Slow
convert/utf85_test: Slow
developer/timeline_test: Skip # Not supported
html/async_spawnuri_test: SkipByDesign
html/async_test: SkipByDesign
html/custom/document_register_basic_test: Slow
html/custom/document_register_type_extensions_test/construction: Slow
@@ -82,7 +81,6 @@ typed_data/setRange_3_test: RuntimeError # TODO(dart2js-team): Please triage thi

[ $compiler == dart2js && $runtime == d8 ]
async/dart2js_uncaught_error_test: RuntimeError
html/async_spawnuri_test: RuntimeError
html/async_test: RuntimeError
html/audiobuffersourcenode_test: RuntimeError
html/audiocontext_test: RuntimeError
@@ -494,7 +492,6 @@ html/mirrors_js_typed_interop_test: SkipByDesign
html/postmessage_structured_test: SkipByDesign

[ $compiler == dart2js && !$csp && $minified ]
html/async_spawnuri_test: RuntimeError
html/async_test: RuntimeError
html/audiobuffersourcenode_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
html/audiocontext_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
@@ -41,7 +41,6 @@ convert/json_utf8_chunk_test: Slow, Pass
convert/streamed_conversion_json_utf8_encode_test: Pass, Timeout # Issue 29922
convert/streamed_conversion_utf8_decode_test: Slow, Pass, Timeout # Issue 29922
convert/utf85_test: Slow, Pass
html/async_spawnuri_test: RuntimeError # Issue 29922
html/async_test: RuntimeError # Issue 29922
html/callback_list_test: Skip # Test requires user interaction to accept permissions.
html/custom/attribute_changed_callback_test: Skip # Issue 31577

0 comments on commit 182d55d

Please sign in to comment.
You can’t perform that action at this time.