From d8ef8e68805ab7f53258427c79ee5aaafec916ba Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 10 Mar 2016 17:09:59 -0600 Subject: add UsbManager --- tests/unit/adbd-client-test.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'tests/unit/adbd-client-test.cpp') diff --git a/tests/unit/adbd-client-test.cpp b/tests/unit/adbd-client-test.cpp index 1e28cc9..6514456 100644 --- a/tests/unit/adbd-client-test.cpp +++ b/tests/unit/adbd-client-test.cpp @@ -31,22 +31,22 @@ private: protected: - std::string m_tmpdir; + static void file_deleter (std::string* s) + { + fprintf(stderr, "remove \"%s\"\n", s->c_str()); + remove(s->c_str()); + delete s; + } + + std::shared_ptr m_tmpdir; void SetUp() { super::SetUp(); char tmpl[] {"adb-client-test-XXXXXX"}; - m_tmpdir = mkdtemp(tmpl); - g_message("using tmpdir '%s'", m_tmpdir.c_str()); - } - - void TearDown() - { - g_rmdir(m_tmpdir.c_str()); - - super::TearDown(); + m_tmpdir.reset(new std::string{mkdtemp(tmpl)}, file_deleter); + g_message("using tmpdir '%s'", m_tmpdir->c_str()); } }; @@ -67,7 +67,7 @@ TEST_F(AdbdClientFixture, SocketPlumbing) const auto main_thread = g_thread_self(); - const auto socket_path = m_tmpdir + "/test-socket-plumbing"; + const auto socket_path = *m_tmpdir + "/test-socket-plumbing"; g_message("socket_path is %s", socket_path.c_str()); for (const auto& test : tests) -- cgit v1.2.3