Force LANG=en_US.UTF-8 in test runner (#82308)
This commit is contained in:
parent
7d46d43635
commit
1ff5665fdd
@ -1,13 +0,0 @@
|
||||
// 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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user