Reland "fix fml_unittes is not run during presubmit (#13395)" (flutter/engine#13426)

This commit is contained in:
chunhtai
2019-10-31 13:50:19 -07:00
committed by GitHub
parent f833bd5834
commit 29b3675e23
2 changed files with 13 additions and 9 deletions

View File

@@ -173,8 +173,10 @@ TEST(MessageLoopTaskQueue, NotifyObserversWhileCreatingQueues) {
before_second_observer.Signal();
notify_observers.join();
}
TEST(MessageLoopTaskQueue, ConcurrentQueueAndTaskCreatingCounts) {
// TODO(chunhtai): This unit-test is flaky and sometimes fails asynchronizely
// after the test has finished.
// https://github.com/flutter/flutter/issues/43858
TEST(MessageLoopTaskQueue, DISABLED_ConcurrentQueueAndTaskCreatingCounts) {
auto task_queues = fml::MessageLoopTaskQueues::GetInstance();
const int base_queue_id = task_queues->CreateTaskQueue();
@@ -192,17 +194,19 @@ TEST(MessageLoopTaskQueue, ConcurrentQueueAndTaskCreatingCounts) {
auto creation_func = [&] {
for (int i = 0; i < num_queues; i++) {
fml::TaskQueueId queue_id = task_queues->CreateTaskQueue();
created[queue_id - base_queue_id] = true;
int limit = queue_id - base_queue_id;
created[limit] = true;
for (int cur_q = 1; cur_q < i; cur_q++) {
if (created[cur_q - base_queue_id]) {
std::scoped_lock counter(task_count_mutex[cur_q - base_queue_id]);
for (int cur_q = 1; cur_q < limit; cur_q++) {
if (created[cur_q]) {
std::scoped_lock counter(task_count_mutex[cur_q]);
int cur_num_tasks = rand() % 10;
for (int k = 0; k < cur_num_tasks; k++) {
task_queues->RegisterTask(
fml::TaskQueueId(cur_q), [] {}, fml::TimePoint::Now());
fml::TaskQueueId(base_queue_id + cur_q), [] {},
fml::TimePoint::Now());
}
num_tasks[cur_q - base_queue_id] += cur_num_tasks;
num_tasks[cur_q] += cur_num_tasks;
}
}
}

View File

@@ -21,7 +21,7 @@ fonts_dir = os.path.join(buildroot_dir, 'flutter', 'third_party', 'txt', 'third_
roboto_font_path = os.path.join(fonts_dir, 'Roboto-Regular.ttf')
dart_tests_dir = os.path.join(buildroot_dir, 'flutter', 'testing', 'dart',)
time_sensitve_test_flag = '--gtest_filter="-*TimeSensitiveTest*"'
time_sensitve_test_flag = '--gtest_filter=-*TimeSensitiveTest*'
def IsMac():
return sys.platform == 'darwin'