In run_tests.py, separate Dart package unit tests from other tests (flutter/engine#46232)

This PR creates a new test type for `run_tests.py` called `dart-host`.
The tests remaining under the `dart` type are tests that run in
`flutter_tester`. The `dart-host` tests run in the Dart CLI. This allows
`run_tests.py` to be simplified a bit, and while doing this I spotted a
couple of mistakes that were causing some tests not to run.

This PR also makes a couple of small style fixes to the build config
json files, converting tabs to spaces, and moving some "script" fields
before the "parameters" fields.
This commit is contained in:
Zachary Anderson
2023-09-24 18:22:27 -07:00
committed by GitHub
parent 6dbf929c16
commit 594738f2d5
14 changed files with 185 additions and 305 deletions

View File

@@ -38,6 +38,7 @@
{
"language": "python3",
"name": "Host Tests for android_jit_release_x86",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"android_jit_release_x86",
@@ -46,8 +47,7 @@
"--engine-capture-core-dump",
"--android-variant",
"android_jit_release_x86"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -93,6 +93,7 @@
{
"language": "python3",
"name": "Host Tests for android_debug",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"android_debug",
@@ -101,8 +102,7 @@
"--engine-capture-core-dump",
"--android-variant",
"android_debug"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},

View File

@@ -154,7 +154,7 @@
"--engine-version",
"${REVISION}",
"--skip-build",
"--upload"
"--upload"
],
"script": "flutter/tools/fuchsia/build_fuchsia_artifacts.py",
"language": "python3"

View File

@@ -53,14 +53,14 @@
{
"language": "python3",
"name": "Host Tests for host_debug_impeller_vulkan",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug_impeller_vulkan",
"--type",
"impeller-vulkan",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -110,14 +110,14 @@
{
"language": "python3",
"name": "Host Tests for host_debug",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug",
"--type",
"dart",
"dart,dart-host",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -158,14 +158,14 @@
{
"language": "python3",
"name": "Host Tests for host_profile",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_profile",
"--type",
"dart,engine",
"dart,dart-host,engine",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -216,14 +216,14 @@
{
"language": "python3",
"name": "Host Tests for host_release",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_release",
"--type",
"dart,engine,benchmarks",
"dart,dart-host,engine,benchmarks",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"language": "bash",
@@ -233,10 +233,10 @@
{
"language": "bash",
"name": "Upload metrics dry-run",
"parameters": [
"script": "flutter/testing/benchmark/upload_metrics.sh",
"parameters": [
"--no-upload"
],
"script": "flutter/testing/benchmark/upload_metrics.sh"
]
}
]
}

View File

@@ -38,15 +38,15 @@
{
"language": "python3",
"name": "test: Host_Tests_for_host_debug_unopt",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug_unopt",
"--type",
"dart,engine",
"dart,dart-host,engine",
"--engine-capture-core-dump",
"--use-sanitizer-suppressions"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"name": "analyze_dart_ui",
@@ -104,6 +104,7 @@
{
"language": "python3",
"name": "test: Host Tests for android_debug_unopt",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"android_debug_unopt",
@@ -112,20 +113,19 @@
"--engine-capture-core-dump",
"--android-variant",
"android_debug_unopt"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"language": "python3",
"name": "malioc diff",
"script": "flutter/impeller/tools/malioc_diff.py",
"parameters": [
"--before-relative-to-src",
"flutter/impeller/tools/malioc.json",
"--after-relative-to-src",
"out/android_debug_unopt/gen/malioc",
"--print-diff"
],
"script": "flutter/impeller/tools/malioc_diff.py"
]
}
]
}

View File

@@ -9,7 +9,7 @@
"out/android_profile/zip_archives/android-arm-profile/darwin-x64.zip"
],
"name": "android_profile",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [
@@ -48,7 +48,7 @@
"out/android_profile_arm64/zip_archives/android-arm64-profile/darwin-x64.zip"
],
"name": "android_profile_arm64",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [
@@ -88,7 +88,7 @@
"out/android_profile_x64/zip_archives/android-x64-profile/darwin-x64.zip"
],
"name": "android_profile_x64",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [
@@ -128,7 +128,7 @@
"out/android_release/zip_archives/android-arm-release/darwin-x64.zip"
],
"name": "android_release",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [
@@ -167,7 +167,7 @@
"out/android_release_arm64/zip_archives/android-arm64-release/darwin-x64.zip"
],
"name": "android_release_arm64",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [
@@ -207,7 +207,7 @@
"out/android_release_x64/zip_archives/android-x64-release/darwin-x64.zip"
],
"name": "android_release_x64",
"realm": "production"
"realm": "production"
}
],
"drone_dimensions": [

View File

@@ -72,7 +72,7 @@
"--shard-id=0",
"--shard-variants=host_debug,host_debug,host_debug"
],
"max_attempts": 1,
"max_attempts": 1,
"script": "flutter/ci/clang_tidy.sh"
}
]
@@ -201,7 +201,7 @@
"--shard-id=0",
"--shard-variants=host_debug"
],
"max_attempts": 1,
"max_attempts": 1,
"script": "flutter/ci/clang_tidy.sh"
}
]

