flutter/dev/devicelab/test/run_test.dart
Ian Hickson 449f4a6673
License update (#45373)
* Update project.pbxproj files to say Flutter rather than Chromium

Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.

* Update the copyright notice checker to require a standard notice on all files

* Update copyrights on Dart files. (This was a mechanical commit.)

* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.

Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).

* Clean up the copyrights in non-Dart files. (Manual edits.)

Also, make sure templates don't have copyrights.

* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00

68 lines
2.2 KiB
Dart

// 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:async';
import 'dart:io';
import 'package:path/path.dart' as path;
import 'package:process/process.dart';
import 'common.dart';
void main() {
const ProcessManager processManager = LocalProcessManager();
group('run.dart script', () {
Future<ProcessResult> runScript(List<String> testNames) async {
final String dart = path.absolute(path.join('..', '..', 'bin', 'cache', 'dart-sdk', 'bin', 'dart'));
final ProcessResult scriptProcess = processManager.runSync(<String>[
dart,
'bin/run.dart',
for (String testName in testNames) ...<String>['-t', testName],
]);
return scriptProcess;
}
Future<void> expectScriptResult(List<String> testNames, int expectedExitCode) async {
final ProcessResult result = await runScript(testNames);
expect(result.exitCode, expectedExitCode,
reason: '[ stderr from test process ]\n\n${result.stderr}\n\n[ end of stderr ]'
'\n\n[ stdout from test process ]\n\n${result.stdout}\n\n[ end of stdout ]');
}
test('exits with code 0 when succeeds', () async {
await expectScriptResult(<String>['smoke_test_success'], 0);
});
test('accepts file paths', () async {
await expectScriptResult(<String>['bin/tasks/smoke_test_success.dart'], 0);
});
test('rejects invalid file paths', () async {
await expectScriptResult(<String>['lib/framework/adb.dart'], 1);
});
test('exits with code 1 when task throws', () async {
await expectScriptResult(<String>['smoke_test_throws'], 1);
});
test('exits with code 1 when fails', () async {
await expectScriptResult(<String>['smoke_test_failure'], 1);
});
test('exits with code 1 when fails to connect', () async {
await expectScriptResult(<String>['smoke_test_setup_failure'], 1);
}, skip: true); // https://github.com/flutter/flutter/issues/5901
test('exits with code 1 when results are mixed', () async {
await expectScriptResult(<String>[
'smoke_test_failure',
'smoke_test_success',
],
1,
);
});
});
}