diff --git a/dev/bots/test/bot_test.dart b/dev/bots/test/bot_test.dart deleted file mode 100644 index d47d91f0b7..0000000000 --- a/dev/bots/test/bot_test.dart +++ /dev/null @@ -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); -} diff --git a/dev/devicelab/lib/framework/utils.dart b/dev/devicelab/lib/framework/utils.dart index bbd80ed509..77f86f7360 100644 --- a/dev/devicelab/lib/framework/utils.dart +++ b/dev/devicelab/lib/framework/utils.dart @@ -279,10 +279,10 @@ Future 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 newEnvironment = Map.from(environment ?? {}); 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( [executable, ...arguments], environment: newEnvironment, diff --git a/dev/devicelab/test/tasks/build_test_task_test.dart b/dev/devicelab/test/tasks/build_test_task_test.dart index 6dd160a021..f5f50f2bd7 100644 --- a/dev/devicelab/test/tasks/build_test_task_test.dart +++ b/dev/devicelab/test/tasks/build_test_task_test.dart @@ -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>( + () async { + await runTask( + 'smoke_test_build_test', + taskArgs: ['--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',