Skip to content

Commit 1ff5665

Browse files
authored
Force LANG=en_US.UTF-8 in test runner (flutter#82308)
1 parent 7d46d43 commit 1ff5665

File tree

3 files changed

+28
-15
lines changed

3 files changed

+28
-15
lines changed

dev/bots/test/bot_test.dart

Lines changed: 0 additions & 13 deletions
This file was deleted.

dev/devicelab/lib/framework/utils.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,10 @@ Future<Process> startProcess(
279279
assert(isBot != null);
280280
final String command = '$executable ${arguments?.join(" ") ?? ""}';
281281
final String finalWorkingDirectory = workingDirectory ?? cwd;
282-
print('\nExecuting: $command in $finalWorkingDirectory'
283-
+ (environment != null ? ' with environment $environment' : ''));
284282
final Map<String, String> newEnvironment = Map<String, String>.from(environment ?? <String, String>{});
285283
newEnvironment['BOT'] = isBot ? 'true' : 'false';
284+
newEnvironment['LANG'] = 'en_US.UTF-8';
285+
print('\nExecuting: $command in $finalWorkingDirectory with environment $newEnvironment');
286286
final Process process = await _processManager.start(
287287
<String>[executable, ...arguments],
288288
environment: newEnvironment,

dev/devicelab/test/tasks/build_test_task_test.dart

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
import 'dart:async';
6+
57
import 'package:flutter_devicelab/framework/runner.dart';
68
import 'package:flutter_devicelab/framework/task_result.dart';
79

@@ -43,6 +45,30 @@ void main() {
4345
expect(result.data['benchmark'], 'data');
4446
});
4547

48+
test('sets environment', () async {
49+
final StringBuffer capturedPrintLines = StringBuffer();
50+
await runZoned<Future<void>>(
51+
() async {
52+
await runTask(
53+
'smoke_test_build_test',
54+
taskArgs: <String>['--test'],
55+
deviceId: 'FAKE_SUCCESS',
56+
isolateParams: isolateParams,
57+
);
58+
},
59+
zoneSpecification: ZoneSpecification(
60+
// Intercept printing from the task.
61+
print: (Zone self, ZoneDelegate parent, Zone zone, String line) async {
62+
capturedPrintLines.writeln(line);
63+
},
64+
),
65+
);
66+
final String capturedPrint = capturedPrintLines.toString();
67+
expect(capturedPrint,
68+
contains('with environment {FLUTTER_DEVICELAB_DEVICEID: FAKE_SUCCESS, BOT: true, LANG: en_US.UTF-8}'));
69+
expect(capturedPrint, contains('exit code: 0'));
70+
});
71+
4672
test('throws exception when build and test arg are given', () async {
4773
final TaskResult result = await runTask(
4874
'smoke_test_build_test',

0 commit comments

Comments
 (0)