diff --git a/pkg/front_end/test/fasta/fast_legacy_test.dart b/pkg/front_end/test/fasta/fast_legacy_test.dart new file mode 100644 index 00000000000..60eb33756a3 --- /dev/null +++ b/pkg/front_end/test/fasta/fast_legacy_test.dart @@ -0,0 +1,22 @@ +// Copyright (c) 2019, 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.md file. + +library fasta.test.fast_legacy_test; + +import 'dart:async' show Future; + +import 'dart:io' show Platform; + +import 'testing/suite.dart'; + +Future createContext( + Chain suite, Map environment) { + environment[ENABLE_FULL_COMPILE] = ""; + environment[LEGACY_MODE] = ""; + environment["skipVm"] = "true"; + return FastaContext.create(suite, environment); +} + +main([List arguments = const []]) => runMe(arguments, createContext, + "../../testing.json", Platform.script.resolve("legacy_test.dart")); diff --git a/pkg/front_end/test/fasta/fast_strong_test.dart b/pkg/front_end/test/fasta/fast_strong_test.dart new file mode 100644 index 00000000000..6c1464c42b3 --- /dev/null +++ b/pkg/front_end/test/fasta/fast_strong_test.dart @@ -0,0 +1,21 @@ +// Copyright (c) 2019, 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.md file. + +library fasta.test.fast_strong_test; + +import 'dart:async' show Future; + +import 'dart:io' show Platform; + +import 'testing/suite.dart'; + +Future createContext( + Chain suite, Map environment) { + environment[ENABLE_FULL_COMPILE] = ""; + environment["skipVm"] = "true"; + return FastaContext.create(suite, environment); +} + +main([List arguments = const []]) => runMe(arguments, createContext, + "../../testing.json", Platform.script.resolve("strong_test.dart")); diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart index 2934b9380f9..877a732c6d1 100644 --- a/pkg/front_end/test/fasta/testing/suite.dart +++ b/pkg/front_end/test/fasta/testing/suite.dart @@ -111,6 +111,8 @@ const String EXPECTATIONS = ''' const String KERNEL_TEXT_SERIALIZATION = " kernel text serialization "; +final Expectation runtimeError = ExpectationSet.Default["RuntimeError"]; + String generateExpectationName(bool legacyMode) { return legacyMode ? "legacy" : "strong"; } @@ -122,6 +124,7 @@ class FastaContext extends ChainContext { final bool legacyMode; final bool onlyCrashes; final bool enableSetLiterals; + final bool skipVm; final Map componentToTarget = {}; final Map componentToDiagnostics = @@ -143,7 +146,7 @@ class FastaContext extends ChainContext { bool ignoreExpectations, bool updateExpectations, bool updateComments, - bool skipVm, + this.skipVm, bool kernelTextSerialization, this.uriTranslator, bool fullCompile) @@ -167,7 +170,7 @@ class FastaContext extends ChainContext { if (kernelTextSerialization) { steps.add(const KernelTextSerialization()); } - if (fullCompile && !skipVm) { + if (fullCompile) { steps.add(const Transform()); if (!ignoreExpectations) { steps.add(new MatchExpectation( @@ -177,8 +180,10 @@ class FastaContext extends ChainContext { updateExpectations: updateExpectations)); } steps.add(const EnsureNoErrors()); - steps.add(const WriteDill()); - steps.add(const Run()); + if (!skipVm) { + steps.add(const WriteDill()); + steps.add(const Run()); + } } } @@ -211,6 +216,15 @@ class FastaContext extends ChainContext { return super.processTestResult(description, result, last); } + @override + Set processExpectedOutcomes(Set outcomes) { + if (skipVm && outcomes.length == 1 && outcomes.single == runtimeError) { + return new Set.from([Expectation.Pass]); + } else { + return outcomes; + } + } + static Future create( Chain suite, Map environment) async { Uri sdk = Uri.base.resolve("sdk/"); diff --git a/pkg/front_end/testcases/inference/future_then_explicit_future.dart.legacy.transformed.expect b/pkg/front_end/testcases/inference/future_then_explicit_future.dart.legacy.transformed.expect new file mode 100644 index 00000000000..3b31e56ea65 --- /dev/null +++ b/pkg/front_end/testcases/inference/future_then_explicit_future.dart.legacy.transformed.expect @@ -0,0 +1,15 @@ +library test; +import self as self; +import "dart:async" as asy; +import "dart:core" as core; + +static method m1() → dynamic { + asy::Future f; + dynamic x = f.then>>((dynamic x) → dynamic => []); + asy::Future> y = x; +} +static method m2() → dynamic { + asy::Future f; + dynamic x = f.then>((dynamic x) → dynamic => []); + asy::Future> y = x; +} diff --git a/pkg/front_end/testcases/legacy.status b/pkg/front_end/testcases/legacy.status index 50081d482ac..686bf31827c 100644 --- a/pkg/front_end/testcases/legacy.status +++ b/pkg/front_end/testcases/legacy.status @@ -19,7 +19,7 @@ incomplete_field_formal_parameter: Fail # Fasta doesn't recover well inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics inference/constructors_too_many_positional_arguments: Fail inference/downwards_inference_annotations_locals: Fail # Issue #30031 -inference/future_then_explicit_future: Fail +inference/future_then_explicit_future: RuntimeError inference/generic_methods_infer_js_builtin: RuntimeError # Test attempts to access platform-private library leading to NSM. inference/infer_assign_to_index: Fail inference/infer_assign_to_property: Fail @@ -49,7 +49,7 @@ rasta/bad_unicode: Fail rasta/breaking_bad: Fail rasta/class_hierarchy: Fail rasta/class_member: Fail -rasta/constant_get_and_invoke: Fail +rasta/constant_get_and_invoke: RuntimeError rasta/deferred_lib: Fail rasta/deferred_load: Fail rasta/duplicated_mixin: RuntimeError # Expected, this file has no main method. @@ -69,7 +69,7 @@ rasta/issue_000042: Fail rasta/issue_000043: Fail rasta/issue_000044: Fail rasta/issue_000045: Fail -rasta/issue_000046: Fail +rasta/issue_000046: RuntimeError rasta/issue_000047: Fail rasta/issue_000081: Fail rasta/malformed_const_constructor: Fail diff --git a/pkg/front_end/testcases/rasta/constant_get_and_invoke.dart.legacy.transformed.expect b/pkg/front_end/testcases/rasta/constant_get_and_invoke.dart.legacy.transformed.expect new file mode 100644 index 00000000000..eb9688ca261 --- /dev/null +++ b/pkg/front_end/testcases/rasta/constant_get_and_invoke.dart.legacy.transformed.expect @@ -0,0 +1,8 @@ +library; +import self as self; + +static const field dynamic c = 1; +static method main() → dynamic { + self::c; + self::c.call(); +} diff --git a/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.expect b/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.expect index 433743b9d5e..03e6bea7861 100644 --- a/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.expect +++ b/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.expect @@ -1,40 +1,23 @@ -// Formatted problems: -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:13: Error: Expected '(' after this. -// C c = new Object)(); -// ^^^^^^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected ';' after this. -// C c = new Object)(); -// ^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected a class member, but got ')'. -// C c = new Object)(); -// ^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:20: Error: Expected an identifier, but got '('. -// C c = new Object)(); -// ^ - -// Unhandled errors: -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:13: Error: Expected '(' after this. -// C c = new Object)(); -// ^^^^^^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected ';' after this. -// C c = new Object)(); -// ^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected a class member, but got ')'. -// C c = new Object)(); -// ^ -// -// pkg/front_end/testcases/rasta/issue_000046.dart:6:20: Error: Expected an identifier, but got '('. -// C c = new Object)(); -// ^ - library; +// +// Problems in library: +// +// pkg/front_end/testcases/rasta/issue_000046.dart:6:13: Error: Expected '(' after this. +// C c = new Object)(); +// ^^^^^^ +// +// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected ';' after this. +// C c = new Object)(); +// ^ +// +// pkg/front_end/testcases/rasta/issue_000046.dart:6:19: Error: Expected a class member, but got ')'. +// C c = new Object)(); +// ^ +// +// pkg/front_end/testcases/rasta/issue_000046.dart:6:20: Error: Expected an identifier, but got '('. +// C c = new Object)(); +// ^ +// import self as self; import "dart:core" as core; diff --git a/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.transformed.expect b/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.transformed.expect index f92e78d8f0a..03e6bea7861 100644 --- a/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.transformed.expect +++ b/pkg/front_end/testcases/rasta/issue_000046.dart.legacy.transformed.expect @@ -1,4 +1,6 @@ -// Unhandled errors: +library; +// +// Problems in library: // // pkg/front_end/testcases/rasta/issue_000046.dart:6:13: Error: Expected '(' after this. // C c = new Object)(); @@ -15,8 +17,7 @@ // pkg/front_end/testcases/rasta/issue_000046.dart:6:20: Error: Expected an identifier, but got '('. // C c = new Object)(); // ^ - -library; +// import self as self; import "dart:core" as core; diff --git a/pkg/pkg.status b/pkg/pkg.status index 47cc1657dc6..ac8e9e39cb1 100644 --- a/pkg/pkg.status +++ b/pkg/pkg.status @@ -31,6 +31,8 @@ dev_compiler/test/worker/*: Skip # test needs fixes front_end/test/fasta/analyze_test: Pass, Slow front_end/test/fasta/ast_builder_test: Pass, Slow front_end/test/fasta/bootstrap_test: Pass, Slow +front_end/test/fasta/fast_legacy_test: Pass, Slow +front_end/test/fasta/fast_strong_test: Pass, Slow front_end/test/fasta/legacy_test: Pass, ExtraSlow front_end/test/fasta/outline_test: Pass, Slow front_end/test/fasta/rasta/*: SkipByDesign # Anything in rasta is input to fasta unit tests and shouldn't be run as tests. diff --git a/pkg/testing/lib/src/chain.dart b/pkg/testing/lib/src/chain.dart index 53256aebfaa..1c0c748c2f6 100644 --- a/pkg/testing/lib/src/chain.dart +++ b/pkg/testing/lib/src/chain.dart @@ -138,8 +138,8 @@ abstract class ChainContext { !partialSelectors.any((s) => selector.startsWith(s))) { continue; } - final Set expectedOutcomes = - expectations.expectations(description.shortName); + final Set expectedOutcomes = processExpectedOutcomes( + expectations.expectations(description.shortName)); final StringBuffer sb = new StringBuffer(); final Step lastStep = steps.isNotEmpty ? steps.last : null; final Iterator iterator = steps.iterator; @@ -255,6 +255,10 @@ abstract class ChainContext { } } + Set processExpectedOutcomes(Set outcomes) { + return outcomes; + } + Result processTestResult( TestDescription description, Result result, bool last) { if (description is FileBasedTestDescription && diff --git a/pkg/testing/lib/src/run.dart b/pkg/testing/lib/src/run.dart index c93303af4a5..1d83c9b796c 100644 --- a/pkg/testing/lib/src/run.dart +++ b/pkg/testing/lib/src/run.dart @@ -53,16 +53,16 @@ Future computeTestRoot(String configurationPath, Uri base) { /// /// The optional argument [configurationPath] should be used when /// `testing.json` isn't located in the current working directory and is a path -/// relative to `Platform.script`. +/// relative to [me] which defaults to `Platform.script`. Future runMe(List arguments, CreateContext f, - [String configurationPath]) { + [String configurationPath, Uri me]) { + me ??= Platform.script; return withErrorHandling(() async { - TestRoot testRoot = - await computeTestRoot(configurationPath, Platform.script); + TestRoot testRoot = await computeTestRoot(configurationPath, me); CommandLine cl = CommandLine.parse(arguments); if (cl.verbose) enableVerboseOutput(); for (Chain suite in testRoot.toolChains) { - if (Platform.script == suite.source) { + if (me == suite.source) { print("Running suite ${suite.name}..."); ChainContext context = await f(suite, cl.environment); await context.run(suite, new Set.from(cl.selectors));