-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#55592Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.e: engine-toolEngine-specific tooling (i.e. `tools/engine_tool`).Engine-specific tooling (i.e. `tools/engine_tool`).engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
Description
Currently, most of et's tests use the following pattern:
final List<CannedProcess> cannedProcesses = <CannedProcess>[
CannedProcess((List<String> command) => command.contains('desc'),
stdout: fixtures.gnDescOutput()),
];... which is a quasi-static data:
String gnDescOutput() => '''
{
"//flutter/display_list:display_list_unittests": {This becomes problematic, because if any test wants to instrument specific success or failure modes, it impacts all tests.
A specific example:
test('test command skips non-testonly executables', () async {
final TestEnvironment testEnvironment = TestEnvironment.withTestEngine(
cannedProcesses: cannedProcesses,
);
try {
final Environment env = testEnvironment.environment;
final ToolCommandRunner runner = ToolCommandRunner(
environment: env,
configs: configs,
);
final int result = await runner.run(<String>[
'test',
'//third_party/protobuf:protoc',
]);
expect(result, equals(0));
expect(testEnvironment.processHistory.length, lessThan(6));
expect(testEnvironment.processHistory.where((ExecutedProcess process) {
return process.command[0].contains('protoc');
}), isEmpty);
} finally {
testEnvironment.cleanup();
}
});This test will break in flutter/engine#52832, because I changed how gn desc was used (implementation detail), but we're using a global gn desc output that can't possibly reflect those changes. In order to keep changes small I'm going to land the PR as-is, but we need a new test strategy here.
My suggestion: let's create a tiny helper function that only instantiates the data we need per-test, versus global test fixtures.
Metadata
Metadata
Assignees
Labels
P3Issues that are less important to the Flutter projectIssues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our tests"flutter test", flutter_test, or one of our testsc: tech-debtTechnical debt, code quality, testing, etc.Technical debt, code quality, testing, etc.e: engine-toolEngine-specific tooling (i.e. `tools/engine_tool`).Engine-specific tooling (i.e. `tools/engine_tool`).engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team