Unverified Commit 1ff5665f authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Force LANG=en_US.UTF-8 in test runner (#82308)

parent 7d46d436
// Copyright 2014 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';
import 'common.dart';
void main() {
test('BOT variable is set on bots', () {
expect(Platform.environment['BOT'], 'true');
}, skip: true);
}
......@@ -279,10 +279,10 @@ Future<Process> startProcess(
assert(isBot != null);
final String command = '$executable ${arguments?.join(" ") ?? ""}';
final String finalWorkingDirectory = workingDirectory ?? cwd;
print('\nExecuting: $command in $finalWorkingDirectory'
+ (environment != null ? ' with environment $environment' : ''));
final Map<String, String> newEnvironment = Map<String, String>.from(environment ?? <String, String>{});
newEnvironment['BOT'] = isBot ? 'true' : 'false';
newEnvironment['LANG'] = 'en_US.UTF-8';
print('\nExecuting: $command in $finalWorkingDirectory with environment $newEnvironment');
final Process process = await _processManager.start(
<String>[executable, ...arguments],
environment: newEnvironment,
......
......@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'package:flutter_devicelab/framework/runner.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
......@@ -43,6 +45,30 @@ void main() {
expect(result.data['benchmark'], 'data');
});
test('sets environment', () async {
final StringBuffer capturedPrintLines = StringBuffer();
await runZoned<Future<void>>(
() async {
await runTask(
'smoke_test_build_test',
taskArgs: <String>['--test'],
deviceId: 'FAKE_SUCCESS',
isolateParams: isolateParams,
);
},
zoneSpecification: ZoneSpecification(
// Intercept printing from the task.
print: (Zone self, ZoneDelegate parent, Zone zone, String line) async {
capturedPrintLines.writeln(line);
},
),
);
final String capturedPrint = capturedPrintLines.toString();
expect(capturedPrint,
contains('with environment {FLUTTER_DEVICELAB_DEVICEID: FAKE_SUCCESS, BOT: true, LANG: en_US.UTF-8}'));
expect(capturedPrint, contains('exit code: 0'));
});
test('throws exception when build and test arg are given', () async {
final TaskResult result = await runTask(
'smoke_test_build_test',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment