move CI tests into the main repo (#5758)
This commit is contained in:
101
dev/devicelab/bin/run.dart
Normal file
101
dev/devicelab/bin/run.dart
Normal file
@@ -0,0 +1,101 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:args/args.dart';
|
||||
|
||||
import 'package:flutter_devicelab/framework/manifest.dart';
|
||||
import 'package:flutter_devicelab/framework/runner.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
/// Runs tasks.
|
||||
///
|
||||
/// The tasks are chosen depending on the command-line options
|
||||
/// (see [_argParser]).
|
||||
Future<Null> main(List<String> rawArgs) async {
|
||||
ArgResults args;
|
||||
try {
|
||||
args = _argParser.parse(rawArgs);
|
||||
} on FormatException catch(error) {
|
||||
stderr.writeln('${error.message}\n');
|
||||
stderr.writeln('Usage:\n');
|
||||
stderr.writeln(_argParser.usage);
|
||||
exitCode = 1;
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> taskNames = <String>[];
|
||||
if (args.wasParsed('task')) {
|
||||
taskNames.addAll(args['task']);
|
||||
} else if (args.wasParsed('stage')) {
|
||||
String stageName = args['stage'];
|
||||
List<ManifestTask> tasks = loadTaskManifest().tasks;
|
||||
for (ManifestTask task in tasks) {
|
||||
if (task.stage == stageName)
|
||||
taskNames.add(task.name);
|
||||
}
|
||||
} else if (args.wasParsed('all')) {
|
||||
List<ManifestTask> tasks = loadTaskManifest().tasks;
|
||||
for (ManifestTask task in tasks) {
|
||||
taskNames.add(task.name);
|
||||
}
|
||||
}
|
||||
|
||||
if (taskNames.isEmpty) {
|
||||
stderr.writeln('Failed to find tasks to run based on supplied options.');
|
||||
exitCode = 1;
|
||||
return null;
|
||||
}
|
||||
|
||||
for (String taskName in taskNames) {
|
||||
section('Running task "$taskName"');
|
||||
Map<String, dynamic> result = await runTask(taskName);
|
||||
|
||||
if (!result['success'])
|
||||
exitCode = 1;
|
||||
|
||||
print('Task result:');
|
||||
print(new JsonEncoder.withIndent(' ').convert(result));
|
||||
section('Finished task "$taskName"');
|
||||
}
|
||||
}
|
||||
|
||||
/// Command-line options for the `run.dart` command.
|
||||
final ArgParser _argParser = new ArgParser()
|
||||
..addOption(
|
||||
'task',
|
||||
abbr: 't',
|
||||
allowMultiple: true,
|
||||
splitCommas: true,
|
||||
help: 'Name of the task to run. This option may be repeated to '
|
||||
'specify multiple tasks. A task selected by name does not have to be '
|
||||
'defined in manifest.yaml. It only needs a Dart executable in bin/tasks.',
|
||||
)
|
||||
..addOption(
|
||||
'stage',
|
||||
abbr: 's',
|
||||
help: 'Name of the stage. Runs all tasks for that stage. '
|
||||
'The tasks and their stages are read from manifest.yaml.',
|
||||
)
|
||||
..addOption(
|
||||
'all',
|
||||
abbr: 'a',
|
||||
help: 'Runs all tasks defined in manifest.yaml.',
|
||||
)
|
||||
..addOption(
|
||||
'test',
|
||||
hide: true,
|
||||
allowMultiple: true,
|
||||
splitCommas: true,
|
||||
callback: (List<String> value) {
|
||||
if (value.isNotEmpty) {
|
||||
throw new FormatException(
|
||||
'Invalid option --test. Did you mean --task (-t)?',
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
20
dev/devicelab/bin/tasks/analyzer_cli__analysis_time.dart
Normal file
20
dev/devicelab/bin/tasks/analyzer_cli__analysis_time.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/analysis.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
String revision = await getCurrentFlutterRepoCommit();
|
||||
DateTime revisionTimestamp = await getFlutterRepoCommitTimestamp(revision);
|
||||
String dartSdkVersion = await getDartVersion();
|
||||
await task(createAnalyzerCliTest(
|
||||
sdk: dartSdkVersion,
|
||||
commit: revision,
|
||||
timestamp: revisionTimestamp,
|
||||
));
|
||||
}
|
||||
20
dev/devicelab/bin/tasks/analyzer_server__analysis_time.dart
Normal file
20
dev/devicelab/bin/tasks/analyzer_server__analysis_time.dart
Normal file
@@ -0,0 +1,20 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/analysis.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
String revision = await getCurrentFlutterRepoCommit();
|
||||
DateTime revisionTimestamp = await getFlutterRepoCommitTimestamp(revision);
|
||||
String dartSdkVersion = await getDartVersion();
|
||||
await task(createAnalyzerServerTest(
|
||||
sdk: dartSdkVersion,
|
||||
commit: revision,
|
||||
timestamp: revisionTimestamp,
|
||||
));
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/basic_material_app__size.dart
Normal file
12
dev/devicelab/bin/tasks/basic_material_app__size.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/size_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createBasicMaterialAppSizeTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/complex_layout__build.dart
Normal file
12
dev/devicelab/bin/tasks/complex_layout__build.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createComplexLayoutBuildTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/complex_layout__start_up.dart
Normal file
12
dev/devicelab/bin/tasks/complex_layout__start_up.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createComplexLayoutStartupTest(ios: false));
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/complex_layout_ios__start_up.dart
Normal file
12
dev/devicelab/bin/tasks/complex_layout_ios__start_up.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createComplexLayoutStartupTest(ios: true));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createComplexLayoutScrollPerfTest(ios: false));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createComplexLayoutScrollPerfTest(ios: true));
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/flutter_gallery__build.dart
Normal file
12
dev/devicelab/bin/tasks/flutter_gallery__build.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createFlutterGalleryBuildTest());
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/flutter_gallery__start_up.dart
Normal file
12
dev/devicelab/bin/tasks/flutter_gallery__start_up.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createFlutterGalleryStartupTest(ios: false));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/gallery.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createGalleryTransitionTest(ios: false));
|
||||
}
|
||||
12
dev/devicelab/bin/tasks/flutter_gallery_ios__start_up.dart
Normal file
12
dev/devicelab/bin/tasks/flutter_gallery_ios__start_up.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/perf_tests.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createFlutterGalleryStartupTest(ios: true));
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/gallery.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
await task(createGalleryTransitionTest(ios: true));
|
||||
}
|
||||
18
dev/devicelab/bin/tasks/mega_gallery__refresh_time.dart
Normal file
18
dev/devicelab/bin/tasks/mega_gallery__refresh_time.dart
Normal file
@@ -0,0 +1,18 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/tasks/refresh.dart';
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
import 'package:flutter_devicelab/framework/utils.dart';
|
||||
|
||||
Future<Null> main() async {
|
||||
String revision = await getCurrentFlutterRepoCommit();
|
||||
DateTime revisionTimestamp = await getFlutterRepoCommitTimestamp(revision);
|
||||
await task(createRefreshTest(
|
||||
commit: revision,
|
||||
timestamp: revisionTimestamp,
|
||||
));
|
||||
}
|
||||
14
dev/devicelab/bin/tasks/smoke_test_failure.dart
Normal file
14
dev/devicelab/bin/tasks/smoke_test_failure.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
/// Smoke test of a task that fails by returning an unsuccessful response.
|
||||
Future<Null> main() async {
|
||||
await task(() async {
|
||||
return new TaskResult.failure('Failed');
|
||||
});
|
||||
}
|
||||
13
dev/devicelab/bin/tasks/smoke_test_setup_failure.dart
Normal file
13
dev/devicelab/bin/tasks/smoke_test_setup_failure.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
/// Creates a situation when the test framework was not properly initialized.
|
||||
///
|
||||
/// By not calling `task()` the VM service extension is not registered and
|
||||
/// therefore will not accept requests to run tasks. When the runner attempts to
|
||||
/// connect and run the test it will receive a "method not found" error from the
|
||||
/// VM service, will likely retry and finally time out.
|
||||
Future<Null> main() async {}
|
||||
14
dev/devicelab/bin/tasks/smoke_test_success.dart
Normal file
14
dev/devicelab/bin/tasks/smoke_test_success.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
/// Smoke test of a successful task.
|
||||
Future<Null> main() async {
|
||||
await task(() async {
|
||||
return new TaskResult.success(<String, dynamic>{});
|
||||
});
|
||||
}
|
||||
14
dev/devicelab/bin/tasks/smoke_test_throws.dart
Normal file
14
dev/devicelab/bin/tasks/smoke_test_throws.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2016 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 'dart:async';
|
||||
|
||||
import 'package:flutter_devicelab/framework/framework.dart';
|
||||
|
||||
/// Smoke test of a task that fails with an exception.
|
||||
Future<Null> main() async {
|
||||
await task(() async {
|
||||
throw 'failed';
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user