mirror of
https://github.com/flutter/packages.git
synced 2025-07-03 17:18:22 +08:00
[rfw] Run tests for package:rfw on stable as well. (#888)
This commit is contained in:
29
.cirrus.yml
29
.cirrus.yml
@ -103,16 +103,8 @@ task:
|
|||||||
CHANNEL: "master"
|
CHANNEL: "master"
|
||||||
CHANNEL: "stable"
|
CHANNEL: "stable"
|
||||||
script:
|
script:
|
||||||
# Exclude:
|
# We exclude flutter_image because its tests need a test server, so are run via local_tests.sh.
|
||||||
# - flutter_image; its tests need a test server, so are run via
|
|
||||||
# local_tests.sh.
|
|
||||||
# - rfw on stable; it includes golden tests whose results differ
|
|
||||||
# between branch
|
|
||||||
- if [[ "$CHANNEL" == "master" ]]; then
|
|
||||||
- ./script/tool_runner.sh test --exclude=flutter_image
|
- ./script/tool_runner.sh test --exclude=flutter_image
|
||||||
- else
|
|
||||||
- ./script/tool_runner.sh test --exclude=flutter_image,rfw
|
|
||||||
- fi
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- format+analyze
|
- format+analyze
|
||||||
- name: android-build+platform-tests
|
- name: android-build+platform-tests
|
||||||
@ -123,18 +115,8 @@ task:
|
|||||||
script:
|
script:
|
||||||
# extension_google_sign_in_as_googleapis_auth is currently not building, see
|
# extension_google_sign_in_as_googleapis_auth is currently not building, see
|
||||||
# https://github.com/flutter/flutter/issues/89301
|
# https://github.com/flutter/flutter/issues/89301
|
||||||
# rfw is excluded until the next Flutter stable release because it depends
|
|
||||||
# on features that have never shipped to stable. (The rfw package has
|
|
||||||
# never worked on stable so this is not going to break anyone.)
|
|
||||||
# When updating this, also look at the ios tests below.
|
|
||||||
# When updating this, also update the `rfw/run_tests.sh` file.
|
|
||||||
- if [[ "$CHANNEL" == "master" ]]; then
|
|
||||||
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
|
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
|
||||||
- ./script/tool_runner.sh native-test --android --no-integration
|
- ./script/tool_runner.sh native-test --android --no-integration
|
||||||
- else
|
|
||||||
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth,rfw
|
|
||||||
- ./script/tool_runner.sh native-test --android --no-integration --exclude=rfw
|
|
||||||
- fi
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- format+analyze
|
- format+analyze
|
||||||
- name: web_benchmarks_test
|
- name: web_benchmarks_test
|
||||||
@ -164,16 +146,7 @@ task:
|
|||||||
CHANNEL: "master"
|
CHANNEL: "master"
|
||||||
CHANNEL: "stable"
|
CHANNEL: "stable"
|
||||||
build_script:
|
build_script:
|
||||||
# Exclude rfw until the next Flutter stable release because it depends
|
|
||||||
# on features that have never shipped to stable. (The rfw package has
|
|
||||||
# never worked on stable so this is not going to break anyone.)
|
|
||||||
# When updating this, also look at the android tests above.
|
|
||||||
# When updating this, also update the `rfw/run_tests.sh` file.
|
|
||||||
- if [[ "$CHANNEL" == "master" ]]; then
|
|
||||||
- ./script/tool_runner.sh build-examples --ios
|
- ./script/tool_runner.sh build-examples --ios
|
||||||
- else
|
|
||||||
- ./script/tool_runner.sh build-examples --ios --exclude=rfw
|
|
||||||
- fi
|
|
||||||
- name: local_tests
|
- name: local_tests
|
||||||
env:
|
env:
|
||||||
PATH: $PATH:/usr/local/bin
|
PATH: $PATH:/usr/local/bin
|
||||||
|
@ -266,3 +266,7 @@ When contributing code, ensure that `flutter test --coverage; lcov
|
|||||||
update `test_coverage/bin/test_coverage.dart` with the appropriate
|
update `test_coverage/bin/test_coverage.dart` with the appropriate
|
||||||
expectations to prevent future coverage regressions. (That program is
|
expectations to prevent future coverage regressions. (That program is
|
||||||
run by `run_tests.sh`.)
|
run by `run_tests.sh`.)
|
||||||
|
|
||||||
|
Golden tests are only run against the Flutter master channel and only
|
||||||
|
run on Linux, since minor rendering differences are expected on
|
||||||
|
different platforms and on different versions of Flutter.
|
@ -4,11 +4,18 @@
|
|||||||
|
|
||||||
// This file is hand-formatted.
|
// This file is hand-formatted.
|
||||||
|
|
||||||
|
import 'dart:io' show Platform;
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:rfw/formats.dart' show parseLibraryFile;
|
import 'package:rfw/formats.dart' show parseLibraryFile;
|
||||||
import 'package:rfw/rfw.dart';
|
import 'package:rfw/rfw.dart';
|
||||||
|
|
||||||
|
// See Contributing section of README.md file.
|
||||||
|
final bool runGoldens = Platform.isLinux &&
|
||||||
|
(!Platform.environment.containsKey('CHANNEL') ||
|
||||||
|
Platform.environment['CHANNEL'] == 'master');
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('String example', (WidgetTester tester) async {
|
testWidgets('String example', (WidgetTester tester) async {
|
||||||
Duration? duration;
|
Duration? duration;
|
||||||
@ -494,5 +501,5 @@ void main() {
|
|||||||
find.byType(RemoteWidget),
|
find.byType(RemoteWidget),
|
||||||
matchesGoldenFile('goldens/argument_decoders_test.gridview.custom.png'),
|
matchesGoldenFile('goldens/argument_decoders_test.gridview.custom.png'),
|
||||||
);
|
);
|
||||||
});
|
}, skip: !runGoldens);
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,18 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'dart:io' show Platform;
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:rfw/formats.dart' show parseLibraryFile;
|
import 'package:rfw/formats.dart' show parseLibraryFile;
|
||||||
import 'package:rfw/rfw.dart';
|
import 'package:rfw/rfw.dart';
|
||||||
|
|
||||||
|
// See Contributing section of README.md file.
|
||||||
|
final bool runGoldens = Platform.isLinux &&
|
||||||
|
(!Platform.environment.containsKey('CHANNEL') ||
|
||||||
|
Platform.environment['CHANNEL'] == 'master');
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Material widgets', (WidgetTester tester) async {
|
testWidgets('Material widgets', (WidgetTester tester) async {
|
||||||
final Runtime runtime = Runtime()
|
final Runtime runtime = Runtime()
|
||||||
@ -140,5 +147,5 @@ void main() {
|
|||||||
find.byType(RemoteWidget),
|
find.byType(RemoteWidget),
|
||||||
matchesGoldenFile('goldens/material_test.drawer.png'),
|
matchesGoldenFile('goldens/material_test.drawer.png'),
|
||||||
);
|
);
|
||||||
});
|
}, skip: !runGoldens);
|
||||||
}
|
}
|
||||||
|
@ -15,39 +15,32 @@ const String lastUpdate = '2021-08-30';
|
|||||||
Future<void> main(List<String> arguments) async {
|
Future<void> main(List<String> arguments) async {
|
||||||
// This script is mentioned in the README.md file.
|
// This script is mentioned in the README.md file.
|
||||||
|
|
||||||
if (Platform.environment['CHANNEL'] == 'stable') {
|
|
||||||
// For now these are disabled because this package has never been supported
|
|
||||||
// on the stable channel and requires newer language features that have not
|
|
||||||
// yet shipped to a stable build. It will be possible to test this with the
|
|
||||||
// first stable to ship after October 2021.
|
|
||||||
print(
|
|
||||||
'Skipping tests on stable channel.\n'
|
|
||||||
'These tests can be unskipped once we ship a stable after October 2021.',
|
|
||||||
);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Directory coverageDirectory = Directory('coverage');
|
final Directory coverageDirectory = Directory('coverage');
|
||||||
|
|
||||||
if (coverageDirectory.existsSync()) {
|
if (coverageDirectory.existsSync()) {
|
||||||
coverageDirectory.deleteSync(recursive: true);
|
coverageDirectory.deleteSync(recursive: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We run with --update-goldens because the goal here is not to verify the tests
|
|
||||||
// pass but to verify the coverage, and the goldens are not always going to pass
|
|
||||||
// when run on different platforms (e.g. on Cirrus we run this on a mac but the
|
|
||||||
// goldens expect a linux box).
|
|
||||||
final ProcessResult result = Process.runSync(
|
final ProcessResult result = Process.runSync(
|
||||||
'flutter',
|
'flutter',
|
||||||
<String>['test', '--coverage', '--update-goldens'],
|
<String>['test', '--coverage'],
|
||||||
);
|
);
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
print(result.stdout);
|
print(result.stdout);
|
||||||
print(result.stderr);
|
print(result.stderr);
|
||||||
print('Tests failed.');
|
print('Tests failed.');
|
||||||
|
// leave coverage directory around to aid debugging
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Platform.environment['CHANNEL'] != 'master') {
|
||||||
|
print(
|
||||||
|
'Tests passed. (Coverage verification skipped; not on master channel.)',
|
||||||
|
);
|
||||||
|
coverageDirectory.deleteSync(recursive: true);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
final List<lcov.Record> records = await lcov.Parser.parse(
|
final List<lcov.Record> records = await lcov.Parser.parse(
|
||||||
'coverage/lcov.info',
|
'coverage/lcov.info',
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user