Don't rely on dart binary on PATH in run_test.py (flutter/engine#51302)

This commit is contained in:
Zachary Anderson 2024-03-08 23:49:32 +00:00 committed by GitHub
parent 976d528d71
commit 286169bb52
2 changed files with 8 additions and 5 deletions

View File

@ -1037,10 +1037,11 @@ def run_impeller_golden_tests(build_dir: str):
).joinpath('golden_tests_harvester')
with tempfile.TemporaryDirectory(prefix='impeller_golden') as temp_dir:
run_cmd([tests_path, f'--working_dir={temp_dir}'], cwd=build_dir)
dart_bin = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart')
golden_path = os.path.join('testing', 'impeller_golden_tests_output.txt')
script_path = os.path.join('tools', 'dir_contents_diff', 'bin', 'dir_contents_diff.dart')
diff_result = subprocess.run(
f'dart run {script_path} {golden_path} {temp_dir}',
f'{dart_bin} run {script_path} {golden_path} {temp_dir}',
check=False,
shell=True,
stdout=subprocess.PIPE,
@ -1052,9 +1053,8 @@ def run_impeller_golden_tests(build_dir: str):
raise RuntimeError('impeller_golden_tests diff failure')
with DirectoryChange(harvester_path):
run_cmd(['dart', 'pub', 'get'])
bin_path = Path('.').joinpath('bin').joinpath('golden_tests_harvester.dart')
run_cmd(['dart', 'run', str(bin_path), temp_dir])
run_cmd([dart_bin, 'run', str(bin_path), temp_dir])
def main():

View File

@ -1,3 +1,7 @@
// 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.
import 'dart:io' as io;
import 'package:litetest/litetest.dart';
@ -19,11 +23,10 @@ void main() {
return;
}
// Runs `../bin/dir_contents_diff.dart` with the given arguments.
(int, String) runSync(String goldenPath, String dirPath) {
final io.ProcessResult result = io.Process.runSync(
'dart',
io.Platform.resolvedExecutable,
<String>[binPath, goldenPath, dirPath],
);
return (result.exitCode, result.stdout ?? result.stderr);