[Impeller] force render pass construction on all backends to ensure image layout is transitioned/render pass state setup. (flutter/engine#50539)
Fixes https://github.com/flutter/flutter/issues/142358 We rely on the render pass encoding to transition image textures from undefined to shader read layout. If an empty pass is created with no clear color, we still need to create the pass on the Vulkan backend.
This commit is contained in:
@@ -503,6 +503,28 @@ TEST_P(AiksTest, CanPictureConvertToImage) {
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
// Regression test for https://github.com/flutter/flutter/issues/142358 .
|
||||
// Without a change to force render pass construction the image is left in an
|
||||
// undefined layout and triggers a validation error.
|
||||
TEST_P(AiksTest, CanEmptyPictureConvertToImage) {
|
||||
Canvas recorder_canvas;
|
||||
|
||||
Canvas canvas;
|
||||
AiksContext renderer(GetContext(), nullptr);
|
||||
Paint paint;
|
||||
paint.color = Color::BlackTransparent();
|
||||
canvas.DrawPaint(paint);
|
||||
Picture picture = recorder_canvas.EndRecordingAsPicture();
|
||||
auto image = picture.ToImage(renderer, ISize{1000, 1000});
|
||||
if (image) {
|
||||
canvas.DrawImage(image, Point(), Paint());
|
||||
paint.color = Color{0.1, 0.1, 0.1, 0.2};
|
||||
canvas.DrawRect(Rect::MakeSize(ISize{1000, 1000}), paint);
|
||||
}
|
||||
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_P(AiksTest, BlendModeShouldCoverWholeScreen) {
|
||||
Canvas canvas;
|
||||
Paint paint;
|
||||
|
||||
@@ -901,9 +901,10 @@ bool EntityPass::OnRender(
|
||||
}
|
||||
auto clear_color_size = pass_target.GetRenderTarget().GetRenderTargetSize();
|
||||
|
||||
if (!collapsed_parent_pass && GetClearColor(clear_color_size).has_value()) {
|
||||
// Force the pass context to create at least one new pass if the clear color
|
||||
// is present.
|
||||
if (!collapsed_parent_pass) {
|
||||
// Always force the pass to construct the render pass object, even if there
|
||||
// is not a clear color. This ensures that the attachment textures are
|
||||
// cleared/transitioned to the right state.
|
||||
pass_context.GetRenderPass(pass_depth);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,21 +30,17 @@ import typing
|
||||
import xvfb
|
||||
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
BUILDROOT_DIR = os.path.abspath(
|
||||
os.path.join(os.path.realpath(__file__), '..', '..', '..')
|
||||
)
|
||||
BUILDROOT_DIR = os.path.abspath(os.path.join(os.path.realpath(__file__), '..', '..', '..'))
|
||||
OUT_DIR = os.path.join(BUILDROOT_DIR, 'out')
|
||||
GOLDEN_DIR = os.path.join(BUILDROOT_DIR, 'flutter', 'testing', 'resources')
|
||||
FONTS_DIR = os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'third_party', 'txt', 'third_party', 'fonts'
|
||||
)
|
||||
FONTS_DIR = os.path.join(BUILDROOT_DIR, 'flutter', 'third_party', 'txt', 'third_party', 'fonts')
|
||||
ROBOTO_FONT_PATH = os.path.join(FONTS_DIR, 'Roboto-Regular.ttf')
|
||||
FONT_SUBSET_DIR = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'font_subset')
|
||||
|
||||
ENCODING = 'UTF-8'
|
||||
|
||||
# This number must be updated when adding new golden tests to impeller.
|
||||
_NUM_EXPECTED_GENERATED_IMPELLER_GOLDEN_FILES = 554
|
||||
_NUM_EXPECTED_GENERATED_IMPELLER_GOLDEN_FILES = 557
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger_handler = logging.StreamHandler()
|
||||
@@ -111,8 +107,8 @@ def run_cmd(
|
||||
print_divider('!')
|
||||
|
||||
logger.error(
|
||||
'Failed Command:\n\n%s\n\nExit Code: %s\n\nOutput:\n%s', command_string,
|
||||
process.returncode, output
|
||||
'Failed Command:\n\n%s\n\nExit Code: %s\n\nOutput:\n%s', command_string, process.returncode,
|
||||
output
|
||||
)
|
||||
|
||||
print_divider('!')
|
||||
@@ -123,23 +119,16 @@ def run_cmd(
|
||||
allowed_failure = True
|
||||
|
||||
if not allowed_failure:
|
||||
raise RuntimeError(
|
||||
'Command "%s" exited with code %s.' %
|
||||
(command_string, process.returncode)
|
||||
)
|
||||
raise RuntimeError('Command "%s" exited with code %s.' % (command_string, process.returncode))
|
||||
|
||||
for forbidden_string in forbidden_output:
|
||||
if forbidden_string in output:
|
||||
raise RuntimeError(
|
||||
'command "%s" contained forbidden string "%s"' %
|
||||
(command_string, forbidden_string)
|
||||
'command "%s" contained forbidden string "%s"' % (command_string, forbidden_string)
|
||||
)
|
||||
|
||||
print_divider('<')
|
||||
logger.info(
|
||||
'Command run successfully in %.2f seconds: %s', end_time - start_time,
|
||||
command_string
|
||||
)
|
||||
logger.info('Command run successfully in %.2f seconds: %s', end_time - start_time, command_string)
|
||||
|
||||
|
||||
def is_mac():
|
||||
@@ -199,9 +188,7 @@ def build_engine_executable_command(
|
||||
else:
|
||||
executable = find_executable_path(os.path.join(build_dir, executable_name))
|
||||
|
||||
coverage_script = os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'build', 'generate_coverage.py'
|
||||
)
|
||||
coverage_script = os.path.join(BUILDROOT_DIR, 'flutter', 'build', 'generate_coverage.py')
|
||||
|
||||
if coverage:
|
||||
coverage_flags = [
|
||||
@@ -214,8 +201,7 @@ def build_engine_executable_command(
|
||||
test_command = [executable] + flags
|
||||
if gtest:
|
||||
gtest_parallel = os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'third_party', 'gtest-parallel',
|
||||
'gtest-parallel'
|
||||
BUILDROOT_DIR, 'flutter', 'third_party', 'gtest-parallel', 'gtest-parallel'
|
||||
)
|
||||
test_command = ['python3', gtest_parallel] + test_command
|
||||
|
||||
@@ -299,16 +285,13 @@ def run_engine_executable( # pylint: disable=too-many-arguments
|
||||
# the dump and output a report that will be uploaded.
|
||||
luci_test_outputs_path = os.environ.get('FLUTTER_TEST_OUTPUTS_DIR')
|
||||
core_path = os.path.join(cwd, 'core')
|
||||
if luci_test_outputs_path and os.path.exists(core_path) and os.path.exists(
|
||||
unstripped_exe):
|
||||
if luci_test_outputs_path and os.path.exists(core_path) and os.path.exists(unstripped_exe):
|
||||
dump_path = os.path.join(
|
||||
luci_test_outputs_path, '%s_%s.txt' % (executable_name, sys_platform)
|
||||
)
|
||||
logger.error('Writing core dump analysis to %s', dump_path)
|
||||
subprocess.call([
|
||||
os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'testing', 'analyze_core_dump.sh'
|
||||
),
|
||||
os.path.join(BUILDROOT_DIR, 'flutter', 'testing', 'analyze_core_dump.sh'),
|
||||
BUILDROOT_DIR,
|
||||
unstripped_exe,
|
||||
core_path,
|
||||
@@ -360,10 +343,7 @@ class EngineExecutableTask(): # pylint: disable=too-many-instance-attributes
|
||||
|
||||
def __str__(self):
|
||||
command = build_engine_executable_command(
|
||||
self.build_dir,
|
||||
self.executable_name,
|
||||
flags=self.flags,
|
||||
coverage=self.coverage
|
||||
self.build_dir, self.executable_name, flags=self.flags, coverage=self.coverage
|
||||
)
|
||||
return ' '.join(command)
|
||||
|
||||
@@ -379,9 +359,7 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
|
||||
|
||||
if capture_core_dump and is_linux():
|
||||
import resource # pylint: disable=import-outside-toplevel
|
||||
resource.setrlimit(
|
||||
resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY)
|
||||
)
|
||||
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
|
||||
|
||||
repeat_flags = [
|
||||
'--repeat=2',
|
||||
@@ -449,15 +427,11 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
|
||||
'--golden-dir=%s' % GOLDEN_DIR,
|
||||
'--font-file=%s' % ROBOTO_FONT_PATH,
|
||||
]
|
||||
icu_flags = [
|
||||
'--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat')
|
||||
]
|
||||
icu_flags = ['--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat')]
|
||||
unittests += [
|
||||
make_test('flow_unittests', flags=repeat_flags + ['--'] + flow_flags),
|
||||
make_test('flutter_glfw_unittests'),
|
||||
make_test(
|
||||
'flutter_linux_unittests', extra_env={'G_DEBUG': 'fatal-criticals'}
|
||||
),
|
||||
make_test('flutter_linux_unittests', extra_env={'G_DEBUG': 'fatal-criticals'}),
|
||||
# https://github.com/flutter/flutter/issues/36296
|
||||
make_test('txt_unittests', flags=repeat_flags + ['--'] + icu_flags),
|
||||
]
|
||||
@@ -578,38 +552,22 @@ def run_cc_tests(build_dir, executable_filter, coverage, capture_core_dump):
|
||||
def run_engine_benchmarks(build_dir, executable_filter):
|
||||
logger.info('Running Engine Benchmarks.')
|
||||
|
||||
icu_flags = [
|
||||
'--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat')
|
||||
]
|
||||
icu_flags = ['--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat')]
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'shell_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'shell_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'fml_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'fml_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'ui_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'ui_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'display_list_builder_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'display_list_builder_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'geometry_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'geometry_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
run_engine_executable(
|
||||
build_dir, 'canvas_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'canvas_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
if is_linux():
|
||||
run_engine_executable(
|
||||
build_dir, 'txt_benchmarks', executable_filter, icu_flags
|
||||
)
|
||||
run_engine_executable(build_dir, 'txt_benchmarks', executable_filter, icu_flags)
|
||||
|
||||
|
||||
class FlutterTesterOptions():
|
||||
@@ -662,17 +620,14 @@ def gather_dart_test(build_dir, dart_file, options):
|
||||
options.apply_args(command_args)
|
||||
|
||||
dart_file_contents = open(dart_file, 'r')
|
||||
custom_options = re.findall(
|
||||
'// FlutterTesterOptions=(.*)', dart_file_contents.read()
|
||||
)
|
||||
custom_options = re.findall('// FlutterTesterOptions=(.*)', dart_file_contents.read())
|
||||
dart_file_contents.close()
|
||||
command_args.extend(custom_options)
|
||||
|
||||
command_args += [
|
||||
'--use-test-fonts',
|
||||
'--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat'),
|
||||
'--flutter-assets-dir=%s' %
|
||||
os.path.join(build_dir, 'gen', 'flutter', 'lib', 'ui', 'assets'),
|
||||
'--flutter-assets-dir=%s' % os.path.join(build_dir, 'gen', 'flutter', 'lib', 'ui', 'assets'),
|
||||
'--disable-asset-fonts',
|
||||
kernel_file_output,
|
||||
]
|
||||
@@ -682,9 +637,7 @@ def gather_dart_test(build_dir, dart_file, options):
|
||||
"Running test '%s' using '%s' (%s, %s)", kernel_file_name, tester_name,
|
||||
options.threading_description(), options.impeller_enabled()
|
||||
)
|
||||
forbidden_output = [] if 'unopt' in build_dir or options.expect_failure else [
|
||||
'[ERROR'
|
||||
]
|
||||
forbidden_output = [] if 'unopt' in build_dir or options.expect_failure else ['[ERROR']
|
||||
return EngineExecutableTask(
|
||||
build_dir,
|
||||
tester_name,
|
||||
@@ -700,24 +653,20 @@ def ensure_ios_tests_are_built(ios_out_dir):
|
||||
tmp_out_dir = os.path.join(OUT_DIR, ios_out_dir)
|
||||
ios_test_lib = os.path.join(tmp_out_dir, 'libios_test_flutter.dylib')
|
||||
message = []
|
||||
message.append(
|
||||
'gn --ios --unoptimized --runtime-mode=debug --no-lto --simulator'
|
||||
)
|
||||
message.append('gn --ios --unoptimized --runtime-mode=debug --no-lto --simulator')
|
||||
message.append('ninja -C %s ios_test_flutter' % ios_out_dir)
|
||||
final_message = "%s or %s doesn't exist. Please run the following commands: \n%s" % (
|
||||
ios_out_dir, ios_test_lib, '\n'.join(message)
|
||||
)
|
||||
assert os.path.exists(tmp_out_dir
|
||||
) and os.path.exists(ios_test_lib), final_message
|
||||
assert os.path.exists(tmp_out_dir) and os.path.exists(ios_test_lib), final_message
|
||||
|
||||
|
||||
def assert_expected_xcode_version():
|
||||
"""Checks that the user has a version of Xcode installed"""
|
||||
version_output = subprocess.check_output(['xcodebuild', '-version'])
|
||||
# TODO ricardoamador: remove this check when python 2 is deprecated.
|
||||
version_output = version_output if isinstance(
|
||||
version_output, str
|
||||
) else version_output.decode(ENCODING)
|
||||
version_output = version_output if isinstance(version_output,
|
||||
str) else version_output.decode(ENCODING)
|
||||
version_output = version_output.strip()
|
||||
match = re.match(r'Xcode (\d+)', version_output)
|
||||
message = 'Xcode must be installed to run the iOS embedding unit tests'
|
||||
@@ -728,16 +677,13 @@ def java_home():
|
||||
script_path = os.path.dirname(os.path.realpath(__file__))
|
||||
if is_mac():
|
||||
return os.path.join(
|
||||
script_path, '..', '..', 'third_party', 'java', 'openjdk', 'Contents',
|
||||
'Home'
|
||||
script_path, '..', '..', 'third_party', 'java', 'openjdk', 'Contents', 'Home'
|
||||
)
|
||||
return os.path.join(script_path, '..', '..', 'third_party', 'java', 'openjdk')
|
||||
|
||||
|
||||
def java_bin():
|
||||
return os.path.join(
|
||||
java_home(), 'bin', 'java.exe' if is_windows() else 'java'
|
||||
)
|
||||
return os.path.join(java_home(), 'bin', 'java.exe' if is_windows() else 'java')
|
||||
|
||||
|
||||
def run_java_tests(executable_filter, android_variant='android_debug_unopt'):
|
||||
@@ -746,19 +692,12 @@ def run_java_tests(executable_filter, android_variant='android_debug_unopt'):
|
||||
BUILDROOT_DIR, 'flutter', 'shell', 'platform', 'android', 'test_runner'
|
||||
)
|
||||
gradle_bin = os.path.join(
|
||||
BUILDROOT_DIR, 'third_party', 'gradle', 'bin',
|
||||
'gradle.bat' if is_windows() else 'gradle'
|
||||
BUILDROOT_DIR, 'third_party', 'gradle', 'bin', 'gradle.bat' if is_windows() else 'gradle'
|
||||
)
|
||||
flutter_jar = os.path.join(OUT_DIR, android_variant, 'flutter.jar')
|
||||
android_home = os.path.join(
|
||||
BUILDROOT_DIR, 'third_party', 'android_tools', 'sdk'
|
||||
)
|
||||
build_dir = os.path.join(
|
||||
OUT_DIR, android_variant, 'robolectric_tests', 'build'
|
||||
)
|
||||
gradle_cache_dir = os.path.join(
|
||||
OUT_DIR, android_variant, 'robolectric_tests', '.gradle'
|
||||
)
|
||||
android_home = os.path.join(BUILDROOT_DIR, 'third_party', 'android_tools', 'sdk')
|
||||
build_dir = os.path.join(OUT_DIR, android_variant, 'robolectric_tests', 'build')
|
||||
gradle_cache_dir = os.path.join(OUT_DIR, android_variant, 'robolectric_tests', '.gradle')
|
||||
|
||||
test_class = executable_filter if executable_filter else '*'
|
||||
command = [
|
||||
@@ -787,16 +726,11 @@ def run_android_tests(android_variant='android_debug_unopt', adb_path=None):
|
||||
run_cmd([adb_path, 'push', tests_path, remote_path], cwd=BUILDROOT_DIR)
|
||||
run_cmd([adb_path, 'shell', remote_tests_path])
|
||||
|
||||
systrace_test = os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'testing', 'android_systrace_test.py'
|
||||
)
|
||||
scenario_apk = os.path.join(
|
||||
OUT_DIR, android_variant, 'firebase_apks', 'scenario_app.apk'
|
||||
)
|
||||
systrace_test = os.path.join(BUILDROOT_DIR, 'flutter', 'testing', 'android_systrace_test.py')
|
||||
scenario_apk = os.path.join(OUT_DIR, android_variant, 'firebase_apks', 'scenario_app.apk')
|
||||
run_cmd([
|
||||
systrace_test, '--adb-path', adb_path, '--apk-path', scenario_apk,
|
||||
'--package-name', 'dev.flutter.scenarios', '--activity-name',
|
||||
'.PlatformViewsActivity'
|
||||
systrace_test, '--adb-path', adb_path, '--apk-path', scenario_apk, '--package-name',
|
||||
'dev.flutter.scenarios', '--activity-name', '.PlatformViewsActivity'
|
||||
])
|
||||
|
||||
|
||||
@@ -821,12 +755,9 @@ def run_objc_tests(ios_variant='ios_debug_sim_unopt', test_filter=None):
|
||||
run_cmd(create_simulator, shell=True)
|
||||
|
||||
try:
|
||||
ios_unit_test_dir = os.path.join(
|
||||
BUILDROOT_DIR, 'flutter', 'testing', 'ios', 'IosUnitTests'
|
||||
)
|
||||
ios_unit_test_dir = os.path.join(BUILDROOT_DIR, 'flutter', 'testing', 'ios', 'IosUnitTests')
|
||||
|
||||
with tempfile.TemporaryDirectory(suffix='ios_embedding_xcresult'
|
||||
) as result_bundle_temp:
|
||||
with tempfile.TemporaryDirectory(suffix='ios_embedding_xcresult') as result_bundle_temp:
|
||||
result_bundle_path = os.path.join(result_bundle_temp, 'ios_embedding')
|
||||
|
||||
# Avoid using xcpretty unless the following can be addressed:
|
||||
@@ -852,13 +783,9 @@ def run_objc_tests(ios_variant='ios_debug_sim_unopt', test_filter=None):
|
||||
# for additional output files that will be uploaded to cloud storage.
|
||||
# Upload the xcresult when the tests fail.
|
||||
luci_test_outputs_path = os.environ.get('FLUTTER_TEST_OUTPUTS_DIR')
|
||||
xcresult_bundle = os.path.join(
|
||||
result_bundle_temp, 'ios_embedding.xcresult'
|
||||
)
|
||||
xcresult_bundle = os.path.join(result_bundle_temp, 'ios_embedding.xcresult')
|
||||
if luci_test_outputs_path and os.path.exists(xcresult_bundle):
|
||||
dump_path = os.path.join(
|
||||
luci_test_outputs_path, 'ios_embedding.xcresult'
|
||||
)
|
||||
dump_path = os.path.join(luci_test_outputs_path, 'ios_embedding.xcresult')
|
||||
# xcresults contain many little files. Archive the bundle before upload.
|
||||
shutil.make_archive(dump_path, 'zip', root_dir=xcresult_bundle)
|
||||
raise
|
||||
@@ -896,20 +823,15 @@ def gather_dart_tests(build_dir, test_filter):
|
||||
cwd=dart_tests_dir,
|
||||
)
|
||||
|
||||
dart_observatory_tests = glob.glob(
|
||||
'%s/observatory/*_test.dart' % dart_tests_dir
|
||||
)
|
||||
dart_observatory_tests = glob.glob('%s/observatory/*_test.dart' % dart_tests_dir)
|
||||
dart_tests = glob.glob('%s/*_test.dart' % dart_tests_dir)
|
||||
|
||||
if 'release' not in build_dir:
|
||||
for dart_test_file in dart_observatory_tests:
|
||||
if test_filter is not None and os.path.basename(dart_test_file
|
||||
) not in test_filter:
|
||||
if test_filter is not None and os.path.basename(dart_test_file) not in test_filter:
|
||||
logger.info("Skipping '%s' due to filter.", dart_test_file)
|
||||
else:
|
||||
logger.info(
|
||||
"Gathering dart test '%s' with observatory enabled", dart_test_file
|
||||
)
|
||||
logger.info("Gathering dart test '%s' with observatory enabled", dart_test_file)
|
||||
for multithreaded in [False, True]:
|
||||
for enable_impeller in [False, True]:
|
||||
yield gather_dart_test(
|
||||
@@ -922,8 +844,7 @@ def gather_dart_tests(build_dir, test_filter):
|
||||
)
|
||||
|
||||
for dart_test_file in dart_tests:
|
||||
if test_filter is not None and os.path.basename(dart_test_file
|
||||
) not in test_filter:
|
||||
if test_filter is not None and os.path.basename(dart_test_file) not in test_filter:
|
||||
logger.info("Skipping '%s' due to filter.", dart_test_file)
|
||||
else:
|
||||
logger.info("Gathering dart test '%s'", dart_test_file)
|
||||
@@ -931,9 +852,7 @@ def gather_dart_tests(build_dir, test_filter):
|
||||
for enable_impeller in [False, True]:
|
||||
yield gather_dart_test(
|
||||
build_dir, dart_test_file,
|
||||
FlutterTesterOptions(
|
||||
multithreaded=multithreaded, enable_impeller=enable_impeller
|
||||
)
|
||||
FlutterTesterOptions(multithreaded=multithreaded, enable_impeller=enable_impeller)
|
||||
)
|
||||
|
||||
|
||||
@@ -945,17 +864,14 @@ def gather_dart_smoke_test(build_dir, test_filter):
|
||||
'smoke_test_failure',
|
||||
'fail_test.dart',
|
||||
)
|
||||
if test_filter is not None and os.path.basename(smoke_test
|
||||
) not in test_filter:
|
||||
if test_filter is not None and os.path.basename(smoke_test) not in test_filter:
|
||||
logger.info("Skipping '%s' due to filter.", smoke_test)
|
||||
else:
|
||||
yield gather_dart_test(
|
||||
build_dir, smoke_test,
|
||||
FlutterTesterOptions(multithreaded=True, expect_failure=True)
|
||||
build_dir, smoke_test, FlutterTesterOptions(multithreaded=True, expect_failure=True)
|
||||
)
|
||||
yield gather_dart_test(
|
||||
build_dir, smoke_test,
|
||||
FlutterTesterOptions(multithreaded=False, expect_failure=True)
|
||||
build_dir, smoke_test, FlutterTesterOptions(multithreaded=False, expect_failure=True)
|
||||
)
|
||||
|
||||
|
||||
@@ -966,11 +882,7 @@ def gather_dart_package_tests(build_dir, package_path, extra_opts):
|
||||
for dart_test_file in dart_tests:
|
||||
opts = ['--disable-dart-dev', dart_test_file] + extra_opts
|
||||
yield EngineExecutableTask(
|
||||
build_dir,
|
||||
os.path.join('dart-sdk', 'bin', 'dart'),
|
||||
None,
|
||||
flags=opts,
|
||||
cwd=package_path
|
||||
build_dir, os.path.join('dart-sdk', 'bin', 'dart'), None, flags=opts, cwd=package_path
|
||||
)
|
||||
|
||||
|
||||
@@ -1031,11 +943,7 @@ def run_benchmark_tests(build_dir):
|
||||
for dart_test_file in dart_tests:
|
||||
opts = ['--disable-dart-dev', dart_test_file]
|
||||
run_engine_executable(
|
||||
build_dir,
|
||||
os.path.join('dart-sdk', 'bin', 'dart'),
|
||||
None,
|
||||
flags=opts,
|
||||
cwd=test_dir
|
||||
build_dir, os.path.join('dart-sdk', 'bin', 'dart'), None, flags=opts, cwd=test_dir
|
||||
)
|
||||
|
||||
|
||||
@@ -1111,12 +1019,11 @@ def run_impeller_golden_tests(build_dir: str):
|
||||
tests_path: str = os.path.join(build_dir, 'impeller_golden_tests')
|
||||
if not os.path.exists(tests_path):
|
||||
raise Exception(
|
||||
'Cannot find the "impeller_golden_tests" executable in "%s". You may need to build it.'
|
||||
% (build_dir)
|
||||
'Cannot find the "impeller_golden_tests" executable in "%s". You may need to build it.' %
|
||||
(build_dir)
|
||||
)
|
||||
harvester_path: Path = Path(SCRIPT_DIR).parent.joinpath('tools').joinpath(
|
||||
'golden_tests_harvester'
|
||||
)
|
||||
harvester_path: Path = Path(SCRIPT_DIR).parent.joinpath('tools'
|
||||
).joinpath('golden_tests_harvester')
|
||||
with tempfile.TemporaryDirectory(prefix='impeller_golden') as temp_dir:
|
||||
run_cmd([tests_path, '--working_dir=%s' % temp_dir], cwd=build_dir)
|
||||
num_generated_files = len(os.listdir(temp_dir))
|
||||
@@ -1130,8 +1037,7 @@ def run_impeller_golden_tests(build_dir: str):
|
||||
|
||||
with DirectoryChange(harvester_path):
|
||||
run_cmd(['dart', 'pub', 'get'])
|
||||
bin_path = Path('.').joinpath('bin'
|
||||
).joinpath('golden_tests_harvester.dart')
|
||||
bin_path = Path('.').joinpath('bin').joinpath('golden_tests_harvester.dart')
|
||||
run_cmd(['dart', 'run', str(bin_path), temp_dir])
|
||||
|
||||
|
||||
@@ -1165,14 +1071,10 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
'--type',
|
||||
type=str,
|
||||
default='all',
|
||||
help='A list of test types, default is "all" (equivalent to "%s")' %
|
||||
(','.join(all_types))
|
||||
help='A list of test types, default is "all" (equivalent to "%s")' % (','.join(all_types))
|
||||
)
|
||||
parser.add_argument(
|
||||
'--engine-filter',
|
||||
type=str,
|
||||
default='',
|
||||
help='A list of engine test executables to run.'
|
||||
'--engine-filter', type=str, default='', help='A list of engine test executables to run.'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--dart-filter',
|
||||
@@ -1270,9 +1172,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
|
||||
build_dir = os.path.join(OUT_DIR, args.variant)
|
||||
if args.type != 'java' and args.type != 'android':
|
||||
assert os.path.exists(
|
||||
build_dir
|
||||
), 'Build variant directory %s does not exist!' % build_dir
|
||||
assert os.path.exists(build_dir), 'Build variant directory %s does not exist!' % build_dir
|
||||
|
||||
if args.sanitizer_suppressions:
|
||||
assert is_linux() or is_mac(
|
||||
@@ -1280,8 +1180,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
file_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
command = [
|
||||
'env', '-i', 'bash', '-c',
|
||||
'source {}/sanitizer_suppressions.sh >/dev/null && env'
|
||||
.format(file_dir)
|
||||
'source {}/sanitizer_suppressions.sh >/dev/null && env'.format(file_dir)
|
||||
]
|
||||
process = subprocess.Popen(command, stdout=subprocess.PIPE)
|
||||
for line in process.stdout:
|
||||
@@ -1293,9 +1192,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
|
||||
engine_filter = args.engine_filter.split(',') if args.engine_filter else None
|
||||
if 'engine' in types:
|
||||
run_cc_tests(
|
||||
build_dir, engine_filter, args.coverage, args.engine_capture_core_dump
|
||||
)
|
||||
run_cc_tests(build_dir, engine_filter, args.coverage, args.engine_capture_core_dump)
|
||||
|
||||
# Use this type to exclusively run impeller tests.
|
||||
if 'impeller' in types:
|
||||
@@ -1303,11 +1200,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
try:
|
||||
xvfb.start_virtual_x(build_name, build_dir)
|
||||
run_engine_executable(
|
||||
build_dir,
|
||||
'impeller_unittests',
|
||||
engine_filter,
|
||||
shuffle_flags,
|
||||
coverage=args.coverage
|
||||
build_dir, 'impeller_unittests', engine_filter, shuffle_flags, coverage=args.coverage
|
||||
)
|
||||
finally:
|
||||
xvfb.stop_virtual_x(build_name)
|
||||
@@ -1319,9 +1212,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
success = success and run_engine_tasks_in_parallel(tasks)
|
||||
|
||||
if 'dart-host' in types:
|
||||
dart_filter = args.dart_host_filter.split(
|
||||
','
|
||||
) if args.dart_host_filter else None
|
||||
dart_filter = args.dart_host_filter.split(',') if args.dart_host_filter else None
|
||||
dart_host_packages = build_dart_host_test_list(build_dir)
|
||||
tasks = []
|
||||
for dart_host_package, extra_opts in dart_host_packages:
|
||||
@@ -1337,8 +1228,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
success = success and run_engine_tasks_in_parallel(tasks)
|
||||
|
||||
if 'java' in types:
|
||||
assert not is_windows(
|
||||
), "Android engine files can't be compiled on Windows."
|
||||
assert not is_windows(), "Android engine files can't be compiled on Windows."
|
||||
java_filter = args.java_filter
|
||||
if ',' in java_filter or '*' in java_filter:
|
||||
logger.wraning(
|
||||
@@ -1349,8 +1239,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
run_java_tests(java_filter, args.android_variant)
|
||||
|
||||
if 'android' in types:
|
||||
assert not is_windows(
|
||||
), "Android engine files can't be compiled on Windows."
|
||||
assert not is_windows(), "Android engine files can't be compiled on Windows."
|
||||
run_android_tests(args.android_variant, args.adb_path)
|
||||
|
||||
if 'objc' in types:
|
||||
@@ -1363,8 +1252,7 @@ Flutter Wiki page on the subject: https://github.com/flutter/flutter/wiki/Testin
|
||||
run_engine_benchmarks(build_dir, engine_filter)
|
||||
|
||||
variants_to_skip = ['host_release', 'host_profile']
|
||||
if ('engine' in types or
|
||||
'font-subset' in types) and args.variant not in variants_to_skip:
|
||||
if ('engine' in types or 'font-subset' in types) and args.variant not in variants_to_skip:
|
||||
run_cmd(['python3', 'test.py'], cwd=FONT_SUBSET_DIR)
|
||||
|
||||
if 'impeller-golden' in types:
|
||||
|
||||
Reference in New Issue
Block a user