View File

@@ -54,14 +54,14 @@
{
"language": "python3",
"name": "Host Tests for host_debug",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug",
"--type",
"dart,engine",
"dart,dart-host,engine",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -113,14 +113,14 @@
{
"language": "python3",
"name": "Host Tests for host_profile",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_profile",
"--type",
"dart,engine",
"dart,dart-host,engine",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -183,13 +183,13 @@
{
"language": "python3",
"name": "Impeller-golden, dart and engine tests for host_release",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_release",
"--type",
"dart,engine,impeller-golden"
],
"script": "flutter/testing/run_tests.py"
"dart,dart-host,engine,impeller-golden"
]
}
]
},

View File

@@ -40,14 +40,14 @@
{
"language": "python3",
"name": "Host Tests for host_debug_unopt",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug_unopt",
"--type",
"dart,engine",
"dart,dart-host,engine",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},
@@ -96,6 +96,7 @@
{
"language": "python3",
"name": "Tests for ios_debug_sim",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"ios_debug_sim",
@@ -104,8 +105,7 @@
"--engine-capture-core-dump",
"--ios-variant",
"ios_debug_sim"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"name": "Scenario App Integration Tests",
@@ -205,6 +205,7 @@
{
"language": "python3",
"name": "Tests for ios_debug_sim_arm64",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"ios_debug_sim_arm64",
@@ -213,8 +214,7 @@
"--engine-capture-core-dump",
"--ios-variant",
"ios_debug_sim_arm64"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"name": "Scenario App Integration Tests",
@@ -276,6 +276,7 @@
{
"language": "python3",
"name": "Tests for ios_debug_sim_arm64_extension_safe",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"ios_debug_sim_arm64_extension_safe",
@@ -284,8 +285,7 @@
"--engine-capture-core-dump",
"--ios-variant",
"ios_debug_sim_arm64_extension_safe"
],
"script": "flutter/testing/run_tests.py"
]
},
{
"name": "Scenario App Integration Tests",

View File

@@ -25,13 +25,13 @@
"contexts": [
"android_virtual_device"
],
"parameters": [
"--android-variant",
"android_debug_x64",
"--type",
"android"
],
"script": "flutter/testing/run_tests.py"
"script": "flutter/testing/run_tests.py",
"parameters": [
"--android-variant",
"android_debug_x64",
"--type",
"android"
]
},
{
"language": "bash",
@@ -39,10 +39,10 @@
"contexts": [
"android_virtual_device"
],
"parameters": [
"android_debug_x64"
],
"script": "flutter/testing/scenario_app/run_android_tests.sh"
"script": "flutter/testing/scenario_app/run_android_tests.sh",
"parameters": [
"android_debug_x64"
]
}
]
}

