summaryrefslogtreecommitdiff
path: root/tests/test_command_queue.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_command_queue.h')
-rw-r--r--tests/test_command_queue.h46
1 files changed, 1 insertions, 45 deletions
diff --git a/tests/test_command_queue.h b/tests/test_command_queue.h
index 620fb96985..f0d4569942 100644
--- a/tests/test_command_queue.h
+++ b/tests/test_command_queue.h
@@ -156,7 +156,7 @@ public:
command_queue.flush_all();
}
for (int i = 0; i < message_count_to_read; i++) {
- command_queue.wait_and_flush_one();
+ command_queue.wait_and_flush();
}
message_count_to_read = 0;
@@ -276,50 +276,6 @@ TEST_CASE("[CommandQueue] Test Queue Basics") {
ProjectSettings::get_singleton()->property_get_revert(COMMAND_QUEUE_SETTING));
}
-TEST_CASE("[CommandQueue] Test Waiting at Queue Full") {
- const char *COMMAND_QUEUE_SETTING = "memory/limits/command_queue/multithreading_queue_size_kb";
- ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING, 1);
- SharedThreadState sts;
- sts.init_threads();
-
- int msgs_to_add = 24; // a queue of size 1kB fundamentally cannot fit 24 matrices.
- for (int i = 0; i < msgs_to_add; i++) {
- sts.add_msg_to_write(SharedThreadState::TEST_MSG_FUNC1_TRANSFORM);
- }
- sts.writer_threadwork.main_start_work();
- // If we call main_wait_for_done, we will deadlock. So instead...
- sts.message_count_to_read = 1;
- sts.reader_threadwork.main_start_work();
- sts.reader_threadwork.main_wait_for_done();
- CHECK_MESSAGE(sts.func1_count == 1,
- "Reader should have read one message");
- CHECK_MESSAGE(sts.during_writing,
- "Writer thread should still be blocked on writing.");
- sts.message_count_to_read = msgs_to_add - 3;
- sts.reader_threadwork.main_start_work();
- sts.reader_threadwork.main_wait_for_done();
- CHECK_MESSAGE(sts.func1_count >= msgs_to_add - 3,
- "Reader should have read most messages");
- sts.writer_threadwork.main_wait_for_done();
- CHECK_MESSAGE(sts.during_writing == false,
- "Writer thread should no longer be blocked on writing.");
- sts.message_count_to_read = 2;
- sts.reader_threadwork.main_start_work();
- sts.reader_threadwork.main_wait_for_done();
- sts.message_count_to_read = -1;
- sts.reader_threadwork.main_start_work();
- sts.reader_threadwork.main_wait_for_done();
- CHECK_MESSAGE(sts.func1_count == msgs_to_add,
- "Reader should have read all messages");
-
- sts.destroy_threads();
-
- CHECK_MESSAGE(sts.func1_count == msgs_to_add,
- "Reader should have read no additional messages after join");
- ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING,
- ProjectSettings::get_singleton()->property_get_revert(COMMAND_QUEUE_SETTING));
-}
-
TEST_CASE("[CommandQueue] Test Queue Wrapping to same spot.") {
const char *COMMAND_QUEUE_SETTING = "memory/limits/command_queue/multithreading_queue_size_kb";
ProjectSettings::get_singleton()->set_setting(COMMAND_QUEUE_SETTING, 1);