diff options
author | anon <anon [at] nowhere> | 2021-07-28 13:38:24 +0000 |
---|---|---|
committer | anon <anon [at] nowhere> | 2021-07-28 13:38:24 +0000 |
commit | 9c8e3e832e0da86403cbf2716b08a24898d5fce0 (patch) | |
tree | 0a36e53016ffa6ca0885d275c4dfca35555f35aa /tests/unit_tests/node_server.cpp | |
parent | Merge pull request #7782 (diff) | |
download | monero-9c8e3e832e0da86403cbf2716b08a24898d5fce0.tar.xz |
unit_tests: fix broken tests
boosted_tcp_server: check condition before sleep too
cryptonote_protocol_handler: each instance of BlockchainLMDB requires separate thread due to private thread local fields
Diffstat (limited to 'tests/unit_tests/node_server.cpp')
-rw-r--r-- | tests/unit_tests/node_server.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/unit_tests/node_server.cpp b/tests/unit_tests/node_server.cpp index 2c80acda5..cab600b3d 100644 --- a/tests/unit_tests/node_server.cpp +++ b/tests/unit_tests/node_server.cpp @@ -795,9 +795,11 @@ TEST(cryptonote_protocol_handler, race_condition) workers_t workers; } check; check.work = std::make_shared<work_t>(check.io_context); - check.workers.emplace_back([&check]{ - check.io_context.run(); - }); + while (check.workers.size() < 2) { + check.workers.emplace_back([&check]{ + check.io_context.run(); + }); + } while (daemon.main.conn.size() < 1) { daemon.main.conn.emplace_back(new connection_t(check.io_context, daemon.main.shared_state, {}, {})); daemon.alt.conn.emplace_back(new connection_t(io_context, daemon.alt.shared_state, {}, {})); @@ -856,7 +858,7 @@ TEST(cryptonote_protocol_handler, race_condition) } } while (daemon.main.conn.size() < 2) { - daemon.main.conn.emplace_back(new connection_t(io_context, daemon.main.shared_state, {}, {})); + daemon.main.conn.emplace_back(new connection_t(check.io_context, daemon.main.shared_state, {}, {})); daemon.alt.conn.emplace_back(new connection_t(io_context, daemon.alt.shared_state, {}, {})); create_conn_pair(daemon.main.conn.back(), daemon.alt.conn.back()); conduct_handshake(daemon.alt.net_node, daemon.alt.conn.back()); |