Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit b0d3663

Browse files
authored
Don't rely on dart binary on PATH in run_test.py (#51302)
1 parent 767c25d commit b0d3663

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

testing/run_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,10 +1037,11 @@ def run_impeller_golden_tests(build_dir: str):
10371037
).joinpath('golden_tests_harvester')
10381038
with tempfile.TemporaryDirectory(prefix='impeller_golden') as temp_dir:
10391039
run_cmd([tests_path, f'--working_dir={temp_dir}'], cwd=build_dir)
1040+
dart_bin = os.path.join(build_dir, 'dart-sdk', 'bin', 'dart')
10401041
golden_path = os.path.join('testing', 'impeller_golden_tests_output.txt')
10411042
script_path = os.path.join('tools', 'dir_contents_diff', 'bin', 'dir_contents_diff.dart')
10421043
diff_result = subprocess.run(
1043-
f'dart run {script_path} {golden_path} {temp_dir}',
1044+
f'{dart_bin} run {script_path} {golden_path} {temp_dir}',
10441045
check=False,
10451046
shell=True,
10461047
stdout=subprocess.PIPE,
@@ -1052,9 +1053,8 @@ def run_impeller_golden_tests(build_dir: str):
10521053
raise RuntimeError('impeller_golden_tests diff failure')
10531054

10541055
with DirectoryChange(harvester_path):
1055-
run_cmd(['dart', 'pub', 'get'])
10561056
bin_path = Path('.').joinpath('bin').joinpath('golden_tests_harvester.dart')
1057-
run_cmd(['dart', 'run', str(bin_path), temp_dir])
1057+
run_cmd([dart_bin, 'run', str(bin_path), temp_dir])
10581058

10591059

10601060
def main():

tools/dir_contents_diff/test/dir_contents_diff_test.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'dart:io' as io;
26

37
import 'package:litetest/litetest.dart';
@@ -19,11 +23,10 @@ void main() {
1923
return;
2024
}
2125

22-
2326
// Runs `../bin/dir_contents_diff.dart` with the given arguments.
2427
(int, String) runSync(String goldenPath, String dirPath) {
2528
final io.ProcessResult result = io.Process.runSync(
26-
'dart',
29+
io.Platform.resolvedExecutable,
2730
<String>[binPath, goldenPath, dirPath],
2831
);
2932
return (result.exitCode, result.stdout ?? result.stderr);

0 commit comments

Comments
 (0)