Commit be7f2dfc authored by Dominik Charousset's avatar Dominik Charousset

Improve output of broker-related unit tests

parent 199aa7f2
...@@ -155,9 +155,8 @@ void run_server(bool spawn_client, const char* bin_path) { ...@@ -155,9 +155,8 @@ void run_server(bool spawn_client, const char* bin_path) {
done = true; done = true;
} }
CAF_CHECKPOINT(); CAF_CHECKPOINT();
if (!spawn_client) { cout << "server is running on port " << port << endl;
cout << "server is running on port " << port << endl; if (spawn_client) {
} else {
ostringstream oss; ostringstream oss;
oss << bin_path << " -c " << port << to_dev_null; oss << bin_path << " -c " << port << to_dev_null;
thread child{[&oss] { thread child{[&oss] {
......
...@@ -346,14 +346,17 @@ void test_remote_actor(std::string app_path, bool run_remote_actor) { ...@@ -346,14 +346,17 @@ void test_remote_actor(std::string app_path, bool run_remote_actor) {
CAF_LOGF_INFO("running on port " << port); CAF_LOGF_INFO("running on port " << port);
// publish local groups as well // publish local groups as well
auto gport = at_some_port(port + 1, publish_groups); auto gport = at_some_port(port + 1, publish_groups);
// check whether accessing local actors via io::remote_actors works correctly,
// i.e., does not return a proxy instance
auto serv2 = io::remote_actor("127.0.0.1", port); auto serv2 = io::remote_actor("127.0.0.1", port);
CAF_CHECK(serv2 != invalid_actor && !serv2->is_remote());
CAF_CHECK(serv == serv2); CAF_CHECK(serv == serv2);
CAF_TEST(test_remote_actor); CAF_TEST(test_remote_actor);
thread child; thread child;
ostringstream oss; ostringstream oss;
oss << app_path << " -c " << port << " " << port0 << " " << gport;
if (run_remote_actor) { if (run_remote_actor) {
oss << app_path << " -c " << port << " " << port0 oss << to_dev_null;
<< " " << gport << to_dev_null;
// execute client_part() in a separate process, // execute client_part() in a separate process,
// connected via localhost socket // connected via localhost socket
child = thread([&oss]() { child = thread([&oss]() {
...@@ -365,7 +368,7 @@ void test_remote_actor(std::string app_path, bool run_remote_actor) { ...@@ -365,7 +368,7 @@ void test_remote_actor(std::string app_path, bool run_remote_actor) {
} }
}); });
} else { } else {
CAF_PRINT("actor published at port " << port); CAF_PRINT("please run client: " << oss.str());
} }
CAF_CHECKPOINT(); CAF_CHECKPOINT();
self->receive( self->receive(
...@@ -414,7 +417,10 @@ int main(int argc, char** argv) { ...@@ -414,7 +417,10 @@ int main(int argc, char** argv) {
CAF_PRINT("don't run remote actor (server mode)"); CAF_PRINT("don't run remote actor (server mode)");
test_remote_actor(argv[0], false); test_remote_actor(argv[0], false);
}, },
on() >> [&] { test_remote_actor(argv[0], true); }, others() >> [&] { on() >> [&] {
test_remote_actor(argv[0], true);
},
others() >> [&] {
CAF_PRINTERR("usage: " << argv[0] << " [-s PORT|-c PORT1 PORT2 GROUP_PORT]"); CAF_PRINTERR("usage: " << argv[0] << " [-s PORT|-c PORT1 PORT2 GROUP_PORT]");
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment