diff options
author | Nico Weber <nicolasweber@gmx.de> | 2016-04-18 13:57:08 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2016-04-18 13:57:08 +0000 |
commit | ca94d0ec0c1298fec7f3bd5d8e7d537f9efd6142 (patch) | |
tree | e039d0fe888f2c3a631b3bf6aba661a86d8d12df /llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | |
parent | dd2ca837959c74dcf0bd602748041507597f0493 (diff) | |
download | bcm5719-llvm-ca94d0ec0c1298fec7f3bd5d8e7d537f9efd6142.tar.gz bcm5719-llvm-ca94d0ec0c1298fec7f3bd5d8e7d537f9efd6142.zip |
Revert 266581 (and follow-up 266588), it doesn't build on Windows.
Three problems:
1. <future> can't be easily used. If you must use it, see
include/Support/ThreadPool.h for how.
2. constexpr problems, even after 266588.
3. Move assignment operators can't be defaulted in MSVC2013.
llvm-svn: 266615
Diffstat (limited to 'llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp')
-rw-r--r-- | llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp | 103 |
1 files changed, 27 insertions, 76 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp index 77632e35eb1..3b01c3828b6 100644 --- a/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp +++ b/llvm/unittests/ExecutionEngine/Orc/RPCUtilsTest.cpp @@ -44,25 +44,26 @@ private: class DummyRPC : public testing::Test, public RPC<QueueChannel> { public: - typedef Function<2, void(bool)> BasicVoid; - typedef Function<3, int32_t(bool)> BasicInt; - typedef Function<4, void(int8_t, uint8_t, int16_t, uint16_t, - int32_t, uint32_t, int64_t, uint64_t, - bool, std::string, std::vector<int>)> AllTheTypes; + typedef Procedure<1, void(bool)> Proc1; + typedef Procedure<2, void(int8_t, uint8_t, int16_t, uint16_t, + int32_t, uint32_t, int64_t, uint64_t, + bool, std::string, std::vector<int>)> AllTheTypes; }; -TEST_F(DummyRPC, TestAsyncBasicVoid) { +TEST_F(DummyRPC, TestBasic) { std::queue<char> Queue; QueueChannel C(Queue); - // Make an async call. - auto ResOrErr = callAsync<BasicVoid>(C, true); - EXPECT_TRUE(!!ResOrErr) << "Simple call over queue failed"; + { + // Make a call to Proc1. + auto EC = call<Proc1>(C, true); + EXPECT_FALSE(EC) << "Simple call over queue failed"; + } { // Expect a call to Proc1. - auto EC = expect<BasicVoid>(C, + auto EC = expect<Proc1>(C, [&](bool &B) { EXPECT_EQ(B, true) << "Bool serialization broken"; @@ -70,70 +71,30 @@ TEST_F(DummyRPC, TestAsyncBasicVoid) { }); EXPECT_FALSE(EC) << "Simple expect over queue failed"; } - - { - // Wait for the result. - auto EC = waitForResult(C, ResOrErr->second, handleNone); - EXPECT_FALSE(EC) << "Could not read result."; - } - - // Verify that the function returned ok. - auto Val = ResOrErr->first.get(); - EXPECT_TRUE(Val) << "Remote void function failed to execute."; } -TEST_F(DummyRPC, TestAsyncBasicInt) { +TEST_F(DummyRPC, TestSerialization) { std::queue<char> Queue; QueueChannel C(Queue); - // Make an async call. - auto ResOrErr = callAsync<BasicInt>(C, false); - EXPECT_TRUE(!!ResOrErr) << "Simple call over queue failed"; - - { - // Expect a call to Proc1. - auto EC = expect<BasicInt>(C, - [&](bool &B) { - EXPECT_EQ(B, false) - << "Bool serialization broken"; - return 42; - }); - EXPECT_FALSE(EC) << "Simple expect over queue failed"; - } - { - // Wait for the result. - auto EC = waitForResult(C, ResOrErr->second, handleNone); - EXPECT_FALSE(EC) << "Could not read result."; + // Make a call to Proc1. + std::vector<int> v({42, 7}); + auto EC = call<AllTheTypes>(C, + -101, + 250, + -10000, + 10000, + -1000000000, + 1000000000, + -10000000000, + 10000000000, + true, + "foo", + v); + EXPECT_FALSE(EC) << "Big (serialization test) call over queue failed"; } - // Verify that the function returned ok. - auto Val = ResOrErr->first.get(); - EXPECT_TRUE(!!Val) << "Remote int function failed to execute."; - EXPECT_EQ(*Val, 42) << "Remote int function return wrong value."; -} - -TEST_F(DummyRPC, TestSerialization) { - std::queue<char> Queue; - QueueChannel C(Queue); - - // Make a call to Proc1. - std::vector<int> v({42, 7}); - auto ResOrErr = callAsync<AllTheTypes>(C, - -101, - 250, - -10000, - 10000, - -1000000000, - 1000000000, - -10000000000, - 10000000000, - true, - "foo", - v); - EXPECT_TRUE(!!ResOrErr) - << "Big (serialization test) call over queue failed"; - { // Expect a call to Proc1. auto EC = expect<AllTheTypes>(C, @@ -175,14 +136,4 @@ TEST_F(DummyRPC, TestSerialization) { }); EXPECT_FALSE(EC) << "Big (serialization test) call over queue failed"; } - - { - // Wait for the result. - auto EC = waitForResult(C, ResOrErr->second, handleNone); - EXPECT_FALSE(EC) << "Could not read result."; - } - - // Verify that the function returned ok. - auto Val = ResOrErr->first.get(); - EXPECT_TRUE(Val) << "Remote void function failed to execute."; } |