diff --git a/.ci.yaml b/.ci.yaml index e84001fada595..45fa5085185b1 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -49,6 +49,14 @@ platform_properties: # https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/android/avd/proto # You may use those names for the android_virtual_device version. targets: + - name: Linux local_engine_builds + bringup: true + enabled_branches: + - main + recipe: engine_v2/engine_v2 + properties: + config_name: local_engine + - name: Linux linux_android_emulator_tests enabled_branches: - main diff --git a/ci/builders/local_engine.json b/ci/builders/local_engine.json index 0a27c7aee9810..7e6deb5a22b34 100644 --- a/ci/builders/local_engine.json +++ b/ci/builders/local_engine.json @@ -1,29 +1,95 @@ { "builds": [ { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "debug", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" + ], + "name": "macos/android_debug_arm64", + "ninja": { + "config": "android_debug_arm64", + "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "debug", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" ], + "name": "linux/android_debug_arm64", + "ninja": { + "config": "android_debug_arm64", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, "gn": [ "--runtime-mode", "debug", "--android", "--android-cpu=arm64", "--no-stripped", - "--no-lto" + "--no-lto", + "--rbe", + "--no-goma" ], - "name": "android_debug_arm64", + "name": "windows/android_debug_arm64", "ninja": { "config": "android_debug_arm64", "targets": [] } }, { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" ], + "gclient_variables": { + "use_rbe": true + }, "gn": [ "--runtime-mode", "debug", @@ -31,12 +97,20 @@ "--android", "--android-cpu=arm64", "--no-stripped", - "--no-lto" + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" ], - "name": "android_debug_unopt_arm64", + "name": "macos/android_debug_unopt_arm64", "ninja": { "config": "android_debug_unopt_arm64", "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } } }, { @@ -50,79 +124,384 @@ "--android", "--android-cpu=arm64", "--no-stripped", - "--no-lto" + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" ], - "name": "android_profile_arm64", + "name": "macos/android_profile_arm64", "ninja": { "config": "android_profile_arm64", "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } } }, { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "profile", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "linux/android_profile_arm64", + "ninja": { + "config": "android_profile_arm64", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "profile", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "windows/android_profile_arm64", + "ninja": { + "config": "android_profile_arm64", + "targets": [] + } + }, + { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "release", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" + ], + "name": "macos/android_release_arm64", + "ninja": { + "config": "android_release_arm64", + "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "release", + "--android", + "--android-cpu=arm64", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "linux/android_release_arm64", + "ninja": { + "config": "android_release_arm64", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" ], + "gclient_variables": { + "use_rbe": true + }, "gn": [ "--runtime-mode", "release", "--android", "--android-cpu=arm64", "--no-stripped", - "--no-lto" + "--no-lto", + "--rbe", + "--no-goma" ], - "name": "android_release_arm64", + "name": "windows/android_release_arm64", "ninja": { "config": "android_release_arm64", "targets": [] } }, { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "debug", + "--no-stripped", + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" + ], + "name": "macos/host_debug", + "ninja": { + "config": "host_debug", + "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "debug", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "linux/host_debug", + "ninja": { + "config": "host_debug", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, "gn": [ "--runtime-mode", "debug", "--no-stripped", - "--no-lto" + "--no-lto", + "--rbe", + "--no-goma" ], - "name": "host_debug", + "name": "windows/host_debug", "ninja": { "config": "host_debug", "targets": [] } }, { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, "gn": [ "--runtime-mode", "profile", "--no-stripped", - "--no-lto" + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" ], - "name": "host_profile", + "name": "macos/host_profile", "ninja": { "config": "host_profile", "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } } }, { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "profile", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "linux/host_profile", + "ninja": { + "config": "host_profile", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "profile", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma" + ], + "name": "windows/host_profile", + "ninja": { + "config": "host_profile", + "targets": [] + } + }, + { + "cas_archive": false, "drone_dimensions": [ "os=Mac-13", - "os=Linux" + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "release", + "--no-stripped", + "--no-lto", + "--xcode-symlinks", + "--rbe", + "--no-goma" + ], + "name": "macos/host_release", + "ninja": { + "config": "host_release", + "targets": [] + }, + "properties": { + "$flutter/osx_sdk": { + "sdk_version": "15a240d" + } + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Linux", + "device_type=none" + ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, + "gn": [ + "--runtime-mode", + "release", + "--no-stripped", + "--no-lto", + "--rbe", + "--no-goma", + "--xcode-symlinks" + ], + "name": "linux/host_release", + "ninja": { + "config": "host_release", + "targets": [] + } + }, + { + "cas_archive": false, + "drone_dimensions": [ + "os=Windows-10", + "device_type=none" ], + "gclient_variables": { + "download_android_deps": false, + "use_rbe": true + }, "gn": [ "--runtime-mode", "release", "--no-stripped", - "--no-lto" + "--no-lto", + "--rbe", + "--no-goma", + "--xcode-symlinks" ], - "name": "host_release", + "name": "windows/host_release", "ninja": { "config": "host_release", "targets": [] diff --git a/tools/engine_tool/lib/src/build_utils.dart b/tools/engine_tool/lib/src/build_utils.dart index 433f57ce9ab6c..95e52857a6ce0 100644 --- a/tools/engine_tool/lib/src/build_utils.dart +++ b/tools/engine_tool/lib/src/build_utils.dart @@ -65,6 +65,41 @@ void debugCheckBuilds(List builds) { } } +/// Transform the name of a build into the name presented and accepted by the +/// CLI +/// +/// If a name starts with '$OS/', it is a local development build, and the +/// mangled name has the '$OS/' part stripped off, where $OS is the value of +/// `platform.operatingSystem` in the passed-in `environment`. +/// +/// If the name does not start with '$OS/', then it must start with 'ci/' or +/// 'ci\' in which case the name is returned unchanged. +String mangleConfigName(Environment environment, String name) { + final String os = '${environment.platform.operatingSystem}/'; + if (name.startsWith(os)) { + return name.substring(os.length); + } + if (name.startsWith('ci/') || name.startsWith(r'ci\')) { + return name; + } + throw ArgumentError( + 'name argument must start with a valid platform name or "ci"', + ); +} + +/// Transform the mangled (CLI) name of a build into its true name in the build +/// config json file. +/// +/// This does the reverse of [mangleConfigName] taking the operating system +/// name from `environment`. +String demangleConfigName(Environment environment, String name) { + // The 'ci' prefix can be either 'ci/' or 'ci\'. + const String cif = 'ci/'; + const String cib = r'ci\'; + final String os = '${environment.platform.operatingSystem}/'; + return name.startsWith(cif) || name.startsWith(cib) ? name : '$os$name'; +} + /// Build the build target in the environment. Future runBuild(Environment environment, Build build, {List extraGnArgs = const [], diff --git a/tools/engine_tool/lib/src/commands/build_command.dart b/tools/engine_tool/lib/src/commands/build_command.dart index fc6a81dad54f8..2b5c2210fc42e 100644 --- a/tools/engine_tool/lib/src/commands/build_command.dart +++ b/tools/engine_tool/lib/src/commands/build_command.dart @@ -17,7 +17,9 @@ final class BuildCommand extends CommandBase { }) { builds = runnableBuilds(environment, configs); debugCheckBuilds(builds); - addConfigOption(argParser, runnableBuilds(environment, configs)); + addConfigOption( + environment, argParser, runnableBuilds(environment, configs), + ); argParser.addFlag( rbeFlag, defaultsTo: true, @@ -39,8 +41,9 @@ final class BuildCommand extends CommandBase { Future run() async { final String configName = argResults![configFlag] as String; final bool useRbe = argResults![rbeFlag] as bool; + final String demangledName = demangleConfigName(environment, configName); final Build? build = - builds.where((Build build) => build.name == configName).firstOrNull; + builds.where((Build build) => build.name == demangledName).firstOrNull; if (build == null) { environment.logger.error('Could not find config $configName'); return 1; diff --git a/tools/engine_tool/lib/src/commands/command.dart b/tools/engine_tool/lib/src/commands/command.dart index 3224f7654cc56..0ef132d808320 100644 --- a/tools/engine_tool/lib/src/commands/command.dart +++ b/tools/engine_tool/lib/src/commands/command.dart @@ -6,6 +6,7 @@ import 'package:args/args.dart'; import 'package:args/command_runner.dart'; import 'package:engine_build_configs/engine_build_configs.dart'; +import '../build_utils.dart'; import '../environment.dart'; import 'flags.dart'; @@ -19,18 +20,24 @@ abstract base class CommandBase extends Command { } /// Adds the -c (--config) option to the parser. -void addConfigOption(ArgParser parser, List builds, - {String defaultsTo = 'host_debug'}) { +void addConfigOption( + Environment environment, + ArgParser parser, + List builds, { + String defaultsTo = 'host_debug', +}) { parser.addOption( configFlag, abbr: 'c', defaultsTo: defaultsTo, help: 'Specify the build config to use', allowed: [ - for (final Build config in builds) config.name, + for (final Build config in builds) + mangleConfigName(environment, config.name), ], allowedHelp: { - for (final Build config in builds) config.name: config.gn.join(' '), + for (final Build config in builds) + mangleConfigName(environment, config.name): config.gn.join(' '), }, ); } diff --git a/tools/engine_tool/lib/src/commands/command_runner.dart b/tools/engine_tool/lib/src/commands/command_runner.dart index 12c1d09edb832..649ef75f28b58 100644 --- a/tools/engine_tool/lib/src/commands/command_runner.dart +++ b/tools/engine_tool/lib/src/commands/command_runner.dart @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'package:args/args.dart'; import 'package:args/command_runner.dart'; import 'package:engine_build_configs/engine_build_configs.dart'; import '../environment.dart'; +import '../logger.dart'; import 'build_command.dart'; import 'fetch_command.dart'; import 'flags.dart'; @@ -61,8 +63,13 @@ final class ToolCommandRunner extends CommandRunner { @override Future run(Iterable args) async { + final ArgResults argResults = parse(args); + final bool verbose = argResults[verboseFlag]! as bool; + if (verbose) { + environment.logger.level = Logger.infoLevel; + } try { - return await runCommand(parse(args)) ?? 0; + return await runCommand(argResults) ?? 0; } on FormatException catch (e) { environment.logger.error(e); return 1; diff --git a/tools/engine_tool/lib/src/commands/query_command.dart b/tools/engine_tool/lib/src/commands/query_command.dart index 6f4c6ee367e37..4b7fa50230c5b 100644 --- a/tools/engine_tool/lib/src/commands/query_command.dart +++ b/tools/engine_tool/lib/src/commands/query_command.dart @@ -140,7 +140,9 @@ final class QueryTestsCommand extends CommandBase { }) { builds = runnableBuilds(environment, configs); debugCheckBuilds(builds); - addConfigOption(argParser, runnableBuilds(environment, configs)); + addConfigOption( + environment, argParser, runnableBuilds(environment, configs), + ); } /// Build configurations loaded from the engine from under ci/builders. @@ -158,8 +160,9 @@ final class QueryTestsCommand extends CommandBase { @override Future run() async { final String configName = argResults![configFlag] as String; + final String demangledName = demangleConfigName(environment, configName); final Build? build = - builds.where((Build build) => build.name == configName).firstOrNull; + builds.where((Build build) => build.name == demangledName).firstOrNull; if (build == null) { environment.logger.error('Could not find config $configName'); return 1; diff --git a/tools/engine_tool/lib/src/commands/run_command.dart b/tools/engine_tool/lib/src/commands/run_command.dart index 35e5657c58941..61f289cfded02 100644 --- a/tools/engine_tool/lib/src/commands/run_command.dart +++ b/tools/engine_tool/lib/src/commands/run_command.dart @@ -23,8 +23,10 @@ final class RunCommand extends CommandBase { debugCheckBuilds(builds); // We default to nothing in order to automatically detect attached devices // and select an appropriate target from them. - addConfigOption(argParser, runnableBuilds(environment, configs), - defaultsTo: ''); + addConfigOption( + environment, argParser, runnableBuilds(environment, configs), + defaultsTo: '', + ); argParser.addFlag( rbeFlag, defaultsTo: true, @@ -47,26 +49,27 @@ final class RunCommand extends CommandBase { 'See `flutter run --help` for a listing'; Build? _lookup(String configName) { - return builds.where((Build build) => build.name == configName).firstOrNull; + final String demangledName = demangleConfigName(environment, configName); + return builds.where((Build build) => build.name == demangledName).firstOrNull; } Build? _findHostBuild(Build? targetBuild) { if (targetBuild == null) { return null; } - - final String name = targetBuild.name; - if (name.startsWith('host_')) { + final String mangledName = mangleConfigName(environment, targetBuild.name); + if (mangledName.contains('host_')) { return targetBuild; } // TODO(johnmccutchan): This is brittle, it would be better if we encoded // the host config name in the target config. - if (name.contains('_debug')) { - return _lookup('host_debug'); - } else if (name.contains('_profile')) { - return _lookup('host_profile'); - } else if (name.contains('_release')) { - return _lookup('host_release'); + final String ci = mangledName.startsWith('ci') ? mangledName.substring(0, 3) : ''; + if (mangledName.contains('_debug')) { + return _lookup('${ci}host_debug'); + } else if (mangledName.contains('_profile')) { + return _lookup('${ci}host_profile'); + } else if (mangledName.contains('_release')) { + return _lookup('${ci}host_release'); } return null; } @@ -101,13 +104,13 @@ final class RunCommand extends CommandBase { Future _selectTargetConfig() async { final String configName = argResults![configFlag] as String; if (configName.isNotEmpty) { - return configName; + return demangleConfigName(environment, configName); } final String deviceId = _getDeviceId(); final RunTarget? target = await detectAndSelectRunTarget(environment, deviceId); if (target == null) { - return 'host_debug'; + return demangleConfigName(environment, 'host_debug'); } environment.logger.status( 'Building to run on "${target.name}" running ${target.targetPlatform}'); diff --git a/tools/engine_tool/lib/src/commands/test_command.dart b/tools/engine_tool/lib/src/commands/test_command.dart index 7e7d82faae0ac..4ba6d6ac62206 100644 --- a/tools/engine_tool/lib/src/commands/test_command.dart +++ b/tools/engine_tool/lib/src/commands/test_command.dart @@ -23,7 +23,9 @@ final class TestCommand extends CommandBase { }) { builds = runnableBuilds(environment, configs); debugCheckBuilds(builds); - addConfigOption(argParser, runnableBuilds(environment, configs)); + addConfigOption( + environment, argParser, runnableBuilds(environment, configs), + ); } /// List of compatible builds. @@ -40,8 +42,9 @@ final class TestCommand extends CommandBase { @override Future run() async { final String configName = argResults![configFlag] as String; + final String demangledName = demangleConfigName(environment, configName); final Build? build = - builds.where((Build build) => build.name == configName).firstOrNull; + builds.where((Build build) => build.name == demangledName).firstOrNull; if (build == null) { environment.logger.error('Could not find config $configName'); return 1; diff --git a/tools/engine_tool/test/build_command_test.dart b/tools/engine_tool/test/build_command_test.dart index bc1c2344d6a13..062fdd408eea2 100644 --- a/tools/engine_tool/test/build_command_test.dart +++ b/tools/engine_tool/test/build_command_test.dart @@ -101,7 +101,7 @@ void main() { try { final List result = runnableBuilds(env, configs); expect(result.length, equals(8)); - expect(result[0].name, equals('build_name')); + expect(result[0].name, equals('ci/build_name')); } finally { cleanupEnv(env); } @@ -118,7 +118,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'build_name', + 'ci/build_name', ]); expect(result, equals(0)); expect(runHistory.length, greaterThanOrEqualTo(1)); @@ -140,7 +140,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'build_name', + 'ci/build_name', ]); expect(result, equals(0)); expect(runHistory.length, greaterThanOrEqualTo(2)); @@ -162,7 +162,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'build_name', + 'ci/build_name', ]); expect(result, equals(0)); expect(runHistory.length, greaterThanOrEqualTo(3)); @@ -186,7 +186,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'build_name', + 'ci/build_name', ]); expect(result, equals(0)); expect(runHistory.length, lessThanOrEqualTo(3)); @@ -208,7 +208,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'android_debug_rbe_arm64', + 'ci/android_debug_rbe_arm64', ]); expect(result, equals(0)); expect(runHistory[0][0], contains(path.join('tools', 'gn'))); @@ -232,7 +232,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'android_debug_rbe_arm64', + 'ci/android_debug_rbe_arm64', '--no-rbe', ]); expect(result, equals(0)); @@ -255,7 +255,7 @@ void main() { final int result = await runner.run([ 'build', '--config', - 'android_debug_rbe_arm64', + 'ci/android_debug_rbe_arm64', ]); expect(result, equals(0)); expect(runHistory[0][0], contains(path.join('tools', 'gn'))); @@ -265,4 +265,82 @@ void main() { cleanupEnv(env); } }); + + test('mangleConfigName removes the OS and adds ci/ as needed', () { + final Logger logger = Logger.test(); + final (Environment env, _) = linuxEnv(logger); + expect(mangleConfigName(env, 'linux/build'), equals('build')); + expect(mangleConfigName(env, 'ci/build'), equals('ci/build')); + }); + + test('mangleConfigName throws when the input config name is malformed', () { + final Logger logger = Logger.test(); + final (Environment env, _) = linuxEnv(logger); + expectArgumentError(() => mangleConfigName(env, 'build')); + }); + + test('demangleConfigName adds the OS and removes ci/ as needed', () { + final Logger logger = Logger.test(); + final (Environment env, _) = linuxEnv(logger); + expect(demangleConfigName(env, 'build'), equals('linux/build')); + expect(demangleConfigName(env, 'ci/build'), equals('ci/build')); + }); + + test('local config name on the command line is correctly translated', () async { + final BuilderConfig namespaceTestConfigs = BuilderConfig.fromJson( + path: 'ci/builders/namespace_test_config.json', + map: convert.jsonDecode(fixtures.configsToTestNamespacing) + as Map, + ); + final Map configs = { + 'namespace_test_config': namespaceTestConfigs, + }; + final Logger logger = Logger.test(); + final (Environment env, List> runHistory) = linuxEnv(logger); + try { + final ToolCommandRunner runner = ToolCommandRunner( + environment: env, + configs: configs, + ); + final int result = await runner.run([ + 'build', + '--config', + 'host_debug', + ]); + expect(result, equals(0)); + expect(runHistory[1][0], contains(path.join('ninja', 'ninja'))); + expect(runHistory[1][2], contains('local_host_debug')); + } finally { + cleanupEnv(env); + } + }); + + test('ci config name on the command line is correctly translated', () async { + final BuilderConfig namespaceTestConfigs = BuilderConfig.fromJson( + path: 'ci/builders/namespace_test_config.json', + map: convert.jsonDecode(fixtures.configsToTestNamespacing) + as Map, + ); + final Map configs = { + 'namespace_test_config': namespaceTestConfigs, + }; + final Logger logger = Logger.test(); + final (Environment env, List> runHistory) = linuxEnv(logger); + try { + final ToolCommandRunner runner = ToolCommandRunner( + environment: env, + configs: configs, + ); + final int result = await runner.run([ + 'build', + '--config', + 'ci/host_debug', + ]); + expect(result, equals(0)); + expect(runHistory[1][0], contains(path.join('ninja', 'ninja'))); + expect(runHistory[1][2], contains('ci/host_debug')); + } finally { + cleanupEnv(env); + } + }); } diff --git a/tools/engine_tool/test/fixtures.dart b/tools/engine_tool/test/fixtures.dart index 16096fe0ad618..e392fb72869af 100644 --- a/tools/engine_tool/test/fixtures.dart +++ b/tools/engine_tool/test/fixtures.dart @@ -22,7 +22,7 @@ String testConfig(String os) => ''' "variable": false }, "gn": ["--gn-arg", "--lto", "--goma", "--no-rbe"], - "name": "build_name", + "name": "ci/build_name", "ninja": { "config": "build_name", "targets": ["ninja_target"] @@ -54,7 +54,7 @@ String testConfig(String os) => ''' "os=$os" ], "gn": ["--gn-arg", "--lto", "--goma", "--no-rbe"], - "name": "host_debug", + "name": "linux/host_debug", "ninja": { "config": "host_debug", "targets": ["ninja_target"] @@ -65,7 +65,7 @@ String testConfig(String os) => ''' "os=$os" ], "gn": ["--gn-arg", "--lto", "--goma", "--no-rbe"], - "name": "android_debug_arm64", + "name": "linux/android_debug_arm64", "ninja": { "config": "android_debug_arm64", "targets": ["ninja_target"] @@ -76,7 +76,7 @@ String testConfig(String os) => ''' "os=$os" ], "gn": ["--gn-arg", "--lto", "--no-goma", "--rbe"], - "name": "android_debug_rbe_arm64", + "name": "ci/android_debug_rbe_arm64", "ninja": { "config": "android_debug_rbe_arm64", "targets": ["ninja_target"] @@ -122,6 +122,35 @@ String testConfig(String os) => ''' } '''; +const String configsToTestNamespacing = ''' +{ + "builds": [ + { + "drone_dimensions": [ + "os=Linux" + ], + "gn": ["--gn-arg", "--lto", "--goma", "--no-rbe"], + "name": "linux/host_debug", + "ninja": { + "config": "local_host_debug", + "targets": ["ninja_target"] + } + }, + { + "drone_dimensions": [ + "os=Linux" + ], + "gn": ["--gn-arg", "--lto", "--goma", "--no-rbe"], + "name": "ci/host_debug", + "ninja": { + "config": "ci/host_debug", + "targets": ["ninja_target"] + } + } + ] +} +'''; + String attachedDevices() => ''' [ { diff --git a/tools/engine_tool/test/query_command_test.dart b/tools/engine_tool/test/query_command_test.dart index b570ad2e28dac..b8af4894e46b2 100644 --- a/tools/engine_tool/test/query_command_test.dart +++ b/tools/engine_tool/test/query_command_test.dart @@ -89,15 +89,15 @@ fml_arc_unittests 'Add --verbose to see detailed information about each builder\n', '\n', '"linux_test_config" builder:\n', - ' "build_name" config\n', - ' "host_debug" config\n', - ' "android_debug_arm64" config\n', - ' "android_debug_rbe_arm64" config\n', + ' "ci/build_name" config\n', + ' "linux/host_debug" config\n', + ' "linux/android_debug_arm64" config\n', + ' "ci/android_debug_rbe_arm64" config\n', '"linux_test_config2" builder:\n', - ' "build_name" config\n', - ' "host_debug" config\n', - ' "android_debug_arm64" config\n', - ' "android_debug_rbe_arm64" config\n', + ' "ci/build_name" config\n', + ' "linux/host_debug" config\n', + ' "linux/android_debug_arm64" config\n', + ' "ci/android_debug_rbe_arm64" config\n', ]), ); }); @@ -124,10 +124,10 @@ fml_arc_unittests 'Add --verbose to see detailed information about each builder\n', '\n', '"linux_test_config" builder:\n', - ' "build_name" config\n', - ' "host_debug" config\n', - ' "android_debug_arm64" config\n', - ' "android_debug_rbe_arm64" config\n', + ' "ci/build_name" config\n', + ' "linux/host_debug" config\n', + ' "linux/android_debug_arm64" config\n', + ' "ci/android_debug_rbe_arm64" config\n', ])); }); diff --git a/tools/engine_tool/test/run_command_test.dart b/tools/engine_tool/test/run_command_test.dart index 9c2352fdb1864..60105eb09b326 100644 --- a/tools/engine_tool/test/run_command_test.dart +++ b/tools/engine_tool/test/run_command_test.dart @@ -152,9 +152,9 @@ void main() { 'flutter', 'run', '--local-engine', - 'android_debug_arm64', + 'linux/android_debug_arm64', '--local-engine-host', - 'host_debug', + 'linux/host_debug', '-d', 'emulator' ]));