diff --git a/tools/engine_tool/BUILD.gn b/tools/engine_tool/BUILD.gn index 0f66898cfc520..0171d080b2fae 100644 --- a/tools/engine_tool/BUILD.gn +++ b/tools/engine_tool/BUILD.gn @@ -37,7 +37,7 @@ dart_test("gn_test") { } dart_test("build_command_test") { - main_dart = "test/build_command_test.dart" + main_dart = "test/commands/build_command_test.dart" } dart_test("entry_point_test") { @@ -45,11 +45,11 @@ dart_test("entry_point_test") { } dart_test("fetch_command_test") { - main_dart = "test/fetch_command_test.dart" + main_dart = "test/commands/fetch_command_test.dart" } dart_test("format_command_test") { - main_dart = "test/format_command_test.dart" + main_dart = "test/commands/format_command_test.dart" } dart_test("label_test") { @@ -57,7 +57,7 @@ dart_test("label_test") { } dart_test("lint_command_test") { - main_dart = "test/lint_command_test.dart" + main_dart = "test/commands/lint_command_test.dart" } dart_test("logger_test") { @@ -73,11 +73,11 @@ dart_test("proc_utils_test") { } dart_test("query_command_test") { - main_dart = "test/query_command_test.dart" + main_dart = "test/commands/query_command_test.dart" } dart_test("run_command_test") { - main_dart = "test/run_command_test.dart" + main_dart = "test/commands/run_command_test.dart" } dart_test("run_target_test") { @@ -85,7 +85,7 @@ dart_test("run_target_test") { } dart_test("test_command_test") { - main_dart = "test/test_command_test.dart" + main_dart = "test/commands/test_command_test.dart" } dart_test("typed_json_test") { diff --git a/tools/engine_tool/test/build_plan_test.dart b/tools/engine_tool/test/build_plan_test.dart index d5b55f555800f..529641fa2d8e4 100644 --- a/tools/engine_tool/test/build_plan_test.dart +++ b/tools/engine_tool/test/build_plan_test.dart @@ -9,7 +9,7 @@ import 'package:engine_tool/src/logger.dart'; import 'package:test/test.dart'; import 'src/test_build_configs.dart'; -import 'utils.dart'; +import 'src/utils.dart'; void main() { test('rbe defaults to true if detected', () { diff --git a/tools/engine_tool/test/build_command_test.dart b/tools/engine_tool/test/commands/build_command_test.dart similarity index 95% rename from tools/engine_tool/test/build_command_test.dart rename to tools/engine_tool/test/commands/build_command_test.dart index 12401b95bde13..615b16943e2bc 100644 --- a/tools/engine_tool/test/build_command_test.dart +++ b/tools/engine_tool/test/commands/build_command_test.dart @@ -5,16 +5,14 @@ import 'dart:convert' as convert; import 'dart:ffi'; -import 'package:engine_build_configs/engine_build_configs.dart'; import 'package:engine_tool/src/build_utils.dart'; import 'package:engine_tool/src/commands/command_runner.dart'; import 'package:engine_tool/src/logger.dart'; import 'package:path/path.dart' as path; import 'package:test/test.dart'; -import 'fixtures.dart' as fixtures; -import 'src/test_build_configs.dart'; -import 'utils.dart'; +import '../src/test_build_configs.dart'; +import '../src/utils.dart'; void main() { test('can find host runnable build', () async { @@ -401,20 +399,28 @@ void main() { test('local config name on the command line is correctly translated', () async { - final namespaceTestConfigs = BuilderConfig.fromJson( - path: 'ci/builders/namespace_test_config.json', - map: convert.jsonDecode(fixtures.configsToTestNamespacing) - as Map, + final builder = TestBuilderConfig(); + builder.addBuild( + name: 'linux/host_debug', + dimension: TestDroneDimension.linux, + targetDir: 'local_host_debug', ); - final configs = { - 'namespace_test_config': namespaceTestConfigs, - }; + builder.addBuild( + name: 'ci/host_debug', + dimension: TestDroneDimension.linux, + targetDir: 'ci/host_debug', + ); + final testEnv = TestEnvironment.withTestEngine(); addTearDown(testEnv.cleanup); final runner = ToolCommandRunner( environment: testEnv.environment, - configs: configs, + configs: { + 'namespace_test_config': builder.buildConfig( + path: 'ci/builders/namespace_test_config.json', + ), + }, ); final result = await runner.run([ 'build', @@ -428,20 +434,27 @@ void main() { }); test('ci config name on the command line is correctly translated', () async { - final namespaceTestConfigs = BuilderConfig.fromJson( - path: 'ci/builders/namespace_test_config.json', - map: convert.jsonDecode(fixtures.configsToTestNamespacing) - as Map, + final builder = TestBuilderConfig(); + builder.addBuild( + name: 'linux/host_debug', + dimension: TestDroneDimension.linux, + targetDir: 'local_host_debug', + ); + builder.addBuild( + name: 'ci/host_debug', + dimension: TestDroneDimension.linux, + targetDir: 'ci/host_debug', ); - final configs = { - 'namespace_test_config': namespaceTestConfigs, - }; final testEnv = TestEnvironment.withTestEngine(); addTearDown(testEnv.cleanup); final runner = ToolCommandRunner( environment: testEnv.environment, - configs: configs, + configs: { + 'namespace_test_config': builder.buildConfig( + path: 'ci/builders/namespace_test_config.json', + ), + }, ); final result = await runner.run([ 'build', diff --git a/tools/engine_tool/test/fetch_command_test.dart b/tools/engine_tool/test/commands/fetch_command_test.dart similarity index 100% rename from tools/engine_tool/test/fetch_command_test.dart rename to tools/engine_tool/test/commands/fetch_command_test.dart diff --git a/tools/engine_tool/test/format_command_test.dart b/tools/engine_tool/test/commands/format_command_test.dart similarity index 100% rename from tools/engine_tool/test/format_command_test.dart rename to tools/engine_tool/test/commands/format_command_test.dart diff --git a/tools/engine_tool/test/lint_command_test.dart b/tools/engine_tool/test/commands/lint_command_test.dart similarity index 100% rename from tools/engine_tool/test/lint_command_test.dart rename to tools/engine_tool/test/commands/lint_command_test.dart diff --git a/tools/engine_tool/test/query_command_test.dart b/tools/engine_tool/test/commands/query_command_test.dart similarity index 99% rename from tools/engine_tool/test/query_command_test.dart rename to tools/engine_tool/test/commands/query_command_test.dart index 4599a68bfeaf7..77edae6f36864 100644 --- a/tools/engine_tool/test/query_command_test.dart +++ b/tools/engine_tool/test/commands/query_command_test.dart @@ -9,8 +9,8 @@ import 'package:engine_tool/src/commands/command_runner.dart'; import 'package:logging/logging.dart' as log; import 'package:test/test.dart'; -import 'src/test_build_configs.dart'; -import 'utils.dart'; +import '../src/test_build_configs.dart'; +import '../src/utils.dart'; void main() { List stringsFromLogs(List logs) { diff --git a/tools/engine_tool/test/test_command_test.dart b/tools/engine_tool/test/commands/test_command_test.dart similarity index 98% rename from tools/engine_tool/test/test_command_test.dart rename to tools/engine_tool/test/commands/test_command_test.dart index 84ebc58eeb130..505f920adfbab 100644 --- a/tools/engine_tool/test/test_command_test.dart +++ b/tools/engine_tool/test/commands/test_command_test.dart @@ -5,8 +5,8 @@ import 'package:engine_tool/src/commands/command_runner.dart'; import 'package:test/test.dart'; -import 'src/test_build_configs.dart'; -import 'utils.dart'; +import '../src/test_build_configs.dart'; +import '../src/utils.dart'; void main() { test('test implicitly picks a configuration and executes tests', () async { diff --git a/tools/engine_tool/test/external_tools/flutter_tools_test.dart b/tools/engine_tool/test/external_tools/flutter_tools_test.dart index 4a080038b7716..61ef86e01edfb 100644 --- a/tools/engine_tool/test/external_tools/flutter_tools_test.dart +++ b/tools/engine_tool/test/external_tools/flutter_tools_test.dart @@ -11,7 +11,7 @@ import 'package:engine_tool/src/logger.dart'; import 'package:test/test.dart'; import '../src/matchers.dart'; -import '../utils.dart'; +import '../src/utils.dart'; void main() { test('devices handles a non-zero exit code', () async { diff --git a/tools/engine_tool/test/external_tools/gn_test.dart b/tools/engine_tool/test/external_tools/gn_test.dart index efd1a8c463ffd..b3e866816db3b 100644 --- a/tools/engine_tool/test/external_tools/gn_test.dart +++ b/tools/engine_tool/test/external_tools/gn_test.dart @@ -7,7 +7,7 @@ import 'package:engine_tool/src/label.dart'; import 'package:engine_tool/src/logger.dart'; import 'package:test/test.dart'; -import '../utils.dart'; +import '../src/utils.dart'; void main() { test('gn.desc handles a non-zero exit code', () async { diff --git a/tools/engine_tool/test/fixtures.dart b/tools/engine_tool/test/fixtures.dart deleted file mode 100644 index 42d7f24d95def..0000000000000 --- a/tools/engine_tool/test/fixtures.dart +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2013 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. - -String testConfig(String osDimension, String osPlatform, - {String suffix = ''}) => - ''' -{ - "builds": [ - { - "archives": [ - { - "name": "build_name$suffix", - "base_path": "base/path", - "type": "gcs", - "include_paths": ["include/path"], - "realm": "archive_realm" - } - ], - "drone_dimensions": [ - "os=$osDimension" - ], - "gclient_variables": { - "variable": false - }, - "gn": ["--gn-arg", "--lto", "--no-rbe"], - "name": "ci/build_name$suffix", - "description": "This is a very long description that will test that the help message is wrapped correctly at an appropriate number of characters.", - "ninja": { - "config": "build_name$suffix", - "targets": ["ninja_target"] - }, - "tests": [ - { - "language": "python3", - "name": "build_name$suffix tests", - "parameters": ["--test-params"], - "script": "test/script.py", - "contexts": ["context"] - } - ], - "generators": { - "tasks": [ - { - "name": "generator_task", - "language": "python", - "parameters": ["--gen-param"], - "scripts": ["gen/script.py"] - } - ] - } - }, - {}, - {}, - { - "drone_dimensions": [ - "os=$osDimension" - ], - "gn": ["--gn-arg", "--lto", "--no-rbe"], - "name": "$osPlatform/host_debug$suffix", - "ninja": { - "config": "host_debug$suffix", - "targets": ["ninja_target"] - } - }, - { - "drone_dimensions": [ - "os=$osDimension" - ], - "gn": ["--gn-arg", "--lto", "--no-rbe"], - "name": "$osPlatform/android_debug${suffix}_arm64", - "ninja": { - "config": "android_debug${suffix}_arm64", - "targets": ["ninja_target"] - } - }, - { - "drone_dimensions": [ - "os=$osDimension" - ], - "gn": ["--gn-arg", "--lto", "--rbe"], - "name": "ci/android_debug${suffix}_rbe_arm64", - "ninja": { - "config": "android_debug${suffix}_rbe_arm64", - "targets": ["ninja_target"] - } - } - ], - "generators": { - "tasks": [ - { - "name": "global generator task", - "parameters": ["--global-gen-param"], - "script": "global/gen_script.dart", - "language": "dart" - } - ] - }, - "tests": [ - { - "name": "global test", - "recipe": "engine_v2/tester_engine", - "drone_dimensions": [ - "os=$osDimension" - ], - "gclient_variables": { - "variable": false - }, - "dependencies": ["dependency"], - "test_dependencies": [ - { - "dependency": "test_dependency", - "version": "git_revision:3a77d0b12c697a840ca0c7705208e8622dc94603" - } - ], - "tasks": [ - { - "name": "global test task", - "parameters": ["--test-parameter"], - "script": "global/test/script.py" - } - ] - } - ] -} -'''; - -const String configsToTestNamespacing = ''' -{ - "builds": [ - { - "drone_dimensions": [ - "os=Linux" - ], - "gn": ["--gn-arg", "--lto", "--no-rbe"], - "name": "linux/host_debug", - "ninja": { - "config": "local_host_debug", - "targets": ["ninja_target"] - } - }, - { - "drone_dimensions": [ - "os=Linux" - ], - "gn": ["--gn-arg", "--lto", "--no-rbe"], - "name": "ci/host_debug", - "ninja": { - "config": "ci/host_debug", - "targets": ["ninja_target"] - } - } - ] -} -'''; - -String attachedDevices() => ''' -[ - { - "name": "sdk gphone64 arm64", - "id": "emulator-5554", - "isSupported": true, - "targetPlatform": "android-arm64", - "emulator": true, - "sdk": "Android 14 (API 34)", - "capabilities": { - "hotReload": true, - "hotRestart": true, - "screenshot": true, - "fastStart": true, - "flutterExit": true, - "hardwareRendering": true, - "startPaused": true - } - }, - { - "name": "macOS", - "id": "macos", - "isSupported": true, - "targetPlatform": "darwin", - "emulator": false, - "sdk": "macOS 14.3.1 23D60 darwin-arm64", - "capabilities": { - "hotReload": true, - "hotRestart": true, - "screenshot": false, - "fastStart": false, - "flutterExit": true, - "hardwareRendering": false, - "startPaused": true - } - }, - { - "name": "Mac Designed for iPad", - "id": "mac-designed-for-ipad", - "isSupported": true, - "targetPlatform": "darwin", - "emulator": false, - "sdk": "macOS 14.3.1 23D60 darwin-arm64", - "capabilities": { - "hotReload": true, - "hotRestart": true, - "screenshot": false, - "fastStart": false, - "flutterExit": true, - "hardwareRendering": false, - "startPaused": true - } - }, - { - "name": "Chrome", - "id": "chrome", - "isSupported": true, - "targetPlatform": "web-javascript", - "emulator": false, - "sdk": "Google Chrome 122.0.6261.94", - "capabilities": { - "hotReload": true, - "hotRestart": true, - "screenshot": false, - "fastStart": false, - "flutterExit": false, - "hardwareRendering": false, - "startPaused": true - } - } -] -'''; diff --git a/tools/engine_tool/test/utils.dart b/tools/engine_tool/test/src/utils.dart similarity index 100% rename from tools/engine_tool/test/utils.dart rename to tools/engine_tool/test/src/utils.dart diff --git a/tools/engine_tool/test/utils_test.dart b/tools/engine_tool/test/utils_test.dart index 84bae34edbd4f..1efbba989801f 100644 --- a/tools/engine_tool/test/utils_test.dart +++ b/tools/engine_tool/test/utils_test.dart @@ -4,7 +4,7 @@ import 'package:test/test.dart'; -import 'utils.dart'; +import 'src/utils.dart'; void main() async { final cannedProcesses = [