devicelab benchmarks run on Windows (#8814)
* devicelab benchmarks run on Windows * fix analyzer issue * fix test * fix pubspec
This commit is contained in:
parent
4c91b6e725
commit
d87f19817f
@ -382,9 +382,9 @@ String get adbPath {
|
|||||||
throw 'ANDROID_HOME environment variable missing. This variable must '
|
throw 'ANDROID_HOME environment variable missing. This variable must '
|
||||||
'point to the Android SDK directory containing platform-tools.';
|
'point to the Android SDK directory containing platform-tools.';
|
||||||
|
|
||||||
final File adbPath = file(path.join(androidHome, 'platform-tools/adb'));
|
final String adbPath = path.join(androidHome, 'platform-tools/adb');
|
||||||
|
|
||||||
if (!adbPath.existsSync()) throw 'adb not found at: $adbPath';
|
if (!canRun(adbPath)) throw 'adb not found at: $adbPath';
|
||||||
|
|
||||||
return adbPath.absolute.path;
|
return path.absolute(adbPath);
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,14 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
import 'package:process/process.dart';
|
||||||
import 'package:stack_trace/stack_trace.dart';
|
import 'package:stack_trace/stack_trace.dart';
|
||||||
|
|
||||||
/// Virtual current working directory, which affect functions, such as [exec].
|
/// Virtual current working directory, which affect functions, such as [exec].
|
||||||
String cwd = Directory.current.path;
|
String cwd = Directory.current.path;
|
||||||
|
|
||||||
List<ProcessInfo> _runningProcesses = <ProcessInfo>[];
|
List<ProcessInfo> _runningProcesses = <ProcessInfo>[];
|
||||||
|
ProcessManager _processManager = new LocalProcessManager();
|
||||||
|
|
||||||
class ProcessInfo {
|
class ProcessInfo {
|
||||||
ProcessInfo(this.command, this.process);
|
ProcessInfo(this.command, this.process);
|
||||||
@ -118,7 +120,7 @@ void section(String title) {
|
|||||||
|
|
||||||
Future<String> getDartVersion() async {
|
Future<String> getDartVersion() async {
|
||||||
// The Dart VM returns the version text to stderr.
|
// The Dart VM returns the version text to stderr.
|
||||||
final ProcessResult result = Process.runSync(dartBin, <String>['--version']);
|
final ProcessResult result = _processManager.runSync(<String>[dartBin, '--version']);
|
||||||
String version = result.stderr.trim();
|
String version = result.stderr.trim();
|
||||||
|
|
||||||
// Convert:
|
// Convert:
|
||||||
@ -167,9 +169,8 @@ Future<Process> startProcess(
|
|||||||
print('Executing: $command');
|
print('Executing: $command');
|
||||||
environment ??= <String, String>{};
|
environment ??= <String, String>{};
|
||||||
environment['BOT'] = 'true';
|
environment['BOT'] = 'true';
|
||||||
final Process process = await Process.start(
|
final Process process = await _processManager.start(
|
||||||
executable,
|
<String>[executable]..addAll(arguments),
|
||||||
arguments,
|
|
||||||
environment: environment,
|
environment: environment,
|
||||||
workingDirectory: workingDirectory ?? cwd,
|
workingDirectory: workingDirectory ?? cwd,
|
||||||
);
|
);
|
||||||
@ -448,3 +449,5 @@ Future<int> findAvailablePort() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool canRun(String path) => _processManager.canRun(path);
|
@ -11,6 +11,7 @@ dependencies:
|
|||||||
args: ^0.13.4
|
args: ^0.13.4
|
||||||
meta: ^1.0.4
|
meta: ^1.0.4
|
||||||
path: ^1.4.0
|
path: ^1.4.0
|
||||||
|
process: 2.0.1
|
||||||
stack_trace: ^1.4.0
|
stack_trace: ^1.4.0
|
||||||
vm_service_client: '0.2.2+4'
|
vm_service_client: '0.2.2+4'
|
||||||
|
|
||||||
|
@ -5,18 +5,22 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:path/path.dart' as path;
|
||||||
|
import 'package:process/process.dart';
|
||||||
import 'package:test/test.dart';
|
import 'package:test/test.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
final ProcessManager processManager = new LocalProcessManager();
|
||||||
|
|
||||||
group('run.dart script', () {
|
group('run.dart script', () {
|
||||||
Future<int> runScript(List<String> testNames) async {
|
Future<int> runScript(List<String> testNames) async {
|
||||||
final List<String> options = <String>['bin/run.dart'];
|
final List<String> options = <String>['bin/run.dart'];
|
||||||
for (String testName in testNames) {
|
for (String testName in testNames) {
|
||||||
options..addAll(<String>['-t', testName]);
|
options..addAll(<String>['-t', testName]);
|
||||||
}
|
}
|
||||||
final ProcessResult scriptProcess = Process.runSync(
|
final String dart = path.absolute(path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart'));
|
||||||
'../../bin/cache/dart-sdk/bin/dart',
|
final ProcessResult scriptProcess = processManager.runSync(
|
||||||
options,
|
<String>[dart]..addAll(options)
|
||||||
);
|
);
|
||||||
return scriptProcess.exitCode;
|
return scriptProcess.exitCode;
|
||||||
}
|
}
|
||||||
|
@ -267,6 +267,7 @@ class AnsiTerminal {
|
|||||||
static const int _ENOTTY = 25;
|
static const int _ENOTTY = 25;
|
||||||
static const int _ENETRESET = 102;
|
static const int _ENETRESET = 102;
|
||||||
static const int _ERROR_INVALID_PARAMETER = 87;
|
static const int _ERROR_INVALID_PARAMETER = 87;
|
||||||
|
static const int _INVALID_HANDLE = 6;
|
||||||
|
|
||||||
/// Setting the line mode can throw for some terminals (with "Operation not
|
/// Setting the line mode can throw for some terminals (with "Operation not
|
||||||
/// supported on socket"), but the error can be safely ignored.
|
/// supported on socket"), but the error can be safely ignored.
|
||||||
@ -275,6 +276,7 @@ class AnsiTerminal {
|
|||||||
_ENOTTY,
|
_ENOTTY,
|
||||||
_ENETRESET,
|
_ENETRESET,
|
||||||
_ERROR_INVALID_PARAMETER, // TODO(goderbauer): remove when https://github.com/dart-lang/sdk/issues/28599 is fixed
|
_ERROR_INVALID_PARAMETER, // TODO(goderbauer): remove when https://github.com/dart-lang/sdk/issues/28599 is fixed
|
||||||
|
_INVALID_HANDLE,
|
||||||
];
|
];
|
||||||
|
|
||||||
bool supportsColor;
|
bool supportsColor;
|
||||||
@ -284,6 +286,9 @@ class AnsiTerminal {
|
|||||||
String clearScreen() => supportsColor ? _clear : '\n\n';
|
String clearScreen() => supportsColor ? _clear : '\n\n';
|
||||||
|
|
||||||
set singleCharMode(bool value) {
|
set singleCharMode(bool value) {
|
||||||
|
// TODO(goderbauer): instead of trying to set lineMode and then catching [_ENOTTY] or [_INVALID_HANDLE],
|
||||||
|
// we should check beforehand if stdin is connected to a terminal or not
|
||||||
|
// (requires https://github.com/dart-lang/sdk/issues/29083 to be resolved).
|
||||||
try {
|
try {
|
||||||
stdin.lineMode = !value;
|
stdin.lineMode = !value;
|
||||||
} on StdinException catch (error) {
|
} on StdinException catch (error) {
|
||||||
|
@ -21,7 +21,7 @@ dependencies:
|
|||||||
meta: ^1.0.4
|
meta: ^1.0.4
|
||||||
mustache: ^0.2.5
|
mustache: ^0.2.5
|
||||||
package_config: '>=0.1.5 <2.0.0'
|
package_config: '>=0.1.5 <2.0.0'
|
||||||
platform: 1.0.1
|
platform: 1.0.2
|
||||||
process: 2.0.1
|
process: 2.0.1
|
||||||
stack_trace: ^1.4.0
|
stack_trace: ^1.4.0
|
||||||
usage: ^3.0.0+1
|
usage: ^3.0.0+1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user