[dart2js] Move tests from tests/web that are failing on DDC configurations into dart2js specific folder.
Also update dart2jsOptions on some tests that are failing on production/O0 configurations. Change-Id: Ie0a8fa56dc391c98186f1573a76cff7ef6afde8d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433563 Reviewed-by: Mayank Patke <fishythefish@google.com>
This commit is contained in:
@@ -42,8 +42,9 @@ const Iterable<String> _allowedDartSchemePaths = [
|
||||
List<Pattern> _allowedNativeTestPatterns = [
|
||||
RegExp(r'(?<!generated_)tests/web/native'),
|
||||
RegExp(r'(?<!generated_)tests/web/internal'),
|
||||
RegExp(r'(?<!generated_)tests/web/dart2js'),
|
||||
'generated_tests/web/native/native_test',
|
||||
'generated_tests/web/internal/deferred_url_test',
|
||||
'generated_tests/web/dart2js/deferred_url_test',
|
||||
'pkg/front_end/testcases/dart2js/native',
|
||||
];
|
||||
|
||||
|
||||
@@ -1155,6 +1155,8 @@ class CompilerOptions implements DiagnosticOptions {
|
||||
environment['dart.web.assertions_enabled'] = '$enableUserAssertions';
|
||||
environment['dart.tool.dart2js'] = '${true}';
|
||||
environment['dart.tool.dart2js.minify'] = '$enableMinification';
|
||||
environment['dart.tool.dart2js.disable_rti_optimization'] =
|
||||
'$disableRtiOptimization';
|
||||
// Eventually pragmas and commandline flags should be aligned so that users
|
||||
// setting these flag is equivalent to setting the relevant pragmas
|
||||
// globally.
|
||||
|
||||
@@ -130,6 +130,15 @@ bool get checkedParameters =>
|
||||
bool get checkedImplicitDowncasts =>
|
||||
!const bool.fromEnvironment('dart.tool.dart2js.types:trust');
|
||||
|
||||
/// Whether RTI optimizations are disabled at compile time.
|
||||
///
|
||||
/// This can cause some type errors to present differently than they otherwise
|
||||
/// would. For example, when these optimizations are disabled ArgumentErrors may
|
||||
/// present as TypeErrors instead.
|
||||
bool get rtiOptimizationsDisabled =>
|
||||
const bool.fromEnvironment('dart.tool.dart2js.disable_rti_optimization',
|
||||
defaultValue: true);
|
||||
|
||||
/// Whether explicit casts are type checked at runtime.
|
||||
///
|
||||
/// An expression like `e as String` should perform a runtime check that the
|
||||
|
||||
@@ -2,7 +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.
|
||||
|
||||
// dart2jsOptions=--strong
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
|
||||
@@ -2,7 +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.
|
||||
|
||||
// dart2jsOptions=--strong
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
// Formatting can break multitests, so don't format them.
|
||||
// dart format off
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Test that dart2js does not rewrite conditional into logical operators
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Test that optimized '+' and slow path '+' produce the same error.
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
// Test that optimized codeUnitAt and slow path codeUnitAt produce the same
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
// Test that type checks give consistent errors for the same types. In minified
|
||||
// mode this checks that the minified class names are consistently tagged.
|
||||
|
||||
|
||||
+16
-3
@@ -5,6 +5,7 @@
|
||||
// dart2jsOptions=--no-minify
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
import "package:expect/variations.dart";
|
||||
|
||||
// Test for correct order of exceptions in code with checks that could be moved
|
||||
// merged from successors into a dominator.
|
||||
@@ -45,7 +46,11 @@ test1() {
|
||||
|
||||
gA = null;
|
||||
gB = 2;
|
||||
Expect.throws(call1, (e) => e is ArgumentError, 'foo1($gA, $gB) AE');
|
||||
Expect.throws(
|
||||
call1,
|
||||
(e) => rtiOptimizationsDisabled ? e is TypeError : e is ArgumentError,
|
||||
'foo1($gA, $gB) AE',
|
||||
);
|
||||
}
|
||||
|
||||
foo2a(a, b) {
|
||||
@@ -101,8 +106,16 @@ test2() {
|
||||
|
||||
gA = 1;
|
||||
gB = null;
|
||||
Expect.throws(call2a, (e) => e is ArgumentError, 'foo2($gA, $gB) AE');
|
||||
Expect.throws(call2b, (e) => e is ArgumentError, 'foo2($gA, $gB) AE');
|
||||
Expect.throws(
|
||||
call2a,
|
||||
(e) => rtiOptimizationsDisabled ? e is TypeError : e is ArgumentError,
|
||||
'foo2($gA, $gB) AE',
|
||||
);
|
||||
Expect.throws(
|
||||
call2b,
|
||||
(e) => rtiOptimizationsDisabled ? e is TypeError : e is ArgumentError,
|
||||
'foo2($gA, $gB) AE',
|
||||
);
|
||||
|
||||
gA = null;
|
||||
gB = 2;
|
||||
+1
-1
@@ -7,7 +7,7 @@ import 'package:expect/expect.dart';
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'deferred_class_library.dart' deferred as lib;
|
||||
import '../../deferred/deferred_class_library.dart' deferred as lib;
|
||||
|
||||
bool isError(e) => e is Error;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
import 'package:expect/async_helper.dart';
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
import 'deferred_function_library.dart' deferred as lib;
|
||||
import '../../deferred/deferred_function_library.dart' deferred as lib;
|
||||
|
||||
bool isError(e) => e is Error;
|
||||
|
||||
+5
-2
@@ -2,9 +2,10 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
import 'dart:_foreign_helper' show JS_GET_FLAG;
|
||||
|
||||
class Class<T> {
|
||||
@@ -17,7 +18,9 @@ main() {
|
||||
|
||||
var toString = '${local1.runtimeType}';
|
||||
if (!toString.contains('minified:')) {
|
||||
Expect.equals("Closure0Args", toString);
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
Expect.equals("Closure0Args", toString);
|
||||
}
|
||||
}
|
||||
print(toString);
|
||||
local2(0);
|
||||
+5
-2
@@ -2,9 +2,10 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
import 'dart:_foreign_helper' show JS_GET_FLAG;
|
||||
|
||||
class Class<T> {
|
||||
@@ -17,7 +18,9 @@ main() {
|
||||
|
||||
var toString = '${local1.runtimeType}';
|
||||
if (!toString.contains('minified:')) {
|
||||
Expect.equals("Closure", toString);
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
Expect.equals("Closure", toString);
|
||||
}
|
||||
}
|
||||
print(toString);
|
||||
local2(0);
|
||||
+4
-1
@@ -5,6 +5,7 @@
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
|
||||
class Class1<T> {
|
||||
Class1();
|
||||
@@ -18,6 +19,8 @@ class Class2<T> {
|
||||
|
||||
main() {
|
||||
Class1<int> cls1 = Class1<int>();
|
||||
Expect.equals("() => erased", cls1.method.runtimeType.toString());
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
Expect.equals("() => erased", cls1.method.runtimeType.toString());
|
||||
}
|
||||
Class2<int>();
|
||||
}
|
||||
+5
-2
@@ -5,6 +5,7 @@
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
import 'dart:_foreign_helper' show JS_GET_FLAG;
|
||||
|
||||
class Class<T> {
|
||||
@@ -18,8 +19,10 @@ test<Q>() {
|
||||
|
||||
var toString = '${local1.runtimeType}';
|
||||
if (!toString.contains('minified:')) {
|
||||
// `true` if non-minified.
|
||||
Expect.equals("Closure", toString);
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
// `true` if non-minified.
|
||||
Expect.equals("Closure", toString);
|
||||
}
|
||||
}
|
||||
print(toString);
|
||||
local2(0);
|
||||
+5
-2
@@ -2,9 +2,10 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
|
||||
main() {
|
||||
T id<T>(T t) => t;
|
||||
@@ -16,7 +17,9 @@ main() {
|
||||
// The type parameter is present since it is required because `==`
|
||||
// distinguishes instantiations of the same generic function with different
|
||||
// types.
|
||||
Expect.equals("Instantiation1<int>", toString);
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
Expect.equals("Instantiation1<int>", toString);
|
||||
}
|
||||
}
|
||||
print(toString);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) 2018, 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.
|
||||
|
||||
// dart2jsOptions=--omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
|
||||
class Class<T> {
|
||||
Class();
|
||||
}
|
||||
|
||||
main() {
|
||||
// Since the type argument of `Class` is only needed for
|
||||
// `.runtimeType.toString()`, it is not reified, and the toString is therefore
|
||||
// 'Class<erased>' (when dart2js RTI optimizations are enabled).
|
||||
String className = (Class).toString();
|
||||
className = className.substring(0, className.indexOf('<'));
|
||||
final defaultTypeToString = new Class().runtimeType.toString();
|
||||
final instantiatedToString = new Class<int>().runtimeType.toString();
|
||||
if (!rtiOptimizationsDisabled) {
|
||||
String erasedName = '$className<erased>';
|
||||
Expect.equals(erasedName, defaultTypeToString);
|
||||
Expect.equals(erasedName, instantiatedToString);
|
||||
} else {
|
||||
Expect.equals('$className<dynamic>', defaultTypeToString);
|
||||
Expect.equals('$className<int>', instantiatedToString);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import 'dart:_rti' as rti;
|
||||
import 'package:expect/expect.dart';
|
||||
import 'package:expect/variations.dart';
|
||||
|
||||
import 'subtype_utils.dart';
|
||||
import '../internal/rti/subtype_utils.dart';
|
||||
|
||||
final String objectName = JS_GET_NAME(JsGetName.OBJECT_CLASS_TYPE_NAME);
|
||||
final String futureName = JS_GET_NAME(JsGetName.FUTURE_CLASS_TYPE_NAME);
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class Foo {}
|
||||
|
||||
@@ -2,7 +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.
|
||||
|
||||
// dart2jsOptions=--strong
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
var field;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=--no-minify
|
||||
|
||||
import 'dart:_rti' as rti;
|
||||
import 'dart:_foreign_helper' show JS;
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
@pragma('dart2js:noInline')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class A {
|
||||
|
||||
@@ -2,7 +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.
|
||||
|
||||
// dart2jsOptions=--strong --no-minify
|
||||
// dart2jsOptions=-O1 --no-minify
|
||||
|
||||
// Test that Type.toString returns nice strings for native classes with
|
||||
// reserved names and for raw types.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2018, 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.
|
||||
|
||||
// dart2jsOptions=--strong --omit-implicit-checks --lax-runtime-type-to-string
|
||||
|
||||
import 'package:expect/expect.dart';
|
||||
|
||||
class Class<T> {
|
||||
Class();
|
||||
}
|
||||
|
||||
main() {
|
||||
// Since the type argument of `Class` is only needed for
|
||||
// `.runtimeType.toString()`, it is not reified, and the toString is therefore
|
||||
// 'Class<erased>'.
|
||||
String className = (Class).toString();
|
||||
className = className.substring(0, className.indexOf('<'));
|
||||
String erasedName = '$className<erased>';
|
||||
Expect.equals(erasedName, new Class().runtimeType.toString());
|
||||
Expect.equals(erasedName, new Class<int>().runtimeType.toString());
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
// 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.
|
||||
|
||||
// dart2jsOptions=-O1
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {
|
||||
|
||||
+15
-7
@@ -3,8 +3,7 @@
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
[ $compiler != dart2js ]
|
||||
internal/array_flags_errors_test: SkipByDesign # test specific for the dart2js runtime
|
||||
internal/deferred_url_test: SkipByDesign # test specific for the dart2js runtime
|
||||
dart2js/*: SkipByDesign # tests specific to dart2js
|
||||
|
||||
[ $compiler == dart2wasm ]
|
||||
(?!wasm)*: SkipByDesign
|
||||
@@ -19,6 +18,9 @@ native/*: Skip # dart2js tests for native keyword
|
||||
wasm_js_shared/weak_reference_polyfill_test: SkipByDesign # Test specific for the dart2js/dart2wasm runtime
|
||||
|
||||
[ $runtime == d8 ]
|
||||
dart2js/deferred_with_cross_origin_test: SkipByDesign # Requires dom
|
||||
dart2js/deferred_with_csp_nonce2_test: SkipByDesign # Requires dom
|
||||
dart2js/deferred_with_csp_nonce_test: SkipByDesign # Requires dom
|
||||
internal/html_mocks_with_static_interop_test: SkipByDesign # Browser test
|
||||
internal/object_members_test: SkipByDesign # Browser test
|
||||
|
||||
@@ -41,21 +43,27 @@ deferred_split_test: Slow, Pass # Issue 25940
|
||||
consistent_index_error_string_test: Slow, Pass # Issue 25940
|
||||
|
||||
[ $compiler == dart2js && $csp ]
|
||||
deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loading.
|
||||
dart2js/deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loading.
|
||||
internal/40296_test: SkipByDesign # Uses eval
|
||||
internal/deferred/deferred_custom_loader: SkipByDesign # Uses eval
|
||||
internal/deferred/load_in_correct_order_test: SkipByDesign # Uses eval
|
||||
internal/deferred/load_multiple_in_correct_order_test: SkipByDesign # Uses eval
|
||||
internal/deferred/load_with_priority_test: SkipByDesign # Uses eval
|
||||
internal/object_members_test: SkipByDesign # Uses eval for interop
|
||||
internal/rti/js_interop_subtype_test: SkipByDesign # Uses eval
|
||||
js_interop_generic_cast_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
|
||||
js_interop_non_null_asserts_disabled_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
|
||||
js_interop_non_null_asserts_enabled_test: SkipByDesign # Issue 42085. CSP policy disallows injected JS code
|
||||
js_interop_optional_arg_test: SkipByDesign # Uses eval
|
||||
js_interop_test: SkipByDesign # Uses eval
|
||||
regress/issue/40152a_test: SkipByDesign # Uses eval
|
||||
regress/issue/49129_test: SkipByDesign # Uses eval for interop
|
||||
|
||||
[ $compiler == dart2js && !$host_asserts ]
|
||||
deferred/many_parts/many_parts_test: Slow, Pass # Large stress test by design
|
||||
|
||||
[ $compiler == dart2js && $minified ]
|
||||
code_motion_exception_test: Skip # Requires unminified operator names.
|
||||
|
||||
[ $compiler == dart2js && ($runtime == ff || $runtime == jsshell || $runtime == safari) ]
|
||||
code_motion_exception_test: Skip # Required V8 specific format of JavaScript errors.
|
||||
dart2js/code_motion_exception_test: Skip # Required V8 specific format of JavaScript errors.
|
||||
|
||||
[ $compiler == dart2wasm && $runtime != d8 ]
|
||||
wasm/source_map_simple_optimized_test: SkipByDesign # Reads source map file using d8's readbuffer
|
||||
|
||||
Reference in New Issue
Block a user