Refactor realm_checker (#145905)

Refactor realm_checker suite in order to reduce testing logic in test.dart and allow for later implementing package:test onto the existing realm_checker tests

Part of https://github.com/flutter/flutter/issues/145482

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
Jesse 2024-04-01 17:49:19 -04:00 committed by GitHub
parent 9fd9f042fc
commit f8a06f6418
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 9 deletions

View File

@ -0,0 +1,18 @@
// Copyright 2014 The Flutter Authors. 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 File;
import 'package:path/path.dart' as path;
import '../utils.dart';
Future<void> realmCheckerTestRunner(String flutterRoot) async {
final String engineRealmFile = path.join(flutterRoot, 'bin', 'internal', 'engine.realm');
final String engineRealm = File(engineRealmFile).readAsStringSync().trim();
if (engineRealm.isNotEmpty) {
foundError(<String>['The checked-in engine.realm file must be empty.']);
}
}

View File

@ -66,6 +66,7 @@ import 'package:process/process.dart';
import 'run_command.dart';
import 'suite_runners/run_add_to_app_life_cycle_tests.dart';
import 'suite_runners/run_flutter_packages_tests.dart';
import 'suite_runners/run_realm_checker_tests.dart';
import 'suite_runners/run_skp_generator_tests.dart';
import 'suite_runners/run_web_long_running_tests.dart';
import 'tool_subsharding.dart';
@ -88,7 +89,6 @@ final String flutter = path.join(flutterRoot, 'bin', 'flutter$bat');
final String dart = path.join(flutterRoot, 'bin', 'cache', 'dart-sdk', 'bin', 'dart$exe');
final String pubCache = path.join(flutterRoot, '.pub-cache');
final String engineVersionFile = path.join(flutterRoot, 'bin', 'internal', 'engine.version');
final String engineRealmFile = path.join(flutterRoot, 'bin', 'internal', 'engine.realm');
String get platformFolderName {
if (Platform.isWindows) {
@ -250,7 +250,7 @@ Future<void> main(List<String> args) async {
'web_long_running_tests': () => webLongRunningTestsRunner(flutterRoot),
'flutter_plugins': () => flutterPackagesRunner(flutterRoot),
'skp_generator': skpGeneratorTestsRunner,
'realm_checker': _runRealmCheckerTest,
'realm_checker': () => realmCheckerTestRunner(flutterRoot),
'customer_testing': _runCustomerTesting,
'analyze': _runAnalyze,
'fuchsia_precache': _runFuchsiaPrecache,
@ -1652,13 +1652,6 @@ Future<bool> hasExpectedEntitlements(
return passes;
}
Future<void> _runRealmCheckerTest() async {
final String engineRealm = File(engineRealmFile).readAsStringSync().trim();
if (engineRealm.isNotEmpty) {
foundError(<String>['The checked-in engine.realm file must be empty.']);
}
}
Future<void> runFlutterWebTest(
String webRenderer,
String workingDirectory,