Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 269ed90

Browse files
Reverts "Revert "Revert "[Fuchsia] Execute most of the testing/fuchsia/test_suites.yaml on debug and release builds""" (#50407)
Reverts "Reland "[Fuchsia] Execute most of the testing/fuchsia/test_suites.yaml on debug and release builds""" Reverts #50295 Initiated by: zanderso Reason for reverting: Timing out on CI Original PR Author: zijiehe-google-com Reviewed By: {keyonghan} This change reverts the following previous change: Original Description: Reverts #50291, flutter/flutter#142811 Following is the original change description. This change implements a BundledTestRunner to run most of the tests in testing/fuchsia/test_suites.yaml as ExecutableTestRunner. - Tests with packages out of out/fuchsia_*_x64/ are ignored for now. - Tests with extra test command line parameters are ignored for now. The BundledTestRunner can share most of the logic in ExecutableTestRunner and avoid reinventing the wheel. This change also fixes the build break of fuchsia_tests in fuchsia_release_x64 which allows tests to run on the build as well. - Tests not built with AOT are filtered out with variant field in test_suites.yaml. Bug: flutter/flutter#140179 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
1 parent 441a3c8 commit 269ed90

File tree

8 files changed

+33
-128
lines changed

8 files changed

+33
-128
lines changed

.ci.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,7 @@ targets:
195195

196196
- name: Linux linux_fuchsia
197197
recipe: engine_v2/engine_v2
198-
# Temporarily increase the timeout of this builder to 75 minutes to avoid
199-
# being penetrated by cold goma / rbclient cache.
200-
# TODO(zijiehe-google-com): Drop the timeout to 60 minutes once the release
201-
# builder can finish within a reasonable time.
202-
# https://github.com/flutter/flutter/issues/142932
203-
timeout: 75
198+
timeout: 60
204199
properties:
205200
release_build: "true"
206201
config_name: linux_fuchsia

ci/builders/linux_fuchsia.json

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,10 @@
115115
{
116116
"drone_dimensions": [
117117
"device_type=none",
118-
"kvm=1",
119118
"os=Linux"
120119
],
121120
"gclient_variables": {
122-
"download_android_deps": false,
123-
"run_fuchsia_emu": true
121+
"download_android_deps": false
124122
},
125123
"gn": [
126124
"--fuchsia",
@@ -133,22 +131,9 @@
133131
"ninja": {
134132
"config": "fuchsia_release_x64",
135133
"targets": [
136-
"flutter/shell/platform/fuchsia:fuchsia",
137-
"flutter/shell/platform/fuchsia/dart_runner:dart_runner_tests",
138-
"fuchsia_tests"
134+
"flutter/shell/platform/fuchsia:fuchsia"
139135
]
140-
},
141-
"tests": [
142-
{
143-
"name": "x64 emulator based release tests",
144-
"language": "python3",
145-
"script": "flutter/tools/fuchsia/with_envs.py",
146-
"parameters": [
147-
"testing/fuchsia/run_tests.py",
148-
"fuchsia_release_x64"
149-
]
150-
}
151-
]
136+
}
152137
},
153138
{
154139
"drone_dimensions": [
@@ -173,7 +158,6 @@
173158
"config": "fuchsia_debug_x64",
174159
"targets": [
175160
"flutter/shell/platform/fuchsia:fuchsia",
176-
"flutter/shell/platform/fuchsia/dart_runner:dart_runner_tests",
177161
"fuchsia_tests"
178162
]
179163
},
@@ -192,7 +176,7 @@
192176
]
193177
},
194178
{
195-
"name": "x64 emulator based debug tests",
179+
"name": "x64 emulator based tests",
196180
"language": "python3",
197181
"script": "flutter/tools/fuchsia/with_envs.py",
198182
"parameters": [

shell/platform/fuchsia/dart_runner/embedder/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ template("create_aot_snapshot") {
5454
# No asserts in debug or release product.
5555
# No asserts in release with flutter_profile=true (non-product)
5656
# Yes asserts in non-product debug.
57-
if (!invoker.product && (flutter_runtime_mode == "debug" || is_debug)) {
57+
if (!invoker.product &&
58+
(!(flutter_runtime_mode == "profile") || is_debug)) {
5859
args += [ "--enable_asserts" ]
5960
}
6061
args += [ rebase_path(shim_kernel) ]

shell/platform/fuchsia/dart_runner/kernel/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ template("create_kernel_core_snapshot") {
6969
# No asserts in debug or release product.
7070
# No asserts in release with flutter_profile=true (non-product)
7171
# Yes asserts in non-product debug.
72-
if (!invoker.product && (is_debug || flutter_runtime_mode == "debug")) {
72+
if (!invoker.product &&
73+
(is_debug || !(flutter_runtime_mode == "profile"))) {
7374
args += [ "--enable_asserts" ]
7475
}
7576
args += [ rebase_path(platform_dill) ]

shell/platform/fuchsia/dart_runner/vmservice/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ template("aot_snapshot") {
6565
# No asserts in debug or release product.
6666
# No asserts in release with flutter_profile=true (non-product)
6767
# Yes asserts in non-product debug.
68-
if (!product && (flutter_runtime_mode == "debug" || is_debug)) {
68+
if (!product && (!(flutter_runtime_mode == "profile") || is_debug)) {
6969
args += [ "--enable_asserts" ]
7070
}
7171

shell/platform/fuchsia/flutter/kernel/BUILD.gn

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ template("core_snapshot") {
7373
# No asserts in debug or release product.
7474
# No asserts in release with flutter_profile=true (non-product)
7575
# Yes asserts in non-product debug.
76-
if (!invoker.product && (is_debug || flutter_runtime_mode == "debug")) {
76+
if (!invoker.product &&
77+
(is_debug || !(flutter_runtime_mode == "profile"))) {
7778
args += [ "--enable_asserts" ]
7879
}
7980
args += [ rebase_path(platform_dill) ]

testing/fuchsia/run_tests.py

Lines changed: 21 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
1-
#!/usr/bin/env vpython3
2-
3-
# [VPYTHON:BEGIN]
4-
# python_version: "3.8"
5-
# wheel <
6-
# name: "infra/python/wheels/pyyaml/${platform}_${py_python}_${py_abi}"
7-
# version: "version:5.4.1.chromium.1"
8-
# >
9-
# [VPYTHON:END]
10-
1+
#!/usr/bin/env python3
112
# Copyright (c) 2013, the Flutter project authors. All rights reserved.
123
# Use of this source code is governed by a BSD-style license that can be found
134
# in the LICENSE file.
145

156
import argparse
16-
import logging
177
import os
188
import sys
199

20-
from subprocess import CompletedProcess
21-
from typing import List
22-
23-
# The import is coming from vpython wheel and pylint cannot find it.
24-
import yaml # pylint: disable=import-error
25-
2610
# The imports are coming from fuchsia/test_scripts and pylint cannot find them
2711
# without setting a global init-hook which is less favorable.
2812
# But this file will be executed as part of the CI, its correctness of importing
@@ -41,89 +25,32 @@
4125
from run_executable_test import ExecutableTestRunner
4226
from test_runner import TestRunner
4327

44-
if len(sys.argv) == 2:
45-
VARIANT = sys.argv[1]
46-
sys.argv.pop()
47-
elif len(sys.argv) == 1:
48-
VARIANT = 'fuchsia_debug_x64'
49-
else:
50-
assert False, 'Expect only one parameter as the compile output directory.'
51-
OUT_DIR = os.path.join(DIR_SRC_ROOT, 'out', VARIANT)
52-
53-
54-
class BundledTestRunner(TestRunner):
55-
56-
# private, use bundled_test_runner_of function instead.
57-
def __init__(
58-
self, target_id: str, package_deps: List[str], tests: List[str],
59-
logs_dir: str
60-
):
61-
super().__init__(OUT_DIR, [], None, target_id, package_deps)
62-
self.tests = tests
63-
self.logs_dir = logs_dir
64-
65-
def run_test(self) -> CompletedProcess:
66-
returncode = 0
67-
for test in self.tests:
68-
# pylint: disable=protected-access
69-
test_runner = ExecutableTestRunner(
70-
OUT_DIR, [], test, self._target_id, None, self.logs_dir, [], None
71-
)
72-
test_runner._package_deps = self._package_deps
73-
result = test_runner.run_test().returncode
74-
logging.info('Result of test %s is %s', test, result)
75-
if result != 0:
76-
returncode = result
77-
return CompletedProcess(args='', returncode=returncode)
78-
79-
80-
def bundled_test_runner_of(target_id: str) -> BundledTestRunner:
81-
log_dir = os.environ.get('FLUTTER_LOGS_DIR', '/tmp/log')
82-
with open(os.path.join(os.path.dirname(__file__), 'test_suites.yaml'),
83-
'r') as file:
84-
tests = yaml.safe_load(file)
85-
# TODO(zijiehe-google-com): Run tests with multiple packages or with extra
86-
# test arguments, https://github.com/flutter/flutter/issues/140179.
87-
tests = list(
88-
filter(
89-
lambda test: test['test_command'].startswith('test run ') and test[
90-
'test_command'].endswith('.cm'), tests
91-
)
92-
)
93-
tests = list(
94-
filter(
95-
lambda test: 'package' in test and test['package'].endswith('-0.far'),
96-
tests
97-
)
98-
)
99-
tests = list(
100-
filter(
101-
lambda test: not 'variant' in test or VARIANT == test['variant'],
102-
tests
103-
)
104-
)
105-
for test in tests:
106-
original_package = test['package']
107-
test['package'] = os.path.join(
108-
OUT_DIR, test['package'].replace('-0.far', '.far')
109-
)
110-
try:
111-
os.remove(test['package'])
112-
except FileNotFoundError:
113-
pass
114-
os.symlink(original_package, test['package'])
115-
return BundledTestRunner(
116-
target_id, [test['package'] for test in tests],
117-
[test['test_command'][len('test run '):] for test in tests], log_dir
118-
)
28+
# TODO(https://github.com/flutter/flutter/issues/140179): Respect build
29+
# configurations.
30+
OUT_DIR = os.path.join(DIR_SRC_ROOT, 'out/fuchsia_debug_x64')
11931

12032

33+
# TODO(https://github.com/flutter/flutter/issues/140179): Execute all the tests
34+
# in
35+
# https://github.com/flutter/engine/blob/main/testing/fuchsia/test_suites.yaml
36+
# and avoid hardcoded paths.
12137
def _get_test_runner(runner_args: argparse.Namespace, *_) -> TestRunner:
122-
return bundled_test_runner_of(runner_args.target_id)
38+
return ExecutableTestRunner(
39+
OUT_DIR, [],
40+
'fuchsia-pkg://fuchsia.com/dart_runner_tests#meta/dart_runner_tests.cm',
41+
runner_args.target_id, None, '/tmp/log',
42+
[os.path.join(OUT_DIR, 'dart_runner_tests.far')], None
43+
)
12344

12445

12546
if __name__ == '__main__':
126-
logging.info('Running tests in %s', OUT_DIR)
47+
try:
48+
os.remove(os.path.join(OUT_DIR, 'dart_runner_tests.far'))
49+
except FileNotFoundError:
50+
pass
51+
os.symlink(
52+
'dart_runner_tests-0.far', os.path.join(OUT_DIR, 'dart_runner_tests.far')
53+
)
12754
sys.argv.append('--out-dir=' + OUT_DIR)
12855
# The 'flutter-test-type' is a place holder and has no specific meaning; the
12956
# _get_test_runner is overrided.

testing/fuchsia/test_suites.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,16 @@
1919
package: flow_tests-0.far
2020
- test_command: test run fuchsia-pkg://fuchsia.com/runtime_tests#meta/runtime_tests.cm
2121
package: runtime_tests-0.far
22-
variant: fuchsia_debug_x64
2322
- test_command: test run fuchsia-pkg://fuchsia.com/shell_tests#meta/shell_tests.cm
2423
package: shell_tests-0.far
25-
variant: fuchsia_debug_x64
2624
- test_command: test run fuchsia-pkg://fuchsia.com/testing_tests#meta/testing_tests.cm
2725
package: testing_tests-0.far
2826
- test_command: test run fuchsia-pkg://fuchsia.com/txt_tests#meta/txt_tests.cm -- --gtest_filter=-ParagraphTest.*
2927
package: txt_tests-0.far
3028
- test_command: test run fuchsia-pkg://fuchsia.com/ui_tests#meta/ui_tests.cm
3129
package: ui_tests-0.far
32-
variant: fuchsia_debug_x64
3330
- test_command: test run fuchsia-pkg://fuchsia.com/embedder_tests#meta/embedder_tests.cm
3431
package: embedder_tests-0.far
35-
variant: fuchsia_debug_x64
3632
- test_command: test run fuchsia-pkg://fuchsia.com/dart_utils_tests#meta/dart_utils_tests.cm
3733
package: dart_utils_tests-0.far
3834
- test_command: test run fuchsia-pkg://fuchsia.com/dart-jit-runner-integration-test#meta/dart-jit-runner-integration-test.cm

0 commit comments

Comments
 (0)