Skip to content

Commit

Permalink
[cfe] Move suites from test/fasta/ to test/
Browse files Browse the repository at this point in the history
Change-Id: Ida60cd9bc95c783df6e3a7819560b3836660c10f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/394486
Reviewed-by: Jens Johansen <[email protected]>
  • Loading branch information
johnniwinther authored and Commit Queue committed Nov 14, 2024
1 parent 91db72c commit 14097a1
Show file tree
Hide file tree
Showing 39 changed files with 177 additions and 162 deletions.
2 changes: 1 addition & 1 deletion pkg/front_end/presubmit_helper_spawn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 2 additions & 19 deletions pkg/front_end/test/async_but_no_await_git_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Uri> libUris = {};

Future<void> main(List<String> args) async {
api.CompilerOptions compilerOptions = getOptions();

Expand All @@ -39,22 +37,7 @@ Future<void> main(List<String> 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<Uri> gitFiles = await getGitFiles(uri);
List<FileSystemEntity> 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();

Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/test/binary_md_git_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> main() async {
void main() {
File binaryMd = new File("$repoDir/pkg/kernel/binary.md");
String binaryMdContent = binaryMd.readAsStringSync();

Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/test/coverage_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Future<void> _run(Directory coverageTmpDir, List<String> 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}",
Expand Down
6 changes: 3 additions & 3 deletions pkg/front_end/test/dartdoctest_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ 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<String> arguments = const []]) => internalMain(createContext,
arguments: arguments,
displayName: "dartdoctest suite",
configurationPath: "../testing.json");

Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
return new Context(suite.name);
Chain suite, Map<String, String> environment) {
return new Future.value(new Context(suite.name));
}

class Context extends ChainContext {
Expand Down
3 changes: 2 additions & 1 deletion pkg/front_end/test/desugar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ Future<void> testRedirectingFactorySerialized() async {

// regression test: redirecting factories from patch files don't have the
// redirecting-factory flag stored in kernel.
Future<void> testRedirectingFactoryPatchFile() async {
Future<void> 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -740,4 +740,5 @@ void main([List<String> arguments = const []]) => internalMain(
createContext,
arguments: arguments,
displayName: "expression suite",
configurationPath: "../testing.json",
);
3 changes: 2 additions & 1 deletion pkg/front_end/test/hot_reload_e2e_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ abstract class TestCase {
await rebuild(compiler, outputUri); // this is a full compile.
}

Future<void> tearDown() async {
Future<void> tearDown() {
outDir.deleteSync(recursive: true);
lines = const [];
return new Future.value();
}

Future<int> computeVmPort() async {
Expand Down
4 changes: 2 additions & 2 deletions pkg/front_end/test/incremental_bulk_compiler_full.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ void main([List<String> arguments = const []]) =>
runMe(arguments, createContext, configurationPath: "../testing.json");

Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
return new Context();
Chain suite, Map<String, String> environment) {
return new Future.value(new Context());
}

class Context extends ChainContext {
Expand Down
6 changes: 3 additions & 3 deletions pkg/front_end/test/incremental_bulk_compiler_smoke_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> arguments = const []]) => internalMain(createContext,
Expand All @@ -13,6 +13,6 @@ void main([List<String> arguments = const []]) => internalMain(createContext,
configurationPath: "../testing.json");

Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
return new Context();
Chain suite, Map<String, String> environment) {
return new Future.value(new Context());
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ");

Expand Down Expand Up @@ -234,4 +234,5 @@ void main([List<String> arguments = const []]) => internalMain(
createContext,
arguments: arguments,
displayName: "incremental dartino suite",
configurationPath: "../testing.json",
);
2 changes: 1 addition & 1 deletion pkg/front_end/test/incremental_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/test/isolates_v_processes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions pkg/front_end/test/lint_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> arguments = const []]) => internalMain(createContext,
Expand All @@ -31,12 +31,12 @@ void main([List<String> arguments = const []]) => internalMain(createContext,
configurationPath: "../testing.json");

Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
Chain suite, Map<String, String> environment) {
const Set<String> 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 {
Expand Down
19 changes: 10 additions & 9 deletions pkg/front_end/test/macros/declaration/macro_declaration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -299,39 +299,40 @@ class TestMacroExecutor extends MultiMacroExecutor {
}

@override
Future<void> close() async {
Future<void> close() {
// TODO: implement close
return new Future.value();
}

@override
Future<MacroExecutionResult> executeDeclarationsPhase(
MacroInstanceIdentifier macro,
MacroTarget target,
DeclarationPhaseIntrospector introspector) async {
return new _MacroExecutionResult();
DeclarationPhaseIntrospector introspector) {
return new Future.value(new _MacroExecutionResult());
}

@override
Future<MacroExecutionResult> executeDefinitionsPhase(
MacroInstanceIdentifier macro,
MacroTarget target,
DefinitionPhaseIntrospector introspector) async {
return new _MacroExecutionResult();
DefinitionPhaseIntrospector introspector) {
return new Future.value(new _MacroExecutionResult());
}

@override
Future<MacroExecutionResult> executeTypesPhase(MacroInstanceIdentifier macro,
MacroTarget target, TypePhaseIntrospector introspector) async {
return new _MacroExecutionResult();
MacroTarget target, TypePhaseIntrospector introspector) {
return new Future.value(new _MacroExecutionResult());
}

@override
Future<MacroInstanceIdentifier> 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -96,7 +96,7 @@ class MessageTestSuite extends ChainContext {
Future<void> 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.";
Expand Down Expand Up @@ -890,5 +890,6 @@ Future<void> main([List<String> arguments = const []]) async {
createContext,
arguments: arguments,
displayName: "messages suite",
configurationPath: "../testing.json",
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
Expand All @@ -20,5 +20,6 @@ Future<void> main([List<String> arguments = const []]) async {
createContext,
arguments: arguments,
displayName: "modular suite",
configurationPath: "../testing.json",
);
}
7 changes: 3 additions & 4 deletions pkg/front_end/test/outline_extractor_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,8 +39,7 @@ void main([List<String> arguments = const []]) => internalMain(createContext,
displayName: "outline extractor suite",
configurationPath: "../testing.json");

Future<Context> createContext(
Chain suite, Map<String, String> environment) async {
Future<Context> createContext(Chain suite, Map<String, String> environment) {
const Set<String> knownEnvironmentKeys = {
EnvironmentKeys.updateExpectations,
};
Expand All @@ -49,7 +48,7 @@ Future<Context> 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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FastaContext> createContext(
Chain suite, Map<String, String> environment) {
Expand All @@ -19,5 +19,6 @@ Future<void> main([List<String> arguments = const []]) async {
createContext,
arguments: arguments,
displayName: "outline suite",
configurationPath: "../testing.json",
);
}
6 changes: 3 additions & 3 deletions pkg/front_end/test/parser_all_suite.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> arguments = const []]) => internalMain(createContext,
Expand All @@ -13,6 +13,6 @@ void main([List<String> arguments = const []]) => internalMain(createContext,
configurationPath: "../testing.json");

Future<ChainContext> createContext(
Chain suite, Map<String, String> environment) async {
return new ContextChecksOnly(suite.name);
Chain suite, Map<String, String> environment) {
return new Future.value(new ContextChecksOnly(suite.name));
}
Loading

0 comments on commit 14097a1

Please sign in to comment.