diff --git a/test/cxx/MessagePassingTest.cpp b/test/cxx/MessagePassingTest.cpp index 66cc0ca5f0..0f8ea7e922 100644 --- a/test/cxx/MessagePassingTest.cpp +++ b/test/cxx/MessagePassingTest.cpp @@ -15,10 +15,16 @@ namespace tut { } void sendMessagesLater() { + std::cout << "sender: sleep 1" << std::endl; syscalls::usleep(20000); + std::cout << "sender: sending hi" << std::endl; box->send("hi"); + std::cout << "sender: sent hi" << std::endl; + std::cout << "sender: sleep 2" << std::endl; syscalls::usleep(20000); + std::cout << "sender: sending ho" << std::endl; box->send("ho"); + std::cout << "sender: sent ho" << std::endl; } }; @@ -70,14 +76,17 @@ namespace tut { TempThread thr(boost::bind(&MessagePassingTest::sendMessagesLater, this)); unsigned long long timeoutUSec = 200000; Timer<> timer; - std::cerr << "Test 1" << std::endl; - ensure_equals("(1)", box->recv("ho", &timeoutUSec)->name, "ho"); + auto m = box->recv("ho", &timeoutUSec); + std::cout << "Done receiving" << std::endl; + if (m == nullptr) { + std::cout << "Timeout" << std::endl; + abort(); + } + ensure_equals("(1)", m->name, "ho"); ensure("(2)", timer.elapsed() >= 39); ensure("(3)", timer.elapsed() <= 250); ensure_equals("(4)", box->size(), 1u); - std::cerr << "Test 2" << std::endl; ensure_equals("(5)", box->recv("hi")->name, "hi"); - std::cerr << "Test 3" << std::endl; ensure_equals("(6)", box->size(), 0u); ensure("(7)", timeoutUSec >= 100000); }