fuchsia: Fix runtime_tests and shell_tests (flutter/engine#18492)

This commit is contained in:
David Worsham
2020-05-20 18:47:02 -07:00
committed by GitHub
parent 83b6d014e7
commit 9ed56044d4
4 changed files with 36 additions and 30 deletions

View File

@@ -6,14 +6,23 @@
#include <lib/async-loop/default.h>
#include <lib/async/cpp/task.h>
#include <lib/async/default.h>
#include <lib/zx/time.h>
namespace fml {
MessageLoopFuchsia::MessageLoopFuchsia()
: loop_(&kAsyncLoopConfigAttachToCurrentThread) {}
: loop_(&kAsyncLoopConfigNoAttachToCurrentThread) {
async_set_default_dispatcher(loop_.dispatcher());
}
MessageLoopFuchsia::~MessageLoopFuchsia() = default;
MessageLoopFuchsia::~MessageLoopFuchsia() {
// It is only safe to unset the current thread's default dispatcher if it is
// already pointing to this loop.
if (async_get_default_dispatcher() == loop_.dispatcher()) {
async_set_default_dispatcher(nullptr);
}
}
void MessageLoopFuchsia::Run() {
loop_.Run();

View File

@@ -46,9 +46,9 @@ TEST_F(ShellTest, VSyncTargetTime) {
};
// create a shell with a constant firing vsync waiter.
fml::AutoResetWaitableEvent shell_creation;
auto platform_task = std::async(std::launch::async, [&]() {
fml::MessageLoop::EnsureInitializedForCurrentThread();
shell = Shell::Create(
task_runners, settings,
[vsync_clock, &create_vsync_waiter](Shell& shell) {
@@ -67,10 +67,8 @@ TEST_F(ShellTest, VSyncTargetTime) {
configuration.SetEntrypoint("onBeginFrameMain");
RunEngine(shell.get(), std::move(configuration));
shell_creation.Signal();
});
shell_creation.Wait();
platform_task.wait();
// schedule a frame to trigger window.onBeginFrame
fml::TaskRunner::RunNowOrPostTask(shell->GetTaskRunners().GetUITaskRunner(),

View File

@@ -13,6 +13,7 @@
"fuchsia.process.Launcher",
"fuchsia.deprecatedtimezone.Timezone",
"fuchsia.netstack.Netstack",
"fuchsia.sysmem.Allocator",
"fuchsia.vulkan.loader.Loader",
"fuchsia.logger.LogSink",
"fuchsia.tracing.provider.Registry"

View File

@@ -76,7 +76,6 @@ echo "$(date) END:EXTRACT_PACKAGES -----------------------------------"
# TODO(gw280): Enable tests using JIT runner
echo "$(date) START:flutter_runner_tests ----------------------------"
./fuchsia_ctl -d $device_name test \
-f flutter_aot_runner-0.far \
@@ -93,14 +92,15 @@ echo "$(date) START:flutter_runner_tests ----------------------------"
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:flutter_runner_tests ----------------------------"
# TODO(https://github.com/flutter/flutter/issues/50032) Enable after the
# Fuchsia message loop migration is complete.
# TODO(https://github.com/flutter/flutter/issues/??): Re-enable
# FileTest's once they pass on Fuchsia.
echo "$(date) START:fml_tests ---------------------------------------"
./fuchsia_ctl -d $device_name test \
-f fml_tests-0.far \
-t fml_tests \
-a "--gtest_filter=-MessageLoop*:Message*:FileTest*" \
-a "--gtest_filter=-FileTest*" \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
@@ -117,26 +117,24 @@ echo "$(date) START:flow_tests --------------------------------------"
echo "$(date) DONE:flow_tests ---------------------------------------"
# TODO(kaushikiska): Runtime and shell tests are failing with
# async_dispatcher failures. Re-enable them once this gets fixed.
# echo "$(date) START:runtime_tests -----------------------------------"
# ./fuchsia_ctl -d $device_name test \
# -f runtime_tests-0.far \
# -t runtime_tests \
# --identity-file $pkey \
# --timeout-seconds $test_timeout_seconds \
# --packages-directory packages
echo "$(date) START:runtime_tests -----------------------------------"
./fuchsia_ctl -d $device_name test \
-f runtime_tests-0.far \
-t runtime_tests \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:runtime_tests -----------------------------------"
# TODO(https://github.com/flutter/flutter/issues/53399): Re-enable
# OnServiceProtocolGetSkSLsWorks, CanLoadSkSLsFromAsset, and
# CanRemoveOldPersistentCache once they pass on Fuchsia.
# echo "$(date) START:shell_tests -------------------------------------"
# ./fuchsia_ctl -d $device_name test \
# -f shell_tests-0.far \
# -t shell_tests \
# -a "--gtest_filter=-ShellTest.CacheSkSLWorks:ShellTest.SetResourceCacheSize*:ShellTest.OnServiceProtocolGetSkSLsWorks:ShellTest.CanLoadSkSLsFromAsset:ShellTest.CanRemoveOldPersistentCache" \
# --identity-file $pkey \
# --timeout-seconds $test_timeout_seconds \
# --packages-directory packages
echo "$(date) START:shell_tests -------------------------------------"
./fuchsia_ctl -d $device_name test \
-f shell_tests-0.far \
-t shell_tests \
-a "--gtest_filter=-ShellTest.CacheSkSLWorks:ShellTest.SetResourceCacheSize*:ShellTest.OnServiceProtocolGetSkSLsWorks:ShellTest.CanLoadSkSLsFromAsset:ShellTest.CanRemoveOldPersistentCache" \
--identity-file $pkey \
--timeout-seconds $test_timeout_seconds \
--packages-directory packages
echo "$(date) DONE:shell_tests -----------------------------------"