From 14097a1aba5b3b7b2342ff6219aba0a81ae30af8 Mon Sep 17 00:00:00 2001 From: Johnni Winther Date: Thu, 14 Nov 2024 07:32:21 +0000 Subject: [PATCH] [cfe] Move suites from test/fasta/ to test/ Change-Id: Ida60cd9bc95c783df6e3a7819560b3836660c10f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394486 Reviewed-by: Jens Johansen --- pkg/front_end/presubmit_helper_spawn.dart | 2 +- .../test/async_but_no_await_git_test.dart | 21 +------- pkg/front_end/test/binary_md_git_test.dart | 2 +- pkg/front_end/test/coverage_suite.dart | 2 +- pkg/front_end/test/dartdoctest_suite.dart | 6 +-- pkg/front_end/test/desugar_test.dart | 3 +- .../test/{fasta => }/expression_suite.dart | 9 ++-- pkg/front_end/test/hot_reload_e2e_test.dart | 3 +- .../test/incremental_bulk_compiler_full.dart | 4 +- ...incremental_bulk_compiler_smoke_suite.dart | 6 +-- .../incremental_dartino_suite.dart | 3 +- .../{fasta => }/incremental_expectations.dart | 0 .../{fasta => }/incremental_source_files.dart | 0 pkg/front_end/test/incremental_suite.dart | 2 +- pkg/front_end/test/isolates_v_processes.dart | 2 +- pkg/front_end/test/lint_suite.dart | 6 +-- .../declaration/macro_declaration_test.dart | 19 +++---- .../test/{fasta => }/messages_suite.dart | 9 ++-- .../test/{fasta => }/modular_suite.dart | 7 +-- .../test/outline_extractor_suite.dart | 7 ++- .../test/{fasta => }/outline_suite.dart | 7 +-- pkg/front_end/test/parser_all_suite.dart | 6 +-- .../test/parser_equivalence_suite.dart | 6 +-- pkg/front_end/test/parser_suite.dart | 8 +-- pkg/front_end/test/spelling_test_base.dart | 8 +-- .../test/spelling_test_external_targets.dart | 6 +-- .../test/spelling_test_not_src_suite.dart | 7 +-- .../test/spelling_test_src_suite.dart | 7 +-- .../test/{fasta => }/strong_suite.dart | 7 +-- pkg/front_end/test/testing_utils.dart | 41 +++++++++++++- .../{fasta => }/textual_outline_suite.dart | 9 ++-- pkg/front_end/test/tool/reload.dart | 6 +-- pkg/front_end/test/unit_test_suites.dart | 54 +++++++++---------- .../test/unreachable_if_finder_git_test.dart | 21 +------- .../test/{fasta => utils}/suite_utils.dart | 4 +- .../test/vm_service_for_leak_smoke_test.dart | 2 +- .../test/{fasta => }/weak_suite.dart | 7 +-- pkg/front_end/test/web_parser_git_test.dart | 2 +- pkg/front_end/testing.json | 18 +++---- 39 files changed, 177 insertions(+), 162 deletions(-) rename pkg/front_end/test/{fasta => }/expression_suite.dart (99%) rename pkg/front_end/test/{fasta => }/incremental_dartino_suite.dart (99%) rename pkg/front_end/test/{fasta => }/incremental_expectations.dart (100%) rename pkg/front_end/test/{fasta => }/incremental_source_files.dart (100%) rename pkg/front_end/test/{fasta => }/messages_suite.dart (99%) rename pkg/front_end/test/{fasta => }/modular_suite.dart (81%) rename pkg/front_end/test/{fasta => }/outline_suite.dart (79%) rename pkg/front_end/test/{fasta => }/strong_suite.dart (82%) rename pkg/front_end/test/{fasta => }/textual_outline_suite.dart (97%) rename pkg/front_end/test/{fasta => utils}/suite_utils.dart (98%) rename pkg/front_end/test/{fasta => }/weak_suite.dart (81%) diff --git a/pkg/front_end/presubmit_helper_spawn.dart b/pkg/front_end/presubmit_helper_spawn.dart index fd0b01cce6a2..30f38d9a0745 100644 --- a/pkg/front_end/presubmit_helper_spawn.dart +++ b/pkg/front_end/presubmit_helper_spawn.dart @@ -12,7 +12,7 @@ import 'package:testing/testing.dart' as testing; import 'presubmit_helper.dart'; import 'test/deps_git_test.dart' as deps_test; import 'test/compile_and_lint_impl.dart' show runCompileAndLintTest; -import 'test/fasta/messages_suite.dart' as messages_suite; +import 'test/messages_suite.dart' as messages_suite; import 'test/lint_suite.dart' as lint_suite; import 'test/spelling_test_not_src_suite.dart' as spelling_test_not_src; import 'test/spelling_test_src_suite.dart' as spelling_test_src; diff --git a/pkg/front_end/test/async_but_no_await_git_test.dart b/pkg/front_end/test/async_but_no_await_git_test.dart index 829dd5749bef..6d3118e81906 100644 --- a/pkg/front_end/test/async_but_no_await_git_test.dart +++ b/pkg/front_end/test/async_but_no_await_git_test.dart @@ -21,13 +21,11 @@ import 'package:kernel/target/changed_structure_notifier.dart'; import 'package:kernel/target/targets.dart'; import "package:vm/modular/target/vm.dart" show VmTarget; -import 'testing_utils.dart' show getGitFiles; +import 'testing_utils.dart' show computeSourceFiles; import "utils/io_utils.dart"; final Uri repoDir = computeRepoDirUri(); -Set libUris = {}; - Future main(List args) async { api.CompilerOptions compilerOptions = getOptions(); @@ -39,22 +37,7 @@ Future main(List args) async { ProcessedOptions options = new ProcessedOptions(options: compilerOptions); - libUris.add(repoDir.resolve("pkg/front_end/lib/")); - libUris.add(repoDir.resolve("pkg/front_end/test/fasta/")); - libUris.add(repoDir.resolve("pkg/front_end/tool/")); - - for (Uri uri in libUris) { - Set gitFiles = await getGitFiles(uri); - List entities = - new Directory.fromUri(uri).listSync(recursive: true); - for (FileSystemEntity entity in entities) { - if (entity is File && - entity.path.endsWith(".dart") && - gitFiles.contains(entity.uri)) { - options.inputs.add(entity.uri); - } - } - } + options.inputs.addAll(await computeSourceFiles(repoDir)); Stopwatch stopwatch = new Stopwatch()..start(); diff --git a/pkg/front_end/test/binary_md_git_test.dart b/pkg/front_end/test/binary_md_git_test.dart index 632b0056e0c1..cb07dfd4608d 100644 --- a/pkg/front_end/test/binary_md_git_test.dart +++ b/pkg/front_end/test/binary_md_git_test.dart @@ -7,7 +7,7 @@ import 'dart:io' show File; import 'binary_md_dill_reader.dart' show BinaryMdDillReader; import 'utils/io_utils.dart' show computeRepoDir; -Future main() async { +void main() { File binaryMd = new File("$repoDir/pkg/kernel/binary.md"); String binaryMdContent = binaryMd.readAsStringSync(); diff --git a/pkg/front_end/test/coverage_suite.dart b/pkg/front_end/test/coverage_suite.dart index fe0f726670cd..d6343f23a54c 100644 --- a/pkg/front_end/test/coverage_suite.dart +++ b/pkg/front_end/test/coverage_suite.dart @@ -50,7 +50,7 @@ Future _run(Directory coverageTmpDir, List arguments) async { futures.add(Process.run(Platform.resolvedExecutable, [ "--enable-asserts", "--deterministic", - "pkg/front_end/test/fasta/strong_suite.dart", + "pkg/front_end/test/strong_suite.dart", "-DskipVm=true", "--shards=${options.numberOfWorkers}", "--shard=${i + 1}", diff --git a/pkg/front_end/test/dartdoctest_suite.dart b/pkg/front_end/test/dartdoctest_suite.dart index b6ba86f37383..cb877b128645 100644 --- a/pkg/front_end/test/dartdoctest_suite.dart +++ b/pkg/front_end/test/dartdoctest_suite.dart @@ -6,7 +6,7 @@ import 'package:testing/testing.dart' show Chain, ChainContext, Result, Step, TestDescription; import '../tool/dart_doctest_impl.dart'; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; void main([List arguments = const []]) => internalMain(createContext, arguments: arguments, @@ -14,8 +14,8 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { - return new Context(suite.name); + Chain suite, Map environment) { + return new Future.value(new Context(suite.name)); } class Context extends ChainContext { diff --git a/pkg/front_end/test/desugar_test.dart b/pkg/front_end/test/desugar_test.dart index 00a7d3ff6f7e..6097d749e3de 100644 --- a/pkg/front_end/test/desugar_test.dart +++ b/pkg/front_end/test/desugar_test.dart @@ -45,13 +45,14 @@ Future testRedirectingFactorySerialized() async { // regression test: redirecting factories from patch files don't have the // redirecting-factory flag stored in kernel. -Future testRedirectingFactoryPatchFile() async { +Future testRedirectingFactoryPatchFile() { var componentUri = computePlatformBinariesLocation().resolve('dart2js_platform.dill'); var component = new ir.Component(); new BinaryBuilder(new File.fromUri(componentUri).readAsBytesSync()) .readComponent(component); checkIsRedirectingFactory(component, 'collection', 'HashMap', 'identity'); + return new Future.value(); } void checkIsRedirectingFactory(ir.Component component, String uriPath, diff --git a/pkg/front_end/test/fasta/expression_suite.dart b/pkg/front_end/test/expression_suite.dart similarity index 99% rename from pkg/front_end/test/fasta/expression_suite.dart rename to pkg/front_end/test/expression_suite.dart index 26b1c0a07dd5..bc4cbed62926 100644 --- a/pkg/front_end/test/fasta/expression_suite.dart +++ b/pkg/front_end/test/expression_suite.dart @@ -51,10 +51,10 @@ import "package:testing/testing.dart" import 'package:vm/modular/target/vm.dart' show VmTarget; import "package:yaml/yaml.dart" show YamlMap, YamlList, loadYamlNode; -import '../testing_utils.dart' show checkEnvironment; -import '../utils/kernel_chain.dart' show runDiff, openWrite; -import 'suite_utils.dart'; -import '../testing/environment_keys.dart'; +import 'testing_utils.dart' show checkEnvironment; +import 'utils/kernel_chain.dart' show runDiff, openWrite; +import 'utils/suite_utils.dart'; +import 'testing/environment_keys.dart'; class Context extends ChainContext { final CompilerContext compilerContext; @@ -740,4 +740,5 @@ void main([List arguments = const []]) => internalMain( createContext, arguments: arguments, displayName: "expression suite", + configurationPath: "../testing.json", ); diff --git a/pkg/front_end/test/hot_reload_e2e_test.dart b/pkg/front_end/test/hot_reload_e2e_test.dart index f9d61d190a24..935d1f61249b 100644 --- a/pkg/front_end/test/hot_reload_e2e_test.dart +++ b/pkg/front_end/test/hot_reload_e2e_test.dart @@ -69,9 +69,10 @@ abstract class TestCase { await rebuild(compiler, outputUri); // this is a full compile. } - Future tearDown() async { + Future tearDown() { outDir.deleteSync(recursive: true); lines = const []; + return new Future.value(); } Future computeVmPort() async { diff --git a/pkg/front_end/test/incremental_bulk_compiler_full.dart b/pkg/front_end/test/incremental_bulk_compiler_full.dart index a51a9b40a9dc..f9f81ef7dcb5 100644 --- a/pkg/front_end/test/incremental_bulk_compiler_full.dart +++ b/pkg/front_end/test/incremental_bulk_compiler_full.dart @@ -21,8 +21,8 @@ void main([List arguments = const []]) => runMe(arguments, createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { - return new Context(); + Chain suite, Map environment) { + return new Future.value(new Context()); } class Context extends ChainContext { diff --git a/pkg/front_end/test/incremental_bulk_compiler_smoke_suite.dart b/pkg/front_end/test/incremental_bulk_compiler_smoke_suite.dart index e348261ea505..16d20e085f41 100644 --- a/pkg/front_end/test/incremental_bulk_compiler_smoke_suite.dart +++ b/pkg/front_end/test/incremental_bulk_compiler_smoke_suite.dart @@ -4,7 +4,7 @@ import 'package:testing/testing.dart' show Chain; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'incremental_bulk_compiler_full.dart' show Context; void main([List arguments = const []]) => internalMain(createContext, @@ -13,6 +13,6 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { - return new Context(); + Chain suite, Map environment) { + return new Future.value(new Context()); } diff --git a/pkg/front_end/test/fasta/incremental_dartino_suite.dart b/pkg/front_end/test/incremental_dartino_suite.dart similarity index 99% rename from pkg/front_end/test/fasta/incremental_dartino_suite.dart rename to pkg/front_end/test/incremental_dartino_suite.dart index 97c13ffd1582..9968702ad646 100644 --- a/pkg/front_end/test/fasta/incremental_dartino_suite.dart +++ b/pkg/front_end/test/incremental_dartino_suite.dart @@ -33,7 +33,7 @@ import "package:yaml/yaml.dart" show YamlMap, loadYamlNode; import "incremental_expectations.dart" show IncrementalExpectation, extractJsonExpectations; import "incremental_source_files.dart" show expandDiff, expandUpdates; -import "suite_utils.dart"; +import "utils/suite_utils.dart"; const JsonEncoder json = const JsonEncoder.withIndent(" "); @@ -234,4 +234,5 @@ void main([List arguments = const []]) => internalMain( createContext, arguments: arguments, displayName: "incremental dartino suite", + configurationPath: "../testing.json", ); diff --git a/pkg/front_end/test/fasta/incremental_expectations.dart b/pkg/front_end/test/incremental_expectations.dart similarity index 100% rename from pkg/front_end/test/fasta/incremental_expectations.dart rename to pkg/front_end/test/incremental_expectations.dart diff --git a/pkg/front_end/test/fasta/incremental_source_files.dart b/pkg/front_end/test/incremental_source_files.dart similarity index 100% rename from pkg/front_end/test/fasta/incremental_source_files.dart rename to pkg/front_end/test/incremental_source_files.dart diff --git a/pkg/front_end/test/incremental_suite.dart b/pkg/front_end/test/incremental_suite.dart index 3f025c60c82e..314c4a77f21c 100644 --- a/pkg/front_end/test/incremental_suite.dart +++ b/pkg/front_end/test/incremental_suite.dart @@ -69,7 +69,7 @@ import "package:vm/modular/target/vm.dart" show VmTarget; import "package:yaml/yaml.dart" show YamlMap, loadYamlNode; import 'binary_md_dill_reader.dart' show DillComparer; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'testing/environment_keys.dart'; import "incremental_utils.dart" as util; import 'test_utils.dart'; diff --git a/pkg/front_end/test/isolates_v_processes.dart b/pkg/front_end/test/isolates_v_processes.dart index 795a3c29fb86..8a2fa339424a 100644 --- a/pkg/front_end/test/isolates_v_processes.dart +++ b/pkg/front_end/test/isolates_v_processes.dart @@ -9,7 +9,7 @@ import "package:testing/src/suite.dart"; import "package:testing/testing.dart"; import 'package:testing/src/log.dart' show Logger, StdoutLogger; -import "fasta/strong_suite.dart" as strong; +import "strong_suite.dart" as strong; const bool doPrint = false; diff --git a/pkg/front_end/test/lint_suite.dart b/pkg/front_end/test/lint_suite.dart index c6c9aa6e22f7..db9c05097728 100644 --- a/pkg/front_end/test/lint_suite.dart +++ b/pkg/front_end/test/lint_suite.dart @@ -22,7 +22,7 @@ import 'package:package_config/package_config.dart'; import 'package:testing/testing.dart' show Chain, ChainContext, Result, Step, TestDescription; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'testing_utils.dart' show checkEnvironment, filterList; void main([List arguments = const []]) => internalMain(createContext, @@ -31,12 +31,12 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { + Chain suite, Map environment) { const Set knownEnvironmentKeys = {"onlyInGit"}; checkEnvironment(environment, knownEnvironmentKeys); bool onlyInGit = environment["onlyInGit"] != "false"; - return new Context(onlyInGit: onlyInGit); + return new Future.value(new Context(onlyInGit: onlyInGit)); } class LintTestDescription extends TestDescription { diff --git a/pkg/front_end/test/macros/declaration/macro_declaration_test.dart b/pkg/front_end/test/macros/declaration/macro_declaration_test.dart index 86d71012cff6..dc9dd6d37801 100644 --- a/pkg/front_end/test/macros/declaration/macro_declaration_test.dart +++ b/pkg/front_end/test/macros/declaration/macro_declaration_test.dart @@ -299,39 +299,40 @@ class TestMacroExecutor extends MultiMacroExecutor { } @override - Future close() async { + Future close() { // TODO: implement close + return new Future.value(); } @override Future executeDeclarationsPhase( MacroInstanceIdentifier macro, MacroTarget target, - DeclarationPhaseIntrospector introspector) async { - return new _MacroExecutionResult(); + DeclarationPhaseIntrospector introspector) { + return new Future.value(new _MacroExecutionResult()); } @override Future executeDefinitionsPhase( MacroInstanceIdentifier macro, MacroTarget target, - DefinitionPhaseIntrospector introspector) async { - return new _MacroExecutionResult(); + DefinitionPhaseIntrospector introspector) { + return new Future.value(new _MacroExecutionResult()); } @override Future executeTypesPhase(MacroInstanceIdentifier macro, - MacroTarget target, TypePhaseIntrospector introspector) async { - return new _MacroExecutionResult(); + MacroTarget target, TypePhaseIntrospector introspector) { + return new Future.value(new _MacroExecutionResult()); } @override Future instantiateMacro( - Uri library, String name, String constructor, Arguments arguments) async { + Uri library, String name, String constructor, Arguments arguments) { _MacroInstanceIdentifier id = new _MacroInstanceIdentifier(library, name, constructor, arguments); macroInstances.add(id); - return id; + return new Future.value(id); } } diff --git a/pkg/front_end/test/fasta/messages_suite.dart b/pkg/front_end/test/messages_suite.dart similarity index 99% rename from pkg/front_end/test/fasta/messages_suite.dart rename to pkg/front_end/test/messages_suite.dart index abb2a2729b24..574c7b39c72b 100644 --- a/pkg/front_end/test/fasta/messages_suite.dart +++ b/pkg/front_end/test/messages_suite.dart @@ -34,9 +34,9 @@ import "package:testing/testing.dart" import "package:vm/modular/target/vm.dart" show VmTarget; import "package:yaml/yaml.dart" show YamlList, YamlMap, YamlNode, loadYamlNode; -import "../../tool/_fasta/entry_points.dart" show BatchCompiler; -import '../spell_checking_utils.dart' as spell; -import 'suite_utils.dart' show internalMain; +import "../tool/_fasta/entry_points.dart" show BatchCompiler; +import 'spell_checking_utils.dart' as spell; +import 'utils/suite_utils.dart' show internalMain; class MessageTestDescription extends TestDescription { @override @@ -96,7 +96,7 @@ class MessageTestSuite extends ChainContext { Future postRun() { String dartPath = Platform.resolvedExecutable; Uri suiteUri = - spell.repoDir.resolve("pkg/front_end/test/fasta/messages_suite.dart"); + spell.repoDir.resolve("pkg/front_end/test/messages_suite.dart"); File suiteFile = new File.fromUri(suiteUri).absolute; if (!suiteFile.existsSync()) { throw "Specified suite path is invalid."; @@ -890,5 +890,6 @@ Future main([List arguments = const []]) async { createContext, arguments: arguments, displayName: "messages suite", + configurationPath: "../testing.json", ); } diff --git a/pkg/front_end/test/fasta/modular_suite.dart b/pkg/front_end/test/modular_suite.dart similarity index 81% rename from pkg/front_end/test/fasta/modular_suite.dart rename to pkg/front_end/test/modular_suite.dart index 0898dd031ef0..a7da47a53560 100644 --- a/pkg/front_end/test/fasta/modular_suite.dart +++ b/pkg/front_end/test/modular_suite.dart @@ -4,9 +4,9 @@ library fasta.test.modular_suite; -import 'suite_utils.dart' show internalMain; -import '../testing/environment_keys.dart'; -import '../testing/suite.dart'; +import 'utils/suite_utils.dart' show internalMain; +import 'testing/environment_keys.dart'; +import 'testing/suite.dart'; Future createContext( Chain suite, Map environment) { @@ -20,5 +20,6 @@ Future main([List arguments = const []]) async { createContext, arguments: arguments, displayName: "modular suite", + configurationPath: "../testing.json", ); } diff --git a/pkg/front_end/test/outline_extractor_suite.dart b/pkg/front_end/test/outline_extractor_suite.dart index 7e1d93d550f5..cfca9f1758e8 100644 --- a/pkg/front_end/test/outline_extractor_suite.dart +++ b/pkg/front_end/test/outline_extractor_suite.dart @@ -15,7 +15,7 @@ import 'package:kernel/src/equivalence.dart'; import 'package:testing/testing.dart' show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'testing/environment_keys.dart'; import 'incremental_suite.dart' as helper; import 'testing_utils.dart' show checkEnvironment; @@ -39,8 +39,7 @@ void main([List arguments = const []]) => internalMain(createContext, displayName: "outline extractor suite", configurationPath: "../testing.json"); -Future createContext( - Chain suite, Map environment) async { +Future createContext(Chain suite, Map environment) { const Set knownEnvironmentKeys = { EnvironmentKeys.updateExpectations, }; @@ -49,7 +48,7 @@ Future createContext( bool updateExpectations = environment[EnvironmentKeys.updateExpectations] == "true"; - return new Context(suite.name, updateExpectations); + return new Future.value(new Context(suite.name, updateExpectations)); } class Context extends ChainContext with MatchContext { diff --git a/pkg/front_end/test/fasta/outline_suite.dart b/pkg/front_end/test/outline_suite.dart similarity index 79% rename from pkg/front_end/test/fasta/outline_suite.dart rename to pkg/front_end/test/outline_suite.dart index 5e38e7b510e3..7fd9a542338c 100644 --- a/pkg/front_end/test/fasta/outline_suite.dart +++ b/pkg/front_end/test/outline_suite.dart @@ -4,9 +4,9 @@ library fasta.test.outline_suite; -import 'suite_utils.dart' show internalMain; -import '../testing/environment_keys.dart'; -import '../testing/suite.dart'; +import 'utils/suite_utils.dart' show internalMain; +import 'testing/environment_keys.dart'; +import 'testing/suite.dart'; Future createContext( Chain suite, Map environment) { @@ -19,5 +19,6 @@ Future main([List arguments = const []]) async { createContext, arguments: arguments, displayName: "outline suite", + configurationPath: "../testing.json", ); } diff --git a/pkg/front_end/test/parser_all_suite.dart b/pkg/front_end/test/parser_all_suite.dart index 9180070d50cc..9cc4328e317f 100644 --- a/pkg/front_end/test/parser_all_suite.dart +++ b/pkg/front_end/test/parser_all_suite.dart @@ -4,7 +4,7 @@ import 'package:testing/testing.dart' show Chain, ChainContext; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'parser_suite.dart'; void main([List arguments = const []]) => internalMain(createContext, @@ -13,6 +13,6 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { - return new ContextChecksOnly(suite.name); + Chain suite, Map environment) { + return new Future.value(new ContextChecksOnly(suite.name)); } diff --git a/pkg/front_end/test/parser_equivalence_suite.dart b/pkg/front_end/test/parser_equivalence_suite.dart index e68a2a35f2ee..087d2c76802c 100644 --- a/pkg/front_end/test/parser_equivalence_suite.dart +++ b/pkg/front_end/test/parser_equivalence_suite.dart @@ -8,7 +8,7 @@ import 'package:testing/testing.dart' show Chain, ChainContext, Result, Step, TestDescription; import "package:yaml/yaml.dart" show YamlMap, loadYamlNode; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'parser_suite.dart' show ListenerStep, ParserTestListenerWithMessageFormatting; import 'testing_utils.dart' show checkEnvironment; @@ -19,11 +19,11 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { + Chain suite, Map environment) { const Set knownEnvironmentKeys = {}; checkEnvironment(environment, knownEnvironmentKeys); - return new Context(suite.name); + return new Future.value(new Context(suite.name)); } class Context extends ChainContext { diff --git a/pkg/front_end/test/parser_suite.dart b/pkg/front_end/test/parser_suite.dart index b6f6dab2f6e3..0d74e13d6d7f 100644 --- a/pkg/front_end/test/parser_suite.dart +++ b/pkg/front_end/test/parser_suite.dart @@ -29,7 +29,7 @@ import 'package:kernel/ast.dart'; import 'package:testing/testing.dart' show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'testing/environment_keys.dart'; import 'parser_test_listener.dart' show ParserTestListener; import 'parser_test_parser.dart' show TestParser; @@ -54,8 +54,7 @@ void main([List arguments = const []]) => internalMain(createContext, displayName: "parser suite", configurationPath: "../testing.json"); -Future createContext( - Chain suite, Map environment) async { +Future createContext(Chain suite, Map environment) { const Set knownEnvironmentKeys = { EnvironmentKeys.updateExpectations, EnvironmentKeys.trace, @@ -68,7 +67,8 @@ Future createContext( bool trace = environment[EnvironmentKeys.trace] == "true"; bool annotateLines = environment[EnvironmentKeys.annotateLines] == "true"; - return new Context(suite.name, updateExpectations, trace, annotateLines); + return new Future.value( + new Context(suite.name, updateExpectations, trace, annotateLines)); } ScannerConfiguration scannerConfiguration = new ScannerConfiguration( diff --git a/pkg/front_end/test/spelling_test_base.dart b/pkg/front_end/test/spelling_test_base.dart index adf89e3ca5f4..b60c5b665b9e 100644 --- a/pkg/front_end/test/spelling_test_base.dart +++ b/pkg/front_end/test/spelling_test_base.dart @@ -71,7 +71,7 @@ class SpellTest extends Step { @override Future> run( - TestDescription description, SpellContext context) async { + TestDescription description, SpellContext context) { File f = new File.fromUri(description.uri); Uint8List rawBytes = f.readAsBytesSync(); @@ -119,7 +119,7 @@ class SpellTest extends Step { while (token != null) { if (token is ErrorToken) { // For now just accept that. - return pass(description); + return new Future.value(pass(description)); } if (token.precedingComments != null) { Token? comment = token.precedingComments; @@ -170,9 +170,9 @@ class SpellTest extends Step { } if (errors == null) { - return pass(description); + return new Future.value(pass(description)); } else { - return fail(description, errors!.join("\n\n")); + return new Future.value(fail(description, errors!.join("\n\n"))); } } } diff --git a/pkg/front_end/test/spelling_test_external_targets.dart b/pkg/front_end/test/spelling_test_external_targets.dart index c351d5cd18df..c37e7c432524 100644 --- a/pkg/front_end/test/spelling_test_external_targets.dart +++ b/pkg/front_end/test/spelling_test_external_targets.dart @@ -12,14 +12,14 @@ void main([List arguments = const []]) => runMe(arguments, createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { + Chain suite, Map environment) { const Set knownEnvironmentKeys = {"interactive", "onlyInGit"}; checkEnvironment(environment, knownEnvironmentKeys); bool interactive = environment["interactive"] == "true"; bool onlyInGit = environment["onlyInGit"] != "false"; - return new SpellContextExternal( - interactive: interactive, onlyInGit: onlyInGit); + return new Future.value( + new SpellContextExternal(interactive: interactive, onlyInGit: onlyInGit)); } class SpellContextExternal extends SpellContext { diff --git a/pkg/front_end/test/spelling_test_not_src_suite.dart b/pkg/front_end/test/spelling_test_not_src_suite.dart index d3c9cee17b64..94628e54e94e 100644 --- a/pkg/front_end/test/spelling_test_not_src_suite.dart +++ b/pkg/front_end/test/spelling_test_not_src_suite.dart @@ -4,7 +4,7 @@ import 'package:testing/testing.dart' show Chain; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'spell_checking_utils.dart' as spell; import 'spelling_test_base.dart'; import 'testing_utils.dart' show checkEnvironment; @@ -15,13 +15,14 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { + Chain suite, Map environment) { const Set knownEnvironmentKeys = {"interactive", "onlyInGit"}; checkEnvironment(environment, knownEnvironmentKeys); bool interactive = environment["interactive"] == "true"; bool onlyInGit = environment["onlyInGit"] != "false"; - return new SpellContextTest(interactive: interactive, onlyInGit: onlyInGit); + return new Future.value( + new SpellContextTest(interactive: interactive, onlyInGit: onlyInGit)); } class SpellContextTest extends SpellContext { diff --git a/pkg/front_end/test/spelling_test_src_suite.dart b/pkg/front_end/test/spelling_test_src_suite.dart index d0267bd10480..bb761d16884c 100644 --- a/pkg/front_end/test/spelling_test_src_suite.dart +++ b/pkg/front_end/test/spelling_test_src_suite.dart @@ -4,7 +4,7 @@ import 'package:testing/testing.dart' show Chain; -import 'fasta/suite_utils.dart'; +import 'utils/suite_utils.dart'; import 'spell_checking_utils.dart' as spell; import 'spelling_test_base.dart'; import 'testing_utils.dart' show checkEnvironment; @@ -15,13 +15,14 @@ void main([List arguments = const []]) => internalMain(createContext, configurationPath: "../testing.json"); Future createContext( - Chain suite, Map environment) async { + Chain suite, Map environment) { const Set knownEnvironmentKeys = {"interactive", "onlyInGit"}; checkEnvironment(environment, knownEnvironmentKeys); bool interactive = environment["interactive"] == "true"; bool onlyInGit = environment["onlyInGit"] != "false"; - return new SpellContextSource(interactive: interactive, onlyInGit: onlyInGit); + return new Future.value( + new SpellContextSource(interactive: interactive, onlyInGit: onlyInGit)); } class SpellContextSource extends SpellContext { diff --git a/pkg/front_end/test/fasta/strong_suite.dart b/pkg/front_end/test/strong_suite.dart similarity index 82% rename from pkg/front_end/test/fasta/strong_suite.dart rename to pkg/front_end/test/strong_suite.dart index bbfcc137b332..7c4c1ba0bb75 100644 --- a/pkg/front_end/test/fasta/strong_suite.dart +++ b/pkg/front_end/test/strong_suite.dart @@ -4,9 +4,9 @@ library fasta.test.strong_suite; -import 'suite_utils.dart' show internalMain; -import '../testing/environment_keys.dart'; -import '../testing/suite.dart'; +import 'utils/suite_utils.dart' show internalMain; +import 'testing/environment_keys.dart'; +import 'testing/suite.dart'; Future createContext( Chain suite, Map environment) { @@ -21,5 +21,6 @@ Future main([List arguments = const []]) async { createContext, arguments: arguments, displayName: "strong suite", + configurationPath: "../testing.json", ); } diff --git a/pkg/front_end/test/testing_utils.dart b/pkg/front_end/test/testing_utils.dart index d214743bf3b3..97a8e1e6e973 100644 --- a/pkg/front_end/test/testing_utils.dart +++ b/pkg/front_end/test/testing_utils.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. -import 'dart:io' show Directory, Process, ProcessResult; +import 'dart:io' show Directory, File, FileSystemEntity, Process, ProcessResult; import 'package:testing/testing.dart' show Chain, TestDescription; @@ -51,3 +51,42 @@ void checkEnvironment( "\n - ${knownEnvironmentKeys.join("\n - ")}"; } } + +Future> computeSourceFiles(Uri repoDir) async { + Set libUris = {}; + libUris.add(repoDir.resolve("pkg/front_end/lib/")); + libUris.add(repoDir.resolve("pkg/front_end/test/")); + libUris.add(repoDir.resolve("pkg/front_end/tool/")); + + List dataDirectories = [ + 'pkg/front_end/test/class_hierarchy/data/', + 'pkg/front_end/test/extensions/data/', + 'pkg/front_end/test/id_testing/data/', + 'pkg/front_end/test/language_versioning/data/', + 'pkg/front_end/test/macros/application/data/', + 'pkg/front_end/test/macros/declaration/data/', + 'pkg/front_end/test/macros/incremental/data/', + 'pkg/front_end/test/patching/data/', + 'pkg/front_end/test/scopes/data/', + 'pkg/front_end/test/static_types/data/', + ]; + + List inputs = []; + for (Uri uri in libUris) { + Set gitFiles = await getGitFiles(uri); + List entities = + new Directory.fromUri(uri).listSync(recursive: true); + for (FileSystemEntity entity in entities) { + if (entity is File && + entity.path.endsWith(".dart") && + gitFiles.contains(entity.uri)) { + if (dataDirectories + .any((exclude) => entity.uri.path.contains(exclude))) { + continue; + } + inputs.add(entity.uri); + } + } + } + return inputs; +} diff --git a/pkg/front_end/test/fasta/textual_outline_suite.dart b/pkg/front_end/test/textual_outline_suite.dart similarity index 97% rename from pkg/front_end/test/fasta/textual_outline_suite.dart rename to pkg/front_end/test/textual_outline_suite.dart index a8724344e19e..42654876205b 100644 --- a/pkg/front_end/test/fasta/textual_outline_suite.dart +++ b/pkg/front_end/test/textual_outline_suite.dart @@ -23,10 +23,10 @@ import 'package:testing/testing.dart' Step, TestDescription; -import '../utils/kernel_chain.dart' show MatchContext; -import 'suite_utils.dart'; -import '../testing/environment_keys.dart'; -import '../testing/folder_options.dart'; +import 'utils/kernel_chain.dart' show MatchContext; +import 'utils/suite_utils.dart'; +import 'testing/environment_keys.dart'; +import 'testing/folder_options.dart'; const int minSupportedMajorVersion = 2; const int minSupportedMinorVersion = 12; @@ -62,6 +62,7 @@ void main([List arguments = const []]) => internalMain( createContext, arguments: arguments, displayName: "textual outline suite", + configurationPath: "../testing.json", ); class Context extends ChainContext with MatchContext { diff --git a/pkg/front_end/test/tool/reload.dart b/pkg/front_end/test/tool/reload.dart index 23bb09b9091a..9ea418bc7509 100644 --- a/pkg/front_end/test/tool/reload.dart +++ b/pkg/front_end/test/tool/reload.dart @@ -128,15 +128,15 @@ class RemoteVm { } /// Close any connections used to communicate with the VM. - Future disconnect() async { - if (_rpc == null) return null; + Future disconnect() { + if (_rpc == null) return new Future.value(); this._mainId = null; if (!_rpc!.isClosed) { var future = _rpc!.close(); _rpc = null; return future; } - return null; + return new Future.value(); } } diff --git a/pkg/front_end/test/unit_test_suites.dart b/pkg/front_end/test/unit_test_suites.dart index def6363e8c86..ea985b2166f0 100644 --- a/pkg/front_end/test/unit_test_suites.dart +++ b/pkg/front_end/test/unit_test_suites.dart @@ -16,15 +16,15 @@ import 'package:testing/src/suite.dart' as testing show Suite; import 'package:testing/src/test_description.dart' show TestDescription; import 'dartdoctest_suite.dart' as dartdoctest show createContext; -import 'fasta/expression_suite.dart' as expression show createContext; -import 'fasta/incremental_dartino_suite.dart' as incremental_dartino +import 'expression_suite.dart' as expression show createContext; +import 'incremental_dartino_suite.dart' as incremental_dartino show createContext; -import 'fasta/messages_suite.dart' as messages show createContext; -import 'fasta/modular_suite.dart' as modular show createContext; -import 'fasta/outline_suite.dart' as outline show createContext; -import 'fasta/strong_suite.dart' as strong show createContext; -import 'fasta/textual_outline_suite.dart' as textual_outline show createContext; -import 'fasta/weak_suite.dart' as weak show createContext; +import 'messages_suite.dart' as messages show createContext; +import 'modular_suite.dart' as modular show createContext; +import 'outline_suite.dart' as outline show createContext; +import 'strong_suite.dart' as strong show createContext; +import 'textual_outline_suite.dart' as textual_outline show createContext; +import 'weak_suite.dart' as weak show createContext; import 'incremental_bulk_compiler_smoke_suite.dart' as incremental_bulk_compiler show createContext; import 'incremental_suite.dart' as incremental show createContext; @@ -361,35 +361,35 @@ const List suites = [ shardCount: 1, ), const Suite( - "fasta/expression", + "expression", expression.createContext, - "../../testing.json", + "../testing.json", shardCount: 1, ), const Suite( - "fasta/outline", + "outline", outline.createContext, - "../../testing.json", + "../testing.json", shardCount: 2, ), const Suite( - "fasta/incremental_dartino", + "incremental_dartino", incremental_dartino.createContext, - "../../testing.json", + "../testing.json", shardCount: 1, ), const Suite( - "fasta/messages", + "messages", messages.createContext, - "../../testing.json", + "../testing.json", shardCount: 1, requiresGit: true, ), const Suite( - "fasta/strong", + "strong", strong.createContext, - "../../testing.json", - path: "fasta/strong_suite.dart", + "../testing.json", + path: "strong_suite.dart", shardCount: 10, ), const Suite( @@ -448,23 +448,23 @@ const List suites = [ requiresGit: true, ), const Suite( - "fasta/modular", + "modular", modular.createContext, - "../../testing.json", - path: "fasta/modular_suite.dart", + "../testing.json", + path: "modular_suite.dart", shardCount: 4, ), const Suite( - "fasta/weak", + "weak", weak.createContext, - "../../testing.json", - path: "fasta/weak_suite.dart", + "../testing.json", + path: "weak_suite.dart", shardCount: 10, ), const Suite( - "fasta/textual_outline", + "textual_outline", textual_outline.createContext, - "../../testing.json", + "../testing.json", shardCount: 1, ), const Suite( diff --git a/pkg/front_end/test/unreachable_if_finder_git_test.dart b/pkg/front_end/test/unreachable_if_finder_git_test.dart index 2bb9809a0cf3..a65e5c786fec 100644 --- a/pkg/front_end/test/unreachable_if_finder_git_test.dart +++ b/pkg/front_end/test/unreachable_if_finder_git_test.dart @@ -17,13 +17,11 @@ import 'package:kernel/kernel.dart'; import 'package:kernel/target/targets.dart'; import '../tool/unreachable_if_finder.dart'; -import 'testing_utils.dart' show getGitFiles; +import 'testing_utils.dart' show computeSourceFiles; import "utils/io_utils.dart"; final Uri repoDir = computeRepoDirUri(); -Set libUris = {}; - Future main(List args) async { api.CompilerOptions compilerOptions = getOptions(); @@ -35,22 +33,7 @@ Future main(List args) async { ProcessedOptions options = new ProcessedOptions(options: compilerOptions); - libUris.add(repoDir.resolve("pkg/front_end/lib/")); - libUris.add(repoDir.resolve("pkg/front_end/test/fasta/")); - libUris.add(repoDir.resolve("pkg/front_end/tool/")); - - for (Uri uri in libUris) { - Set gitFiles = await getGitFiles(uri); - List entities = - new Directory.fromUri(uri).listSync(recursive: true); - for (FileSystemEntity entity in entities) { - if (entity is File && - entity.path.endsWith(".dart") && - gitFiles.contains(entity.uri)) { - options.inputs.add(entity.uri); - } - } - } + options.inputs.addAll(await computeSourceFiles(repoDir)); Stopwatch stopwatch = new Stopwatch()..start(); diff --git a/pkg/front_end/test/fasta/suite_utils.dart b/pkg/front_end/test/utils/suite_utils.dart similarity index 98% rename from pkg/front_end/test/fasta/suite_utils.dart rename to pkg/front_end/test/utils/suite_utils.dart index 1debbac3d67c..f29b40d2f438 100644 --- a/pkg/front_end/test/fasta/suite_utils.dart +++ b/pkg/front_end/test/utils/suite_utils.dart @@ -22,7 +22,7 @@ Future internalMain( int? shards, int? shard, required String displayName, - String? configurationPath, + required String configurationPath, }) async { Logger logger = const StdoutLogger(); List? argumentsTrimmed; @@ -66,7 +66,7 @@ Future internalMain( await runMe( arguments, createContext, - configurationPath: configurationPath ?? "../../testing.json", + configurationPath: configurationPath, shards: shards, shard: shard, limitTo: limitTo, diff --git a/pkg/front_end/test/vm_service_for_leak_smoke_test.dart b/pkg/front_end/test/vm_service_for_leak_smoke_test.dart index 66eaa2bf8126..ed66f4ab27d2 100644 --- a/pkg/front_end/test/vm_service_for_leak_smoke_test.dart +++ b/pkg/front_end/test/vm_service_for_leak_smoke_test.dart @@ -4,7 +4,7 @@ import 'dart:io'; -import 'fasta/suite_utils.dart' show limitToArgument; +import 'utils/suite_utils.dart' show limitToArgument; import "vm_service_for_leak_detection.dart" as helper; Future main(List args) async { diff --git a/pkg/front_end/test/fasta/weak_suite.dart b/pkg/front_end/test/weak_suite.dart similarity index 81% rename from pkg/front_end/test/fasta/weak_suite.dart rename to pkg/front_end/test/weak_suite.dart index e6bd6741fc71..84319a2921cd 100644 --- a/pkg/front_end/test/fasta/weak_suite.dart +++ b/pkg/front_end/test/weak_suite.dart @@ -4,9 +4,9 @@ library fasta.test.weak_suite; -import 'suite_utils.dart' show internalMain; -import '../testing/environment_keys.dart'; -import '../testing/suite.dart'; +import 'utils/suite_utils.dart' show internalMain; +import 'testing/environment_keys.dart'; +import 'testing/suite.dart'; Future createContext( Chain suite, Map environment) { @@ -21,5 +21,6 @@ Future main([List arguments = const []]) async { createContext, arguments: arguments, displayName: "weak suite", + configurationPath: "../testing.json", ); } diff --git a/pkg/front_end/test/web_parser_git_test.dart b/pkg/front_end/test/web_parser_git_test.dart index bed7d67b55a5..62ac9846d6b8 100644 --- a/pkg/front_end/test/web_parser_git_test.dart +++ b/pkg/front_end/test/web_parser_git_test.dart @@ -7,7 +7,7 @@ import 'dart:io'; import "utils/io_utils.dart"; -Future main(List args) async { +void main(List args) { Uri dart = repoDir.resolve( "tools/sdks/dart-sdk/bin/dart${Platform.isWindows ? ".exe" : ""}"); if (!new File.fromUri(dart).existsSync()) { diff --git a/pkg/front_end/testing.json b/pkg/front_end/testing.json index 02b24c5368e0..7e2c247202c3 100644 --- a/pkg/front_end/testing.json +++ b/pkg/front_end/testing.json @@ -7,14 +7,14 @@ { "name": "messages", "kind": "Chain", - "source": "test/fasta/messages_suite.dart", + "source": "test/messages_suite.dart", "root": "./", "status": "messages.status" }, { "name": "textual_outline", "kind": "Chain", - "source": "test/fasta/textual_outline_suite.dart", + "source": "test/textual_outline_suite.dart", "root": "testcases/", "status": "testcases/textual_outline.status", "includeEndsWith": [ @@ -31,7 +31,7 @@ { "name": "outline", "kind": "Chain", - "source": "test/fasta/outline_suite.dart", + "source": "test/outline_suite.dart", "root": "testcases/", "status": "testcases/outline.status", "includeEndsWith": [ @@ -49,7 +49,7 @@ { "name": "strong", "kind": "Chain", - "source": "test/fasta/strong_suite.dart", + "source": "test/strong_suite.dart", "root": "testcases/", "status": "testcases/strong.status", "includeEndsWith": [ @@ -67,7 +67,7 @@ { "name": "modular", "kind": "Chain", - "source": "test/fasta/modular_suite.dart", + "source": "test/modular_suite.dart", "root": "testcases/", "status": "testcases/modular.status", "includeEndsWith": [ @@ -85,7 +85,7 @@ { "name": "weak", "kind": "Chain", - "source": "test/fasta/weak_suite.dart", + "source": "test/weak_suite.dart", "root": "testcases/", "status": "testcases/weak.status", "includeEndsWith": [ @@ -148,7 +148,7 @@ { "name": "incremental_dartino", "kind": "Chain", - "source": "test/fasta/incremental_dartino_suite.dart", + "source": "test/incremental_dartino_suite.dart", "root": "testcases/dartino", "status": "testcases/incremental_dartino.status", "includeEndsWith": [ @@ -158,7 +158,7 @@ { "name": "expression", "kind": "Chain", - "source": "test/fasta/expression_suite.dart", + "source": "test/expression_suite.dart", "root": "testcases/expression/", "status": "testcases/expression.status", "includeEndsWith": [ @@ -327,9 +327,7 @@ ], "exclude": [ "lib/", - "test/fasta/super_mixins_test\\.dart$", "test/types/subtypes_benchmark\\.dart$", - "test/fasta/unlinked_scope_test\\.dart$", "test/memory_file_system_test\\.dart$", "test/scanner_fasta_test\\.dart$", "test/scanner_test\\.dart$",