Add --bug-report flag (#8435)
This adds support for a `--bug-report` flag, which is a recording that: - includes the arguments that were passed to the command runner - is zipped up for easy attachment in Guthub issues
This commit is contained in:
@@ -19,6 +19,7 @@ import 'application_package_test.dart' as application_package_test;
|
||||
import 'artifacts_test.dart' as artifacts_test;
|
||||
import 'asset_bundle_test.dart' as asset_bundle_test;
|
||||
import 'base_utils_test.dart' as base_utils_test;
|
||||
import 'bug_report_test.dart' as bug_report_test;
|
||||
import 'channel_test.dart' as channel_test;
|
||||
import 'config_test.dart' as config_test;
|
||||
import 'context_test.dart' as context_test;
|
||||
@@ -45,6 +46,7 @@ import 'test_test.dart' as test_test;
|
||||
import 'trace_test.dart' as trace_test;
|
||||
import 'upgrade_test.dart' as upgrade_test;
|
||||
import 'utils_test.dart' as utils_test;
|
||||
import 'src/base/process_test.dart' as process_test;
|
||||
|
||||
void main() {
|
||||
Cache.disableLocking();
|
||||
@@ -58,6 +60,7 @@ void main() {
|
||||
artifacts_test.main();
|
||||
asset_bundle_test.main();
|
||||
base_utils_test.main();
|
||||
bug_report_test.main();
|
||||
channel_test.main();
|
||||
config_test.main();
|
||||
context_test.main();
|
||||
@@ -77,6 +80,7 @@ void main() {
|
||||
logs_test.main();
|
||||
os_utils_test.main();
|
||||
packages_test.main();
|
||||
process_test.main();
|
||||
protocol_discovery_test.main();
|
||||
run_test.main();
|
||||
stop_test.main();
|
||||
|
||||
30
packages/flutter_tools/test/bug_report_test.dart
Normal file
30
packages/flutter_tools/test/bug_report_test.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright 2017 The Chromium 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 'package:file/testing.dart';
|
||||
import 'package:flutter_tools/executable.dart' as tools;
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart';
|
||||
import 'package:flutter_tools/src/base/os.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'src/context.dart';
|
||||
|
||||
void main() {
|
||||
Cache.disableLocking();
|
||||
|
||||
int exitCode;
|
||||
setExitFunctionForTests((int code) {
|
||||
exitCode = code;
|
||||
});
|
||||
|
||||
group('--bug-report', () {
|
||||
testUsingContext('generates valid zip file', () async {
|
||||
await tools.main(<String>['devices', '--bug-report']);
|
||||
expect(exitCode, 0);
|
||||
verify(os.zip(any, argThat(hasPath(matches(r'bugreport_01\.zip')))));
|
||||
});
|
||||
});
|
||||
}
|
||||
41
packages/flutter_tools/test/src/base/process_test.dart
Normal file
41
packages/flutter_tools/test/src/base/process_test.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright 2017 The Chromium 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 'package:flutter_tools/src/base/process.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
void main() {
|
||||
group('shutdownHooks', () {
|
||||
test('runInExpectedOrder', () async {
|
||||
int i = 1;
|
||||
int serializeRecording1;
|
||||
int serializeRecording2;
|
||||
int postProcessRecording;
|
||||
int cleanup;
|
||||
|
||||
addShutdownHook(() async {
|
||||
serializeRecording1 = i++;
|
||||
}, ShutdownStage.SERIALIZE_RECORDING);
|
||||
|
||||
addShutdownHook(() async {
|
||||
cleanup = i++;
|
||||
}, ShutdownStage.CLEANUP);
|
||||
|
||||
addShutdownHook(() async {
|
||||
postProcessRecording = i++;
|
||||
}, ShutdownStage.POST_PROCESS_RECORDING);
|
||||
|
||||
addShutdownHook(() async {
|
||||
serializeRecording2 = i++;
|
||||
}, ShutdownStage.SERIALIZE_RECORDING);
|
||||
|
||||
await runShutdownHooks();
|
||||
|
||||
expect(serializeRecording1, lessThanOrEqualTo(2));
|
||||
expect(serializeRecording2, lessThanOrEqualTo(2));
|
||||
expect(postProcessRecording, 3);
|
||||
expect(cleanup, 4);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user