Revert "[cfe] Run fasta testing directly"
This reverts commit b905c9a171.
Reason for revert: Sometimes all_suites.dart can't be found.
Original change's description:
> [cfe] Run `fasta testing` directly
>
> This avoids the precompile step when running
>
> package:testing/src/run_tests.dart
> Change-Id: Idb7569bb865b077440eb750333cfec5b6c48cd91
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345280
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
Change-Id: Iedc310eac17fab1b372c03a4852ff0a19f6e2e95
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345500
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
This commit is contained in:
committed by
Commit Queue
parent
5678fd48cd
commit
507297562c
@@ -10,8 +10,9 @@ import '../tool/dart_doctest_impl.dart';
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
return new Future.value(new Context(suite.name));
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
return new Context(suite.name);
|
||||
}
|
||||
|
||||
class Context extends ChainContext {
|
||||
|
||||
@@ -12,10 +12,7 @@ import 'package:testing/src/suite.dart' as testing show Suite;
|
||||
import 'testing/suite.dart';
|
||||
|
||||
Future<void> internalMain(CreateContext createContext,
|
||||
{List<String> arguments = const [],
|
||||
int shards = 1,
|
||||
int shard = 0,
|
||||
String? configurationPath}) async {
|
||||
{List<String> arguments = const [], int shards = 1, int shard = 0}) async {
|
||||
Logger logger = const StdoutLogger();
|
||||
if (arguments.contains("--traceStepTiming")) {
|
||||
logger = new TracingLogger();
|
||||
@@ -24,7 +21,7 @@ Future<void> internalMain(CreateContext createContext,
|
||||
await runMe(
|
||||
arguments,
|
||||
createContext,
|
||||
configurationPath: configurationPath ?? "../../testing.json",
|
||||
configurationPath: "../../testing.json",
|
||||
shards: shards,
|
||||
shard: shard,
|
||||
logger: logger,
|
||||
|
||||
@@ -26,8 +26,9 @@ import 'incremental_utils.dart' as util;
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
return new Future.value(new Context());
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
return new Context();
|
||||
}
|
||||
|
||||
class Context extends ChainContext {
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'incremental_bulk_compiler_full.dart' show Context;
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
return new Future.value(new Context());
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
return new Context();
|
||||
}
|
||||
|
||||
@@ -36,12 +36,13 @@ import 'testing_utils.dart' show checkEnvironment, getGitFiles;
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {"onlyInGit"};
|
||||
checkEnvironment(environment, knownEnvironmentKeys);
|
||||
|
||||
bool onlyInGit = environment["onlyInGit"] != "false";
|
||||
return new Future.value(new Context(onlyInGit: onlyInGit));
|
||||
return new Context(onlyInGit: onlyInGit);
|
||||
}
|
||||
|
||||
class LintTestDescription extends TestDescription {
|
||||
|
||||
@@ -43,7 +43,8 @@ const String EXPECTATIONS = '''
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {
|
||||
UPDATE_EXPECTATIONS,
|
||||
};
|
||||
@@ -51,7 +52,7 @@ Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
|
||||
bool updateExpectations = environment[UPDATE_EXPECTATIONS] == "true";
|
||||
|
||||
return new Future.value(new Context(suite.name, updateExpectations));
|
||||
return new Context(suite.name, updateExpectations);
|
||||
}
|
||||
|
||||
class Context extends ChainContext with MatchContext {
|
||||
|
||||
@@ -10,6 +10,6 @@ void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<ChainContext> createContext(
|
||||
Chain suite, Map<String, String> environment) {
|
||||
return new Future.value(new ContextChecksOnly(suite.name));
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
return new ContextChecksOnly(suite.name);
|
||||
}
|
||||
|
||||
@@ -20,11 +20,12 @@ void main([List<String> arguments = const []]) => runMe(
|
||||
configurationPath: "../testing.json",
|
||||
);
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {};
|
||||
checkEnvironment(environment, knownEnvironmentKeys);
|
||||
|
||||
return new Future.value(new Context(suite.name));
|
||||
return new Context(suite.name);
|
||||
}
|
||||
|
||||
class Context extends ChainContext {
|
||||
|
||||
@@ -59,7 +59,8 @@ const String EXPECTATIONS = '''
|
||||
void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
Future<Context> createContext(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {
|
||||
UPDATE_EXPECTATIONS,
|
||||
"trace",
|
||||
@@ -71,8 +72,7 @@ Future<Context> createContext(Chain suite, Map<String, String> environment) {
|
||||
bool trace = environment["trace"] == "true";
|
||||
bool annotateLines = environment["annotateLines"] == "true";
|
||||
|
||||
return new Future.value(
|
||||
new Context(suite.name, updateExpectations, trace, annotateLines));
|
||||
return new Context(suite.name, updateExpectations, trace, annotateLines);
|
||||
}
|
||||
|
||||
ScannerConfiguration scannerConfiguration = new ScannerConfiguration(
|
||||
|
||||
@@ -85,7 +85,7 @@ class SpellTest extends Step<TestDescription, TestDescription, SpellContext> {
|
||||
|
||||
@override
|
||||
Future<Result<TestDescription>> run(
|
||||
TestDescription description, SpellContext context) {
|
||||
TestDescription description, SpellContext context) async {
|
||||
File f = new File.fromUri(description.uri);
|
||||
List<int> rawBytes = f.readAsBytesSync();
|
||||
|
||||
@@ -136,7 +136,7 @@ class SpellTest extends Step<TestDescription, TestDescription, SpellContext> {
|
||||
while (token != null) {
|
||||
if (token is ErrorToken) {
|
||||
// For now just accept that.
|
||||
return new Future.value(pass(description));
|
||||
return pass(description);
|
||||
}
|
||||
if (token.precedingComments != null) {
|
||||
Token? comment = token.precedingComments;
|
||||
@@ -187,9 +187,9 @@ class SpellTest extends Step<TestDescription, TestDescription, SpellContext> {
|
||||
}
|
||||
|
||||
if (errors == null) {
|
||||
return new Future.value(pass(description));
|
||||
return pass(description);
|
||||
} else {
|
||||
return new Future.value(fail(description, errors!.join("\n\n")));
|
||||
return fail(description, errors!.join("\n\n"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,13 @@ void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<SpellContext> createContext(
|
||||
Chain suite, Map<String, String> environment) {
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {"interactive", "onlyInGit"};
|
||||
checkEnvironment(environment, knownEnvironmentKeys);
|
||||
|
||||
bool interactive = environment["interactive"] == "true";
|
||||
bool onlyInGit = environment["onlyInGit"] != "false";
|
||||
return new Future.value(
|
||||
new SpellContextTest(interactive: interactive, onlyInGit: onlyInGit));
|
||||
return new SpellContextTest(interactive: interactive, onlyInGit: onlyInGit);
|
||||
}
|
||||
|
||||
class SpellContextTest extends SpellContext {
|
||||
|
||||
@@ -14,14 +14,13 @@ void main([List<String> arguments = const []]) =>
|
||||
runMe(arguments, createContext, configurationPath: "../testing.json");
|
||||
|
||||
Future<SpellContext> createContext(
|
||||
Chain suite, Map<String, String> environment) {
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {"interactive", "onlyInGit"};
|
||||
checkEnvironment(environment, knownEnvironmentKeys);
|
||||
|
||||
bool interactive = environment["interactive"] == "true";
|
||||
bool onlyInGit = environment["onlyInGit"] != "false";
|
||||
return new Future.value(
|
||||
new SpellContextSource(interactive: interactive, onlyInGit: onlyInGit));
|
||||
return new SpellContextSource(interactive: interactive, onlyInGit: onlyInGit);
|
||||
}
|
||||
|
||||
class SpellContextSource extends SpellContext {
|
||||
|
||||
@@ -353,77 +353,77 @@ class Suite {
|
||||
});
|
||||
}
|
||||
|
||||
const Map<String, Suite> suites = {
|
||||
'dartdoctest': const Suite(
|
||||
const List<Suite> suites = [
|
||||
const Suite(
|
||||
"dartdoctest",
|
||||
dartdoctest.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'expression': const Suite(
|
||||
const Suite(
|
||||
"fasta/expression",
|
||||
expression.createContext,
|
||||
"../../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'outline': const Suite(
|
||||
const Suite(
|
||||
"fasta/outline",
|
||||
outline.createContext,
|
||||
"../../testing.json",
|
||||
shardCount: 2,
|
||||
),
|
||||
'incremental_dartino': const Suite(
|
||||
const Suite(
|
||||
"fasta/incremental_dartino",
|
||||
incremental_dartino.createContext,
|
||||
"../../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'messages': const Suite(
|
||||
const Suite(
|
||||
"fasta/messages",
|
||||
messages.createContext,
|
||||
"../../testing.json",
|
||||
shardCount: 1,
|
||||
requiresGit: true,
|
||||
),
|
||||
'strong': const Suite(
|
||||
const Suite(
|
||||
"fasta/strong",
|
||||
strong.createContext,
|
||||
"../../testing.json",
|
||||
path: "fasta/strong_suite.dart",
|
||||
shardCount: 2,
|
||||
),
|
||||
'incremental_bulk_compiler_smoke': const Suite(
|
||||
const Suite(
|
||||
"incremental_bulk_compiler_smoke",
|
||||
incremental_bulk_compiler.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'incremental': const Suite(
|
||||
const Suite(
|
||||
"incremental",
|
||||
incremental.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 2,
|
||||
),
|
||||
'lint': const Suite(
|
||||
const Suite(
|
||||
"lint",
|
||||
lint.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
requiresGit: true,
|
||||
),
|
||||
'parser': const Suite(
|
||||
const Suite(
|
||||
"parser",
|
||||
parser.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'parser_equivalence': const Suite(
|
||||
const Suite(
|
||||
"parser_equivalence",
|
||||
parserEquivalence.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'parser_all': const Suite(
|
||||
const Suite(
|
||||
"parser_all",
|
||||
parserAll.createContext,
|
||||
"../testing.json",
|
||||
@@ -433,47 +433,47 @@ const Map<String, Suite> suites = {
|
||||
than in test_matrix.json file set */
|
||||
,
|
||||
),
|
||||
'spelling_test_not_src': const Suite(
|
||||
const Suite(
|
||||
"spelling_test_not_src",
|
||||
spelling_not_src.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
requiresGit: true,
|
||||
),
|
||||
'spelling_test_src': const Suite(
|
||||
const Suite(
|
||||
"spelling_test_src",
|
||||
spelling_src.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
requiresGit: true,
|
||||
),
|
||||
'modular': const Suite(
|
||||
const Suite(
|
||||
"fasta/modular",
|
||||
modular.createContext,
|
||||
"../../testing.json",
|
||||
path: "fasta/modular_suite.dart",
|
||||
shardCount: 4,
|
||||
),
|
||||
'weak': const Suite(
|
||||
const Suite(
|
||||
"fasta/weak",
|
||||
weak.createContext,
|
||||
"../../testing.json",
|
||||
path: "fasta/weak_suite.dart",
|
||||
shardCount: 10,
|
||||
),
|
||||
'textual_outline': const Suite(
|
||||
const Suite(
|
||||
"fasta/textual_outline",
|
||||
textual_outline.createContext,
|
||||
"../../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
'outline_extractor': const Suite(
|
||||
const Suite(
|
||||
"outline_extractor",
|
||||
outline_extractor.createContext,
|
||||
"../testing.json",
|
||||
shardCount: 1,
|
||||
),
|
||||
};
|
||||
];
|
||||
|
||||
const Duration timeoutDuration = Duration(minutes: 30);
|
||||
|
||||
@@ -557,7 +557,7 @@ Future<void> main([List<String> arguments = const <String>[]]) async {
|
||||
int numberOfFreeWorkers = options.numberOfWorkers;
|
||||
// Run test suites and record the results and possible failure logs.
|
||||
int chunkNum = 0;
|
||||
for (Suite suite in suites.values) {
|
||||
for (Suite suite in suites) {
|
||||
if (options.onlyTestsThatRequireGit && !suite.requiresGit) continue;
|
||||
if (options.skipTestsThatRequireGit && suite.requiresGit) continue;
|
||||
String prefix = suite.prefix;
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2024, 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.
|
||||
|
||||
import 'dart:async' show Future;
|
||||
|
||||
import 'package:testing/src/chain.dart' show CreateContext;
|
||||
import 'package:testing/src/run.dart' show runSuites;
|
||||
import 'package:testing/src/run_tests.dart' show CommandLine;
|
||||
import 'package:testing/src/test_root.dart' show TestRoot;
|
||||
import 'package:testing/testing.dart';
|
||||
|
||||
import '../test/unit_test_suites.dart';
|
||||
|
||||
Future<Null> main(List<String> arguments) async {
|
||||
CommandLine cl = CommandLine.parse(arguments);
|
||||
Map<String, CreateContext> suiteMap = {};
|
||||
for (MapEntry<String, Suite> entry in suites.entries) {
|
||||
suiteMap[entry.key] = entry.value.createContext;
|
||||
}
|
||||
TestRoot testRoot =
|
||||
await TestRoot.fromUri(Uri.base.resolve('pkg/front_end/testing.json'));
|
||||
await runSuites(cl, testRoot, suiteMap);
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import "package:testing/src/run_tests.dart" as run_tests;
|
||||
import 'package:kernel/src/tool/dump.dart' as dump;
|
||||
import '../test/utils/io_utils.dart' show computeRepoDir;
|
||||
import '_fasta/abcompile.dart' as abcompile;
|
||||
@@ -16,7 +17,6 @@ import '_fasta/log_collector.dart' as log_collector;
|
||||
import '_fasta/outline.dart' as outline;
|
||||
import '_fasta/parser.dart' as parser;
|
||||
import '_fasta/scanner.dart' as scanner;
|
||||
import 'all_suites.dart' as all_suites;
|
||||
|
||||
final String repoDir = computeRepoDir();
|
||||
|
||||
@@ -90,8 +90,8 @@ Future<void> main(List<String> args) async {
|
||||
}
|
||||
break;
|
||||
case 'testing':
|
||||
mainFunction = all_suites.main;
|
||||
script = '${repoDir}/all_suites.dart';
|
||||
mainFunction = run_tests.main;
|
||||
script = '${repoDir}/pkg/testing/bin/testing.dart';
|
||||
scriptArguments.add('--config=${repoDir}/pkg/front_end/testing.json');
|
||||
break;
|
||||
case 'generate-messages':
|
||||
|
||||
@@ -70,27 +70,6 @@ Future<void> runMe(List<String> arguments, CreateContext f,
|
||||
}, logger: logger);
|
||||
}
|
||||
|
||||
Future<void> runSuites(
|
||||
CommandLine cl, TestRoot testRoot, Map<String, CreateContext> suites,
|
||||
{int shards = 1,
|
||||
int shard = 0,
|
||||
Logger logger = const StdoutLogger()}) async {
|
||||
return withErrorHandling(() async {
|
||||
if (cl.verbose) enableVerboseOutput();
|
||||
Set<String> selectedSuites = cl.selectedSuites;
|
||||
for (MapEntry<String, CreateContext> entry in suites.entries) {
|
||||
String suiteName = entry.key;
|
||||
if (selectedSuites.contains(entry.key)) {
|
||||
Chain suite = testRoot.getChain(suiteName)!;
|
||||
CreateContext createContext = entry.value;
|
||||
ChainContext context = await createContext(suite, {...cl.environment});
|
||||
await context.run(suite, Set<String>.from(cl.selectors),
|
||||
shards: shards, shard: shard, logger: logger);
|
||||
}
|
||||
}
|
||||
}, logger: logger);
|
||||
}
|
||||
|
||||
/// This is called from a `_test.dart` file, and helps integration in other
|
||||
/// test runner frameworks.
|
||||
///
|
||||
|
||||
@@ -55,15 +55,6 @@ class TestRoot {
|
||||
|
||||
List<RegExp> get excludedFromAnalysis => analyze.exclude;
|
||||
|
||||
Chain? getChain(String name) {
|
||||
for (Suite suite in suites) {
|
||||
if (suite is Chain && suite.name == name) {
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Iterable<Dart> get dartSuites {
|
||||
return List<Dart>.from(suites.whereType<Dart>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user