View File

@@ -11,7 +11,7 @@
"tests": [
{
"name": "licenses check",
"max_attempts": 1,
"max_attempts": 1,
"script": "flutter/ci/licenses.sh"
}
]

View File

@@ -26,14 +26,14 @@
{
"language": "python3",
"name": "test: Host Tests for host_debug_unopt",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug_unopt",
"--type",
"engine",
"--engine-capture-core-dump"
],
"script": "flutter/testing/run_tests.py"
]
}
]
}

View File

@@ -46,13 +46,13 @@
{
"language": "python3",
"name": "Host Tests for host_debug",
"script": "flutter/testing/run_tests.py",
"parameters": [
"--variant",
"host_debug",
"--type",
"engine"
],
"script": "flutter/testing/run_tests.py"
]
}
]
},

View File

@@ -863,83 +863,85 @@ def gather_dart_tests(build_dir, test_filter):
yield gather_dart_test(build_dir, dart_test_file, False)
def gather_dart_smoke_test(build_dir):
def gather_dart_smoke_test(build_dir, test_filter):
smoke_test = os.path.join(
BUILDROOT_DIR, 'flutter', 'testing', 'smoke_test_failure',
'fail_test.dart'
BUILDROOT_DIR,
'flutter',
'testing',
'smoke_test_failure',
'fail_test.dart',
)
yield gather_dart_test(build_dir, smoke_test, True, expect_failure=True)
yield gather_dart_test(build_dir, smoke_test, False, expect_failure=True)
if test_filter is not None and os.path.basename(smoke_test
) not in test_filter:
logger.info("Skipping '%s' due to filter.", smoke_test)
else:
yield gather_dart_test(build_dir, smoke_test, True, expect_failure=True)
yield gather_dart_test(build_dir, smoke_test, False, expect_failure=True)
def gather_front_end_server_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'flutter_frontend_server')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
def gather_dart_package_tests(build_dir, package_path, extra_opts):
dart_tests = glob.glob('%s/test/*_test.dart' % package_path)
if not dart_tests:
raise Exception('No tests found for Dart package at %s' % package_path)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev', dart_test_file, build_dir,
os.path.join(build_dir, 'gen', 'frontend_server.dart.snapshot'),
os.path.join(build_dir, 'flutter_patched_sdk')
]
opts = ['--disable-dart-dev', dart_test_file] + extra_opts
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
cwd=package_path
)
def gather_path_ops_tests(build_dir):
# TODO(dnfield): https://github.com/flutter/flutter/issues/107321
if is_asan(build_dir):
return
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'path_ops', 'dart', 'test'
)
opts = ['--disable-dart-dev', os.path.join(test_dir, 'path_ops_test.dart')]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_const_finder_tests(build_dir):
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'const_finder', 'test'
)
opts = [
'--disable-dart-dev',
os.path.join(test_dir, 'const_finder_test.dart'),
os.path.join(build_dir, 'gen', 'frontend_server.dart.snapshot'),
os.path.join(build_dir, 'flutter_patched_sdk'),
os.path.join(build_dir, 'dart-sdk', 'lib', 'libraries.json')
# Returns a list of Dart packages to test.
#
# The first element of each tuple in the returned list is the path to the Dart
# package to test. It is assumed that the packages follow the convention that
# tests are named as '*_test.dart', and reside under a directory called 'test'.
#
# The second element of each tuple is a list of additional command line
# arguments to pass to each of the packages tests.
def build_dart_host_test_list(build_dir):
dart_host_tests = [
(
os.path.join('flutter', 'ci'),
[os.path.join(BUILDROOT_DIR, 'flutter')],
),
(
os.path.join('flutter', 'flutter_frontend_server'),
[
build_dir,
os.path.join(build_dir, 'gen', 'frontend_server.dart.snapshot'),
os.path.join(build_dir, 'flutter_patched_sdk')
],
),
(os.path.join('flutter', 'testing', 'litetest'), []),
(
os.path.join('flutter', 'tools', 'api_check'),
[os.path.join(BUILDROOT_DIR, 'flutter')],
),
(os.path.join('flutter', 'tools', 'build_bucket_golden_scraper'), []),
(os.path.join('flutter', 'tools', 'clang_tidy'), []),
(
os.path.join('flutter', 'tools', 'const_finder'),
[
os.path.join(build_dir, 'gen', 'frontend_server.dart.snapshot'),
os.path.join(build_dir, 'flutter_patched_sdk'),
os.path.join(build_dir, 'dart-sdk', 'lib', 'libraries.json'),
],
),
(os.path.join('flutter', 'tools', 'githooks'), []),
(os.path.join('flutter', 'tools', 'pkg', 'engine_build_configs'), []),
(os.path.join('flutter', 'tools', 'pkg', 'engine_repo_tools'), []),
(os.path.join('flutter', 'tools', 'pkg', 'git_repo_tools'), []),
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
if not is_asan(build_dir):
dart_host_tests += [
(os.path.join('flutter', 'tools', 'path_ops', 'dart'), []),
]
def gather_litetest_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'testing', 'litetest')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = ['--disable-dart-dev', dart_test_file]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
return dart_host_tests
def run_benchmark_tests(build_dir):
@@ -956,157 +958,6 @@ def run_benchmark_tests(build_dir):
)
def gather_githooks_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'githooks')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = ['--disable-dart-dev', dart_test_file]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_clang_tidy_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'clang_tidy')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev', dart_test_file,
os.path.join(build_dir, 'compile_commands.json'),
os.path.join(BUILDROOT_DIR, 'flutter')
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_build_bucket_golden_scraper_tests(build_dir):
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'build_bucket_golden_scraper'
)
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev',
dart_test_file,
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_engine_build_configs_tests(build_dir):
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'pkg', 'engine_build_configs'
)
dart_tests = glob.glob('%s/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev',
dart_test_file,
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_engine_repo_tools_tests(build_dir):
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'pkg', 'engine_repo_tools'
)
dart_tests = glob.glob('%s/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev',
dart_test_file,
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_git_repo_tools_tests(build_dir):
test_dir = os.path.join(
BUILDROOT_DIR, 'flutter', 'tools', 'pkg', 'git_repo_tools'
)
dart_tests = glob.glob('%s/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev',
dart_test_file,
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_api_consistency_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'api_check')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev', dart_test_file,
os.path.join(BUILDROOT_DIR, 'flutter')
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def gather_ci_tests(build_dir):
test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'ci')
dart_tests = glob.glob('%s/test/*_test.dart' % test_dir)
run_engine_executable(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=['pub', 'get', '--offline'],
cwd=test_dir,
)
for dart_test_file in dart_tests:
opts = [
'--disable-dart-dev', dart_test_file,
os.path.join(BUILDROOT_DIR, 'flutter')
]
yield EngineExecutableTask(
build_dir,
os.path.join('dart-sdk', 'bin', 'dart'),
None,
flags=opts,
cwd=test_dir
)
def worker_init(queue, level):
queue_handler = logging.handlers.QueueHandler(queue)
log = logging.getLogger(__name__)
@@ -1204,6 +1055,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
all_types = [
'engine',
'dart',
'dart-host',
'benchmarks',
'java',
'android',
@@ -1236,7 +1088,13 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
'--dart-filter',
type=str,
default='',
help='A list of Dart test scripts to run.'
help='A list of Dart test scripts to run in flutter_tester.'
)
parser.add_argument(
'--dart-host-filter',
type=str,
default='',
help='A list of Dart test scripts to run with the Dart CLI.'
)
parser.add_argument(
'--java-filter',
@@ -1367,22 +1225,28 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
if 'dart' in types:
dart_filter = args.dart_filter.split(',') if args.dart_filter else None
tasks = list(gather_dart_smoke_test(build_dir))
tasks += list(gather_litetest_tests(build_dir))
tasks += list(gather_githooks_tests(build_dir))
tasks += list(gather_clang_tidy_tests(build_dir))
tasks += list(gather_build_bucket_golden_scraper_tests(build_dir))
tasks += list(gather_engine_build_configs_tests(build_dir))
tasks += list(gather_engine_repo_tools_tests(build_dir))
tasks += list(gather_git_repo_tools_tests(build_dir))
tasks += list(gather_api_consistency_tests(build_dir))
tasks += list(gather_path_ops_tests(build_dir))
tasks += list(gather_const_finder_tests(build_dir))
tasks += list(gather_front_end_server_tests(build_dir))
tasks += list(gather_ci_tests(build_dir))
tasks = list(gather_dart_smoke_test(build_dir, dart_filter))
tasks += list(gather_dart_tests(build_dir, dart_filter))
success = success and run_engine_tasks_in_parallel(tasks)
if 'dart-host' in types:
dart_filter = args.dart_host_filter.split(
','
) if args.dart_host_filter else None
dart_host_packages = build_dart_host_test_list(build_dir)
tasks = []
for dart_host_package, extra_opts in dart_host_packages:
if dart_filter is None or dart_host_package in dart_filter:
tasks += list(
gather_dart_package_tests(
build_dir,
os.path.join(BUILDROOT_DIR, dart_host_package),
extra_opts,
)
)
success = success and run_engine_tasks_in_parallel(tasks)
if 'java' in types:
assert not is_windows(
), "Android engine files can't be compiled on Windows."

View File

@@ -202,20 +202,36 @@ void main() {
try {
// Create a valid engine.
io.Directory(p.join(emptyDir.path, 'src', 'flutter')).createSync(recursive: true);
io.Directory(p.join(emptyDir.path, 'src', 'out')).createSync(recursive: true);
final io.Directory srcDir = io.Directory(p.join(emptyDir.path, 'src'))
..createSync(recursive: true);
final io.Directory flutterDir = io.Directory(p.join(srcDir.path, 'flutter'))
..createSync(recursive: true);
final io.Directory outDir = io.Directory(p.join(srcDir.path, 'out'))
..createSync(recursive: true);
// Create two targets in out: host_debug and host_debug_unopt_arm64.
io.Directory(p.join(emptyDir.path, 'src', 'out', 'host_debug')).createSync(recursive: true);
io.Directory(p.join(emptyDir.path, 'src', 'out', 'host_debug_unopt_arm64')).createSync(recursive: true);
final io.Directory hostDebug = io.Directory(p.join(outDir.path, 'host_debug'))
..createSync(recursive: true);
final io.Directory hostDebugUnoptArm64 = io.Directory(
p.join(outDir.path, 'host_debug_unopt_arm64'),
)..createSync(recursive: true);
// Intentionnally make host_debug a day old to ensure it is not picked.
final io.File oldJson = io.File(p.join(emptyDir.path, 'src', 'out', 'host_debug', 'compile_commands.json'))..createSync();
oldJson.setLastModifiedSync(oldJson.lastModifiedSync().subtract(const Duration(days: 1)));
final Engine engine = TestEngine.withPaths(
srcDir: srcDir,
flutterDir: flutterDir,
outDir: outDir,
outputs: <TestOutput>[
TestOutput(
hostDebug,
lastModified: DateTime.utc(2023, 9, 23, 21, 16),
),
TestOutput(
hostDebugUnoptArm64,
lastModified: DateTime.utc(2023, 9, 23, 22, 16),
),
],
);
io.File(p.join(emptyDir.path, 'src', 'out', 'host_debug_unopt_arm64', 'compile_commands.json')).createSync();
final Engine engine = Engine.fromSrcPath(p.join(emptyDir.path, 'src'));
final Output? latestOutput = engine.latestOutput();
expect(latestOutput, isNotNull);
expect(p.basename(latestOutput!.path.path), 'host_debug_unopt_arm64');