Brian Silverman | 459d37a | 2015-03-29 18:00:30 -0400 | [diff] [blame^] | 1 | #include "aos/common/queue_testutils.h" |
| 2 | |
| 3 | #include <thread> |
| 4 | |
| 5 | #include "gtest/gtest.h" |
| 6 | |
| 7 | #include "aos/common/logging/logging.h" |
| 8 | |
| 9 | namespace aos { |
| 10 | namespace common { |
| 11 | namespace testing { |
| 12 | |
| 13 | // Tests logging from multiple threads. |
| 14 | // tsan used to complain about this. |
| 15 | TEST(QueueTestutilsTest, MultithreadedLog) { |
| 16 | EnableTestLogging(); |
| 17 | |
| 18 | ::std::thread thread([]() { |
| 19 | for (int i = 0; i < 1000; ++i) { |
| 20 | LOG(INFO, "test from thread\n"); |
| 21 | } |
| 22 | }); |
| 23 | for (int i = 0; i < 1000; ++i) { |
| 24 | LOG(INFO, "not from thread\n"); |
| 25 | } |
| 26 | thread.join(); |
| 27 | } |
| 28 | |
| 29 | } // namespace testing |
| 30 | } // namespace common |
| 31 | } // namespace aos |