diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/adbd-client-test.cpp | 13 | ||||
-rw-r--r-- | tests/unit/usb-snap-test.cpp | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp index 754f76c..20d6ee4 100644 --- a/tests/unit/adbd-client-test.cpp +++ b/tests/unit/adbd-client-test.cpp @@ -70,26 +70,35 @@ TEST_F(AdbdClientFixture, SocketPlumbing) for (const auto& test : tests) { +g_message("%s %s thread %p starting test", G_STRLOC, G_STRFUNC, g_thread_self()); // start an AdbdClient that listens for PKRequests std::string pk; auto adbd_client = std::make_shared<GAdbdClient>(socket_path); - adbd_client->on_pk_request().connect([&pk, main_thread, test](const AdbdClient::PKRequest& req){ + auto connection = adbd_client->on_pk_request().connect([&pk, main_thread, test](const AdbdClient::PKRequest& req){ +g_message("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); EXPECT_EQ(main_thread, g_thread_self()); +g_message("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); g_message("in on_pk_request with %s", req.public_key.c_str()); +g_message("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); pk = req.public_key; +g_message("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); req.respond(test.response); +g_message("%s %s thread %p", G_STRLOC, G_STRFUNC, g_thread_self()); }); // start a mock AdbdServer with to fire test key requests and wait for a response auto adbd_server = std::make_shared<GAdbdServer>(socket_path, std::vector<std::string>{test.request}); - wait_for([adbd_server](){return !adbd_server->m_responses.empty();}, 2000); + wait_for([adbd_server](){return !adbd_server->m_responses.empty();}, 5000); EXPECT_EQ(test.expected_pk, pk); ASSERT_EQ(1, adbd_server->m_responses.size()); EXPECT_EQ(test.expected_response, adbd_server->m_responses.front()); // cleanup +g_message("%s %s thread %p cleanup", G_STRLOC, G_STRFUNC, g_thread_self()); + connection.disconnect(); adbd_client.reset(); adbd_server.reset(); g_unlink(socket_path.c_str()); +g_message("%s %s thread %p test exit", G_STRLOC, G_STRFUNC, g_thread_self()); } } diff --git a/tests/unit/usb-snap-test.cpp b/tests/unit/usb-snap-test.cpp index 6cfbbd9..2be4b27 100644 --- a/tests/unit/usb-snap-test.cpp +++ b/tests/unit/usb-snap-test.cpp @@ -88,7 +88,7 @@ TEST_F(UsbSnapFixture, TestRoundTrip) auto snap = std::make_shared<UsbSnap>(test.fingerprint); AdbdClient::PKResponse user_response {}; bool user_response_set = false; - snap->on_user_response().connect([&user_response,&user_response_set](AdbdClient::PKResponse response, bool /*remember*/){ + auto connection = snap->on_user_response().connect([&user_response,&user_response_set](AdbdClient::PKResponse response, bool /*remember*/){ user_response = response; user_response_set = true; }); |