Skip to content

Commit

Permalink
Wait until server is ready in SeparateProcess test
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusTomlinson committed Jan 8, 2024
1 parent e7603de commit 1a37d0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <gtest/gtest.h>

#include <future>
#include <thread>

static const char* c_serverSocket = "server.sock";
Expand Down Expand Up @@ -74,14 +75,17 @@ TEST( Client, SameProcess )

TEST( Simple, SeparateProcess )
{
std::promise<void> ready;
std::thread(
[]
[&ready]
{
Ipc::Server server( c_serverSocket );
ready.set_value();
ASSERT_TRUE( server.Listen( RecvCallback ) );
ASSERT_TRUE( server.Listen( RecvCallback ) );
} )
.detach();
ready.get_future().wait();

EXPECT_EXIT(
{
Expand Down

0 comments on commit 1a37d0d

Please sign in to comment.