[CFE] Include .crash_dart in weak tests; better handling of erroneous -D parameters and expectationFileMismatchSerialized on -DupdateExpectations=true
Change-Id: I00da3e4cf8859c65a8d93600804c7dbc56ec0bca Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192180 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
3930eb8fce
commit
20cfdeffe5
@@ -162,6 +162,8 @@ import 'package:vm/target/vm.dart' show VmTarget;
|
||||
import 'package:vm/transformations/type_flow/transformer.dart' as type_flow;
|
||||
import 'package:vm/transformations/pragma.dart' as type_flow;
|
||||
|
||||
import '../../testing_utils.dart' show checkEnvironment;
|
||||
|
||||
import '../../utils/kernel_chain.dart'
|
||||
show
|
||||
ComponentResult,
|
||||
@@ -376,13 +378,11 @@ class FastaContext extends ChainContext with MatchContext {
|
||||
steps.add(new MatchExpectation(
|
||||
fullCompile ? "$fullPrefix.expect" : "$outlinePrefix.expect",
|
||||
serializeFirst: false,
|
||||
isLastMatchStep: updateExpectations));
|
||||
if (!updateExpectations) {
|
||||
steps.add(new MatchExpectation(
|
||||
fullCompile ? "$fullPrefix.expect" : "$outlinePrefix.expect",
|
||||
serializeFirst: true,
|
||||
isLastMatchStep: true));
|
||||
}
|
||||
isLastMatchStep: false));
|
||||
steps.add(new MatchExpectation(
|
||||
fullCompile ? "$fullPrefix.expect" : "$outlinePrefix.expect",
|
||||
serializeFirst: true,
|
||||
isLastMatchStep: true));
|
||||
}
|
||||
steps.add(const TypeCheck());
|
||||
steps.add(const EnsureNoErrors());
|
||||
@@ -723,6 +723,23 @@ class FastaContext extends ChainContext with MatchContext {
|
||||
|
||||
static Future<FastaContext> create(
|
||||
Chain suite, Map<String, String> environment) async {
|
||||
const Set<String> knownEnvironmentKeys = {
|
||||
"enableExtensionMethods",
|
||||
"enableNonNullable",
|
||||
"soundNullSafety",
|
||||
"onlyCrashes",
|
||||
"ignoreExpectations",
|
||||
UPDATE_EXPECTATIONS,
|
||||
UPDATE_COMMENTS,
|
||||
"skipVm",
|
||||
"semiFuzz",
|
||||
"verify",
|
||||
KERNEL_TEXT_SERIALIZATION,
|
||||
"platformBinaries",
|
||||
ENABLE_FULL_COMPILE,
|
||||
};
|
||||
checkEnvironment(environment, knownEnvironmentKeys);
|
||||
|
||||
String resolvedExecutable = Platform.environment['resolvedExecutable'] ??
|
||||
Platform.resolvedExecutable;
|
||||
Uri vm = Uri.base.resolveUri(new Uri.file(resolvedExecutable));
|
||||
|
||||
@@ -43,7 +43,9 @@ void checkEnvironment(
|
||||
Set<String> environmentKeys = environment.keys.toSet();
|
||||
environmentKeys.removeAll(knownEnvironmentKeys);
|
||||
if (environmentKeys.isNotEmpty) {
|
||||
throw "Unknown environment(s) given: ${environmentKeys.toList()}.\n"
|
||||
"Knows about ${knownEnvironmentKeys.toList()}";
|
||||
throw "Unknown environment(s) given:"
|
||||
"\n - ${environmentKeys.join("\n- ")}\n"
|
||||
"Knows about these environment(s):"
|
||||
"\n - ${knownEnvironmentKeys.join("\n - ")}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,9 @@ abstract class MatchContext implements ChainContext {
|
||||
expectationSet["ExpectationFileMissing"];
|
||||
|
||||
Future<Result<O>> match<O>(String suffix, String actual, Uri uri, O output,
|
||||
{Expectation onMismatch}) async {
|
||||
{Expectation onMismatch, bool overwriteUpdateExpectationsWith}) async {
|
||||
bool updateExpectations =
|
||||
overwriteUpdateExpectationsWith ?? this.updateExpectations;
|
||||
actual = actual.trim();
|
||||
if (actual.isNotEmpty) {
|
||||
actual += "\n";
|
||||
@@ -338,7 +340,8 @@ class MatchExpectation
|
||||
return context.match<ComponentResult>(suffix, actual, uri, result,
|
||||
onMismatch: serializeFirst
|
||||
? context.expectationFileMismatchSerialized
|
||||
: context.expectationFileMismatch);
|
||||
: context.expectationFileMismatch,
|
||||
overwriteUpdateExpectationsWith: serializeFirst ? false : null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,8 @@
|
||||
"path": "testcases/",
|
||||
"status": "testcases/weak.status",
|
||||
"pattern": [
|
||||
"\\.dart$"
|
||||
"\\.dart$",
|
||||
"\\.crash_dart$"
|
||||
],
|
||||
"exclude": [
|
||||
"/testcases/.*_part[0-9]*\\.dart$",
|
||||
|
||||
Reference in New Issue
Block a user