[Fuchsia] Run tests with multiple packages (flutter/engine#50219)
This change enables tests requiring multiple packages in both debug and release builders; though the AOT test cannot be executed. Also 4 out of 5 suites are excluded from release builder since some of the tests are failing; it's worth extra investigation. MouseInputTest in theory is enabled, it indeed contains only disabled tests. Bug: https://github.com/flutter/flutter/issues/140179 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
This commit is contained in:
@@ -18,7 +18,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
from subprocess import CompletedProcess
|
from subprocess import CompletedProcess
|
||||||
from typing import List
|
from typing import List, Set
|
||||||
|
|
||||||
# The import is coming from vpython wheel and pylint cannot find it.
|
# The import is coming from vpython wheel and pylint cannot find it.
|
||||||
import yaml # pylint: disable=import-error
|
import yaml # pylint: disable=import-error
|
||||||
@@ -55,10 +55,10 @@ class BundledTestRunner(TestRunner):
|
|||||||
|
|
||||||
# private, use bundled_test_runner_of function instead.
|
# private, use bundled_test_runner_of function instead.
|
||||||
def __init__(
|
def __init__(
|
||||||
self, target_id: str, package_deps: List[str], tests: List[str],
|
self, target_id: str, package_deps: Set[str], tests: List[str],
|
||||||
logs_dir: str
|
logs_dir: str
|
||||||
):
|
):
|
||||||
super().__init__(OUT_DIR, [], None, target_id, package_deps)
|
super().__init__(OUT_DIR, [], None, target_id, list(package_deps))
|
||||||
self.tests = tests
|
self.tests = tests
|
||||||
self.logs_dir = logs_dir
|
self.logs_dir = logs_dir
|
||||||
|
|
||||||
@@ -82,38 +82,54 @@ def bundled_test_runner_of(target_id: str) -> BundledTestRunner:
|
|||||||
with open(os.path.join(os.path.dirname(__file__), 'test_suites.yaml'),
|
with open(os.path.join(os.path.dirname(__file__), 'test_suites.yaml'),
|
||||||
'r') as file:
|
'r') as file:
|
||||||
tests = yaml.safe_load(file)
|
tests = yaml.safe_load(file)
|
||||||
# TODO(zijiehe-google-com): Run tests with multiple packages or with extra
|
# TODO(zijiehe-google-com): Run tests with extra test arguments,
|
||||||
# test arguments, https://github.com/flutter/flutter/issues/140179.
|
# https://github.com/flutter/flutter/issues/140179.
|
||||||
tests = list(
|
tests = list(
|
||||||
filter(
|
filter(
|
||||||
lambda test: test['test_command'].startswith('test run ') and test[
|
lambda test: test['test_command'].startswith('test run ') and test[
|
||||||
'test_command'].endswith('.cm'), tests
|
'test_command'].endswith('.cm'), tests
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
# TODO(zijiehe-google-com): Run tests with dart aot,
|
||||||
|
# https://github.com/flutter/flutter/issues/140179.
|
||||||
tests = list(
|
tests = list(
|
||||||
filter(
|
filter(
|
||||||
lambda test: 'package' in test and test['package'].endswith('-0.far'),
|
lambda test: 'run_with_dart_aot' not in test or test[
|
||||||
tests
|
'run_with_dart_aot'] != 'true', tests
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
tests = list(
|
tests = list(
|
||||||
filter(
|
filter(
|
||||||
lambda test: not 'variant' in test or VARIANT == test['variant'],
|
lambda test: 'variant' not in test or VARIANT == test['variant'],
|
||||||
tests
|
tests
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
packages = set()
|
||||||
for test in tests:
|
for test in tests:
|
||||||
original_package = test['package']
|
if 'package' in test:
|
||||||
test['package'] = os.path.join(
|
packages.add(test['package'])
|
||||||
OUT_DIR, test['package'].replace('-0.far', '.far')
|
else:
|
||||||
)
|
assert 'packages' in test, \
|
||||||
try:
|
'Expect either one package or a list of packages'
|
||||||
os.remove(test['package'])
|
packages.update(test['packages'])
|
||||||
except FileNotFoundError:
|
resolved_packages = set()
|
||||||
pass
|
for package in packages:
|
||||||
os.symlink(original_package, test['package'])
|
if package.endswith('-0.far'):
|
||||||
|
# Make a symbolic link to match the name of the package itself without the
|
||||||
|
# '-0.far' suffix.
|
||||||
|
new_package = os.path.join(OUT_DIR, package.replace('-0.far', '.far'))
|
||||||
|
try:
|
||||||
|
# Remove the old one if it exists, usually happen on the devbox, so
|
||||||
|
# ignore the FileNotFoundError.
|
||||||
|
os.remove(new_package)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
os.symlink(package, new_package)
|
||||||
|
resolved_packages.add(new_package)
|
||||||
|
else:
|
||||||
|
resolved_packages.add(os.path.join(OUT_DIR, package))
|
||||||
return BundledTestRunner(
|
return BundledTestRunner(
|
||||||
target_id, [test['package'] for test in tests],
|
target_id, resolved_packages,
|
||||||
[test['test_command'][len('test run '):] for test in tests], log_dir
|
[test['test_command'][len('test run '):] for test in tests], log_dir
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -123,6 +139,7 @@ def _get_test_runner(runner_args: argparse.Namespace, *_) -> TestRunner:
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
logging.basicConfig(level=logging.INFO)
|
||||||
logging.info('Running tests in %s', OUT_DIR)
|
logging.info('Running tests in %s', OUT_DIR)
|
||||||
sys.argv.append('--out-dir=' + OUT_DIR)
|
sys.argv.append('--out-dir=' + OUT_DIR)
|
||||||
# The 'flutter-test-type' is a place holder and has no specific meaning; the
|
# The 'flutter-test-type' is a place holder and has no specific meaning; the
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
emulator_arch:
|
emulator_arch:
|
||||||
- 'x64'
|
- 'x64'
|
||||||
- 'arm64'
|
- 'arm64'
|
||||||
|
variant: fuchsia_debug_x64
|
||||||
- test_command: test run fuchsia-pkg://fuchsia.com/dart-aot-runner-integration-test#meta/dart-aot-runner-integration-test.cm
|
- test_command: test run fuchsia-pkg://fuchsia.com/dart-aot-runner-integration-test#meta/dart-aot-runner-integration-test.cm
|
||||||
run_with_dart_aot: 'true'
|
run_with_dart_aot: 'true'
|
||||||
packages:
|
packages:
|
||||||
@@ -58,12 +59,14 @@
|
|||||||
- oot_flutter_jit_runner-0.far
|
- oot_flutter_jit_runner-0.far
|
||||||
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/embedder/child-view/child-view/child-view.far
|
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/embedder/child-view/child-view/child-view.far
|
||||||
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/parent-view/parent-view.far
|
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/embedder/parent-view/parent-view/parent-view.far
|
||||||
|
variant: fuchsia_debug_x64
|
||||||
- test_command: test run fuchsia-pkg://fuchsia.com/touch-input-test#meta/touch-input-test.cm
|
- test_command: test run fuchsia-pkg://fuchsia.com/touch-input-test#meta/touch-input-test.cm
|
||||||
packages:
|
packages:
|
||||||
- touch-input-test-0.far
|
- touch-input-test-0.far
|
||||||
- oot_flutter_jit_runner-0.far
|
- oot_flutter_jit_runner-0.far
|
||||||
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/touch-input-view/touch-input-view.far
|
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/touch-input-view/touch-input-view/touch-input-view.far
|
||||||
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/embedding-flutter-view/embedding-flutter-view.far
|
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/touch-input/embedding-flutter-view/embedding-flutter-view/embedding-flutter-view.far
|
||||||
|
variant: fuchsia_debug_x64
|
||||||
- test_command: test run fuchsia-pkg://fuchsia.com/mouse-input-test#meta/mouse-input-test.cm
|
- test_command: test run fuchsia-pkg://fuchsia.com/mouse-input-test#meta/mouse-input-test.cm
|
||||||
packages:
|
packages:
|
||||||
- mouse-input-test-0.far
|
- mouse-input-test-0.far
|
||||||
@@ -74,3 +77,4 @@
|
|||||||
- text-input-test-0.far
|
- text-input-test-0.far
|
||||||
- oot_flutter_jit_runner-0.far
|
- oot_flutter_jit_runner-0.far
|
||||||
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/text-input-view/text-input-view.far
|
- gen/flutter/shell/platform/fuchsia/flutter/tests/integration/text-input/text-input-view/text-input-view/text-input-view.far
|
||||||
|
variant: fuchsia_debug_x64
|
||||||
|
|||||||
Reference in New Issue
Block a user