Lock flutter tool while updating artifacts (#4476)
This prevents multiple simultaneous runs of the analyzer from stomping over each other (e.g. multiple runs of 'update-packages'). Certain long-lived commands (like analyze, run, logs) are exempted once they've done enough work to be safe from most stomping action. This still doesn't make us entirely safe from craziness, e.g. if you're half way through an 'update-packages' run and you call 'git pull', who knows what state you'll end up in. But there's only so much one can do. Fixes https://github.com/flutter/flutter/issues/2762
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
// doesn't support running without symlinks. We can delete these files once that
|
||||
// fix lands.
|
||||
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
|
||||
import 'adb_test.dart' as adb_test;
|
||||
import 'analytics_test.dart' as analytics_test;
|
||||
import 'analyze_duplicate_names_test.dart' as analyze_duplicate_names_test;
|
||||
@@ -18,6 +20,7 @@ import 'context_test.dart' as context_test;
|
||||
import 'create_test.dart' as create_test;
|
||||
import 'daemon_test.dart' as daemon_test;
|
||||
import 'device_test.dart' as device_test;
|
||||
// import 'devices_test.dart' as devices_test;
|
||||
import 'drive_test.dart' as drive_test;
|
||||
import 'install_test.dart' as install_test;
|
||||
import 'listen_test.dart' as listen_test;
|
||||
@@ -26,11 +29,13 @@ import 'os_utils_test.dart' as os_utils_test;
|
||||
import 'protocol_discovery_test.dart' as protocol_discovery_test;
|
||||
import 'run_test.dart' as run_test;
|
||||
import 'stop_test.dart' as stop_test;
|
||||
import 'test_test.dart' as test_test;
|
||||
import 'toolchain_test.dart' as toolchain_test;
|
||||
import 'trace_test.dart' as trace_test;
|
||||
import 'upgrade_test.dart' as upgrade_test;
|
||||
|
||||
void main() {
|
||||
Cache.disableLocking();
|
||||
adb_test.main();
|
||||
analytics_test.main();
|
||||
analyze_duplicate_names_test.main();
|
||||
@@ -42,6 +47,7 @@ void main() {
|
||||
create_test.main();
|
||||
daemon_test.main();
|
||||
device_test.main();
|
||||
// devices_test.main(); // https://github.com/flutter/flutter/issues/4480
|
||||
drive_test.main();
|
||||
install_test.main();
|
||||
listen_test.main();
|
||||
@@ -50,6 +56,7 @@ void main() {
|
||||
protocol_discovery_test.main();
|
||||
run_test.main();
|
||||
stop_test.main();
|
||||
test_test.main();
|
||||
toolchain_test.main();
|
||||
trace_test.main();
|
||||
upgrade_test.main();
|
||||
|
||||
@@ -18,16 +18,16 @@ void main() {
|
||||
group('test', () {
|
||||
testUsingContext('TestAsyncUtils guarded function test', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
return _testFile('test_async_utils_guarded');
|
||||
return _testFile('test_async_utils_guarded', 1);
|
||||
});
|
||||
testUsingContext('TestAsyncUtils unguarded function test', () async {
|
||||
Cache.flutterRoot = '../..';
|
||||
return _testFile('test_async_utils_unguarded');
|
||||
return _testFile('test_async_utils_unguarded', 1);
|
||||
});
|
||||
}, timeout: new Timeout(const Duration(seconds: 5)));
|
||||
}
|
||||
|
||||
Future<Null> _testFile(String testName) async {
|
||||
Future<Null> _testFile(String testName, int wantedExitCode) async {
|
||||
final String manualTestsDirectory = path.join('..', '..', 'dev', 'automated_tests');
|
||||
final String fullTestName = path.join(manualTestsDirectory, 'flutter_test', '${testName}_test.dart');
|
||||
final File testFile = new File(fullTestName);
|
||||
@@ -40,11 +40,12 @@ Future<Null> _testFile(String testName) async {
|
||||
<String>[
|
||||
path.absolute(path.join('bin', 'flutter_tools.dart')),
|
||||
'test',
|
||||
'--no-color',
|
||||
fullTestName
|
||||
],
|
||||
workingDirectory: manualTestsDirectory
|
||||
);
|
||||
expect(exec.exitCode, 0);
|
||||
expect(exec.exitCode, wantedExitCode);
|
||||
final List<String> output = exec.stdout.split('\n');
|
||||
final List<String> expectations = new File(fullTestExpectation).readAsLinesSync();
|
||||
bool allowSkip = false;
|
||||
|
||||
Reference in New Issue
Block a user