diff --git a/test/unitTest/conversation/conversationRequest.cpp b/test/unitTest/conversation/conversationRequest.cpp index e329ab8823e33fbfd2efaf701a6b1b061803ef1d..ad9e574eb8d249a8afb10723232b1f96bd04e5a0 100644 --- a/test/unitTest/conversation/conversationRequest.cpp +++ b/test/unitTest/conversation/conversationRequest.cpp @@ -333,8 +333,8 @@ ConversationRequestTest::connectSignals() void ConversationRequestTest::tearDown() { - auto bobArchive = std::filesystem::current_path().string() + "/bob.gz"; - std::remove(bobArchive.c_str()); + auto bobArchive = std::filesystem::current_path() / "bob.gz"; + std::filesystem::remove(bobArchive); if (bob2Id.empty()) { wait_for_removal_of({aliceId, bobId, carlaId}); @@ -604,8 +604,8 @@ ConversationRequestTest::testRemoveContactMultiDevice() // Add second device for Bob std::map<std::string, std::shared_ptr<libjami::CallbackWrapperBase>> confHandlers; - auto bobArchive = std::filesystem::current_path().string() + "/bob.gz"; - std::remove(bobArchive.c_str()); + auto bobArchive = std::filesystem::current_path() / "bob.gz"; + std::filesystem::remove(bobArchive); bobAccount->exportArchive(bobArchive); std::map<std::string, std::string> details = libjami::getAccountTemplate("RING"); diff --git a/test/unitTest/fileTransfer/fileTransfer.cpp b/test/unitTest/fileTransfer/fileTransfer.cpp index 1c12756685a7af6f871d1a54818b8c2b3b71bb30..072fa1e307790f0b5dd35f580dc204c6f3203ad5 100644 --- a/test/unitTest/fileTransfer/fileTransfer.cpp +++ b/test/unitTest/fileTransfer/fileTransfer.cpp @@ -192,6 +192,7 @@ FileTransferTest::connectSignals() [&](const std::string& accountId, const std::string& /* conversationId */, libjami::SwarmMessage message) { + std::unique_lock<std::mutex> lk {mtx}; if (accountId == aliceId) { aliceData.messages.emplace_back(message); } else if (accountId == bobId) { @@ -389,7 +390,7 @@ FileTransferTest::testBadSha3sumOut() CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobMsgSize + 1 == bobData.messages.size(); })); // modifiy file - sendFile = std::ofstream(sendPath); + sendFile = std::ofstream(sendPath, std::ios::trunc); CPPUNIT_ASSERT(sendFile.is_open()); sendFile << std::string(64000, 'B'); sendFile.close(); @@ -635,7 +636,7 @@ FileTransferTest::testTooLarge() auto fileId = bobData.messages.rbegin()->body["fileId"]; // Add some data for the reception. This will break the final shasum - std::ofstream recvFile(recvPath); + std::ofstream recvFile(recvPath + std::string(".tmp")); CPPUNIT_ASSERT(recvFile.is_open()); recvFile << std::string(1000, 'B'); recvFile.close();