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

Commit af1dd97

Browse files
authored
Enable repeat for desktop embedder tests (#28253)
1 parent 2bf66b9 commit af1dd97

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

shell/platform/embedder/test_utils/proc_table_replacement.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
// FlutterEngineProcTable entries (by using statics) to facilitate mocking in
99
// tests of code built on top of the embedder API.
1010
//
11-
// This should *ONLY* be used in unit tests as it is leaky by design. Because it
12-
// uses statics for the lambdas, tests using this macro are generally not safe
13-
// to run multiple times (e.g., using gtest_repeat).
11+
// This should *ONLY* be used in unit tests as it is leaky by design.
1412
//
1513
// |proc| should be the name of an entry in FlutterEngineProcTable, such as
1614
// "Initialize". |mock_impl| should be a lamba that replaces its implementation,
@@ -19,7 +17,8 @@
1917
([&]() { \
2018
static std::function< \
2119
std::remove_pointer_t<decltype(FlutterEngineProcTable::proc)>> \
22-
closure = mock_impl; \
20+
closure; \
21+
closure = mock_impl; \
2322
static auto non_capturing = [](auto... args) { return closure(args...); }; \
2423
return non_capturing; \
2524
})()

testing/run_tests.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,9 @@ def RunCCTests(build_dir, filter, coverage, capture_core_dump):
166166
import resource
167167
resource.setrlimit(resource.RLIMIT_CORE, (resource.RLIM_INFINITY, resource.RLIM_INFINITY))
168168

169-
# Not all of the engine unit tests are designed to be run more than once.
170-
non_repeatable_shuffle_flags = [
171-
"--gtest_shuffle",
172-
]
173-
shuffle_flags = non_repeatable_shuffle_flags + [
169+
shuffle_flags = [
174170
"--gtest_repeat=2",
171+
"--gtest_shuffle",
175172
]
176173

177174
RunEngineExecutable(build_dir, 'client_wrapper_glfw_unittests', filter, shuffle_flags, coverage=coverage)
@@ -187,7 +184,7 @@ def RunCCTests(build_dir, filter, coverage, capture_core_dump):
187184
RunEngineExecutable(build_dir, 'embedder_unittests', filter, shuffle_flags, coverage=coverage)
188185
RunEngineExecutable(build_dir, 'embedder_proctable_unittests', filter, shuffle_flags, coverage=coverage)
189186
else:
190-
RunEngineExecutable(build_dir, 'flutter_windows_unittests', filter, non_repeatable_shuffle_flags, coverage=coverage)
187+
RunEngineExecutable(build_dir, 'flutter_windows_unittests', filter, shuffle_flags, coverage=coverage)
191188

192189
RunEngineExecutable(build_dir, 'client_wrapper_windows_unittests', filter, shuffle_flags, coverage=coverage)
193190

@@ -225,16 +222,16 @@ def RunCCTests(build_dir, filter, coverage, capture_core_dump):
225222
# These unit-tests are Objective-C and can only run on Darwin.
226223
if IsMac():
227224
RunEngineExecutable(build_dir, 'flutter_channels_unittests', filter, shuffle_flags, coverage=coverage)
228-
RunEngineExecutable(build_dir, 'flutter_desktop_darwin_unittests', filter, non_repeatable_shuffle_flags, coverage=coverage)
225+
RunEngineExecutable(build_dir, 'flutter_desktop_darwin_unittests', filter, shuffle_flags, coverage=coverage)
229226

230227
# https://github.com/flutter/flutter/issues/36296
231228
if IsLinux():
232229
icu_flags = ['--icu-data-file-path=%s' % os.path.join(build_dir, 'icudtl.dat')]
233230
RunEngineExecutable(build_dir, 'txt_unittests', filter, icu_flags + shuffle_flags, coverage=coverage)
234231

235232
if IsLinux():
236-
RunEngineExecutable(build_dir, 'flutter_linux_unittests', filter, non_repeatable_shuffle_flags, coverage=coverage)
237-
RunEngineExecutable(build_dir, 'flutter_glfw_unittests', filter, non_repeatable_shuffle_flags, coverage=coverage)
233+
RunEngineExecutable(build_dir, 'flutter_linux_unittests', filter, shuffle_flags, coverage=coverage)
234+
RunEngineExecutable(build_dir, 'flutter_glfw_unittests', filter, shuffle_flags, coverage=coverage)
238235

239236

240237
def RunEngineBenchmarks(build_dir, filter):

0 commit comments

Comments
 (0)