diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:10:56 +0000 |
commit | 044eb2f6afba375a914ac9d8024f8f5142bb912e (patch) | |
tree | 1475247dc9f9fe5be155ebd4c9069c75aadf8c20 /unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | |
parent | eb70dddbd77e120e5d490bd8fbe7ff3f8fa81c6b (diff) |
Notes
Diffstat (limited to 'unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp')
-rw-r--r-- | unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp index 1c9764b555fd..7fe449b70169 100644 --- a/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp +++ b/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp @@ -263,6 +263,51 @@ TEST(DummyRPC, TestCallAsyncIntInt) { ServerThread.join(); } +TEST(DummyRPC, TestAsyncVoidBoolHandler) { + auto Channels = createPairedQueueChannels(); + DummyRPCEndpoint Client(*Channels.first); + DummyRPCEndpoint Server(*Channels.second); + + std::thread ServerThread([&]() { + Server.addAsyncHandler<DummyRPCAPI::VoidBool>( + [](std::function<Error(Error)> SendResult, + bool B) { + EXPECT_EQ(B, true) << "Server void(bool) receieved unexpected result"; + cantFail(SendResult(Error::success())); + return Error::success(); + }); + + { + // Poke the server to handle the negotiate call. + auto Err = Server.handleOne(); + EXPECT_FALSE(!!Err) << "Server failed to handle call to negotiate"; + } + + { + // Poke the server to handle the VoidBool call. + auto Err = Server.handleOne(); + EXPECT_FALSE(!!Err) << "Server failed to handle call to void(bool)"; + } + }); + + { + auto Err = Client.callAsync<DummyRPCAPI::VoidBool>( + [](Error Result) { + EXPECT_FALSE(!!Result) << "Async void(bool) response handler failed"; + return Error::success(); + }, true); + EXPECT_FALSE(!!Err) << "Client.callAsync failed for void(bool)"; + } + + { + // Poke the client to process the result. + auto Err = Client.handleOne(); + EXPECT_FALSE(!!Err) << "Client failed to handle response from void(bool)"; + } + + ServerThread.join(); +} + TEST(DummyRPC, TestAsyncIntIntHandler) { auto Channels = createPairedQueueChannels(); DummyRPCEndpoint Client(*Channels.first); |