blob: 2defe742f92f4f81583eadbc1e2c5f6519264db3 [file] [log] [blame]
Brian Silverman459d37a2015-03-29 18:00:30 -04001#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
9namespace aos {
10namespace common {
11namespace testing {
12
13// Tests logging from multiple threads.
14// tsan used to complain about this.
15TEST(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