diff --git a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc index 9b016469cf6ae8f68c4ec7829e772419aa3ed512..cfcac112288b59584a1c464593daaa44af5205a0 100644 --- a/paddle/fluid/operators/reader/reader_blocking_queue_test.cc +++ b/paddle/fluid/operators/reader/reader_blocking_queue_test.cc @@ -221,3 +221,28 @@ TEST(BlockingQueue, MyClassTest) { q.Receive(&b); EXPECT_EQ(a.val_, b.val_); } + +TEST(BlockingQueue, reader_queue_speed_test_mode_flag) { + FLAGS_reader_queue_speed_test_mode = false; + size_t queue_size = 10; + BlockingQueue q(queue_size); + for (size_t i = 0; i < queue_size; ++i) { + q.Send(i); + } + size_t b; + for (size_t i = 0; i < queue_size; ++i) { + q.Receive(&b); + EXPECT_EQ(b, i); + } + EXPECT_EQ(q.Size(), 0); + + FLAGS_reader_queue_speed_test_mode = true; + for (size_t i = 0; i < queue_size; ++i) { + q.Send(i); + } + for (size_t i = 0; i < queue_size; ++i) { + q.Receive(&b); + EXPECT_EQ(b, 0); + } + EXPECT_EQ(q.Size(), queue_size); +}