[rfw] Run tests for package:rfw on stable as well. (#888)

This commit is contained in:
Ian Hickson
2022-03-23 07:05:11 -07:00
committed by GitHub
parent bba6cb8913
commit aff9cccafb
5 changed files with 35 additions and 51 deletions

View File

@ -103,16 +103,8 @@ task:
CHANNEL: "master"
CHANNEL: "stable"
script:
# Exclude:
# - 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
- else
- ./script/tool_runner.sh test --exclude=flutter_image,rfw
- fi
# We exclude flutter_image because its tests need a test server, so are run via local_tests.sh.
- ./script/tool_runner.sh test --exclude=flutter_image
depends_on:
- format+analyze
- name: android-build+platform-tests
@ -123,18 +115,8 @@ task:
script:
# extension_google_sign_in_as_googleapis_auth is currently not building, see
# 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 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
- ./script/tool_runner.sh build-examples --apk --exclude=extension_google_sign_in_as_googleapis_auth
- ./script/tool_runner.sh native-test --android --no-integration
depends_on:
- format+analyze
- name: web_benchmarks_test
@ -164,16 +146,7 @@ task:
CHANNEL: "master"
CHANNEL: "stable"
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
- else
- ./script/tool_runner.sh build-examples --ios --exclude=rfw
- fi
- ./script/tool_runner.sh build-examples --ios
- name: local_tests
env:
PATH: $PATH:/usr/local/bin

View File

@ -266,3 +266,7 @@ When contributing code, ensure that `flutter test --coverage; lcov
update `test_coverage/bin/test_coverage.dart` with the appropriate
expectations to prevent future coverage regressions. (That program is
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.

View File

@ -4,11 +4,18 @@
// This file is hand-formatted.
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:rfw/formats.dart' show parseLibraryFile;
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() {
testWidgets('String example', (WidgetTester tester) async {
Duration? duration;
@ -494,5 +501,5 @@ void main() {
find.byType(RemoteWidget),
matchesGoldenFile('goldens/argument_decoders_test.gridview.custom.png'),
);
});
}, skip: !runGoldens);
}

View File

@ -2,11 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io' show Platform;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:rfw/formats.dart' show parseLibraryFile;
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() {
testWidgets('Material widgets', (WidgetTester tester) async {
final Runtime runtime = Runtime()
@ -140,5 +147,5 @@ void main() {
find.byType(RemoteWidget),
matchesGoldenFile('goldens/material_test.drawer.png'),
);
});
}, skip: !runGoldens);
}

View File

@ -15,39 +15,32 @@ const String lastUpdate = '2021-08-30';
Future<void> main(List<String> arguments) async {
// 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');
if (coverageDirectory.existsSync()) {
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(
'flutter',
<String>['test', '--coverage', '--update-goldens'],
<String>['test', '--coverage'],
);
if (result.exitCode != 0) {
print(result.stdout);
print(result.stderr);
print('Tests failed.');
// leave coverage directory around to aid debugging
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(
'coverage/lcov.info',
);