Commit ad2195dd authored by Dominik Charousset's avatar Dominik Charousset

Remove logging from unit tests

parent 627d6552
...@@ -32,7 +32,7 @@ behavior ping_behavior(local_actor* self, size_t num_pings) { ...@@ -32,7 +32,7 @@ behavior ping_behavior(local_actor* self, size_t num_pings) {
return make_message(ping_atom::value, value); return make_message(ping_atom::value, value);
}, },
others >> [=] { others >> [=] {
CAF_LOGF_ERROR("unexpected; " << to_string(self->current_message())); CAF_PRINTERR("unexpected; " << to_string(self->current_message()));
self->quit(exit_reason::user_shutdown); self->quit(exit_reason::user_shutdown);
} }
}; };
...@@ -45,7 +45,7 @@ behavior pong_behavior(local_actor* self) { ...@@ -45,7 +45,7 @@ behavior pong_behavior(local_actor* self) {
return make_message(pong_atom::value, value + 1); return make_message(pong_atom::value, value + 1);
}, },
others >> [=] { others >> [=] {
CAF_LOGF_ERROR("unexpected; " << to_string(self->current_sender())); CAF_PRINTERR("unexpected; " << to_string(self->current_sender()));
self->quit(exit_reason::user_shutdown); self->quit(exit_reason::user_shutdown);
} }
}; };
...@@ -56,19 +56,16 @@ behavior pong_behavior(local_actor* self) { ...@@ -56,19 +56,16 @@ behavior pong_behavior(local_actor* self) {
size_t pongs() { return s_pongs; } size_t pongs() { return s_pongs; }
void ping(blocking_actor* self, size_t num_pings) { void ping(blocking_actor* self, size_t num_pings) {
CAF_LOGF_TRACE("num_pings = " << num_pings);
s_pongs = 0; s_pongs = 0;
self->receive_loop(ping_behavior(self, num_pings)); self->receive_loop(ping_behavior(self, num_pings));
} }
void event_based_ping(event_based_actor* self, size_t num_pings) { void event_based_ping(event_based_actor* self, size_t num_pings) {
CAF_LOGF_TRACE("num_pings = " << num_pings);
s_pongs = 0; s_pongs = 0;
self->become(ping_behavior(self, num_pings)); self->become(ping_behavior(self, num_pings));
} }
void pong(blocking_actor* self, actor ping_actor) { void pong(blocking_actor* self, actor ping_actor) {
CAF_LOGF_TRACE("ping_actor = " << to_string(ping_actor));
self->send(ping_actor, pong_atom::value, 0); // kickoff self->send(ping_actor, pong_atom::value, 0); // kickoff
self->receive_loop(pong_behavior(self)); self->receive_loop(pong_behavior(self));
} }
...@@ -141,8 +141,7 @@ void caf_cancel_watchdog(); ...@@ -141,8 +141,7 @@ void caf_cancel_watchdog();
#define CAF_TEST(testname) \ #define CAF_TEST(testname) \
caf_launch_watchdog(); \ caf_launch_watchdog(); \
set_default_test_settings(); \ set_default_test_settings();
CAF_LOGF_INFO("run unit test " << #testname)
#define CAF_TEST_RESULT() \ #define CAF_TEST_RESULT() \
caf_cancel_watchdog(), ((caf_error_count() == 0) ? 0 : -1) caf_cancel_watchdog(), ((caf_error_count() == 0) ? 0 : -1)
......
...@@ -89,7 +89,6 @@ void peer_fun(broker* self, connection_handle hdl, const actor& buddy) { ...@@ -89,7 +89,6 @@ void peer_fun(broker* self, connection_handle hdl, const actor& buddy) {
self->configure_read( self->configure_read(
hdl, receive_policy::exactly(sizeof(atom_value) + sizeof(int))); hdl, receive_policy::exactly(sizeof(atom_value) + sizeof(int)));
auto write = [=](atom_value type, int value) { auto write = [=](atom_value type, int value) {
CAF_LOGF_DEBUG("write: " << value);
auto& buf = self->wr_buf(hdl); auto& buf = self->wr_buf(hdl);
auto first = reinterpret_cast<char*>(&type); auto first = reinterpret_cast<char*>(&type);
buf.insert(buf.end(), first, first + sizeof(atom_value)); buf.insert(buf.end(), first, first + sizeof(atom_value));
......
...@@ -35,8 +35,6 @@ void reflector(event_based_actor* self) { ...@@ -35,8 +35,6 @@ void reflector(event_based_actor* self) {
} }
void spawn5_server_impl(event_based_actor* self, actor client, group grp) { void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
CAF_LOGF_TRACE(CAF_TARG(client, to_string)
<< ", " << CAF_TARG(grp, to_string));
CAF_CHECK(grp != invalid_group); CAF_CHECK(grp != invalid_group);
self->spawn_in_group(grp, reflector); self->spawn_in_group(grp, reflector);
self->spawn_in_group(grp, reflector); self->spawn_in_group(grp, reflector);
...@@ -76,8 +74,7 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) { ...@@ -76,8 +74,7 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
self->quit(exit_reason::user_defined); self->quit(exit_reason::user_defined);
}, },
after(chrono::seconds(2)) >> [=] { after(chrono::seconds(2)) >> [=] {
CAF_UNEXPECTED_TOUT(); CAF_PRINTERR("did only receive " << *downs << " down messages");
CAF_LOGF_ERROR("did only receive " << *downs << " down messages");
self->quit(exit_reason::user_defined); self->quit(exit_reason::user_defined);
} }
); );
...@@ -85,8 +82,6 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) { ...@@ -85,8 +82,6 @@ void spawn5_server_impl(event_based_actor* self, actor client, group grp) {
}, },
after(std::chrono::seconds(2)) >> [=] { after(std::chrono::seconds(2)) >> [=] {
CAF_UNEXPECTED_TOUT(); CAF_UNEXPECTED_TOUT();
CAF_LOGF_ERROR("did only receive " << *replies
<< " responses to 'Hello reflectors!'");
self->quit(exit_reason::user_defined); self->quit(exit_reason::user_defined);
} }
); );
...@@ -199,7 +194,6 @@ class client : public event_based_actor { ...@@ -199,7 +194,6 @@ class client : public event_based_actor {
if (i == 100) if (i == 100)
test_group_comm(); test_group_comm();
else { else {
CAF_LOG_DEBUG("send message nr. " << (i + 1));
sync_send(m_server, atom("foo"), atom("bar"), i) sync_send(m_server, atom("foo"), atom("bar"), i)
.then(on(atom("foo"), atom("bar"), i) >> [=] { .then(on(atom("foo"), atom("bar"), i) >> [=] {
send_foobars(i + 1); send_foobars(i + 1);
...@@ -348,7 +342,6 @@ void test_remote_actor(const char* app_path, bool run_remote_actor) { ...@@ -348,7 +342,6 @@ void test_remote_actor(const char* app_path, bool run_remote_actor) {
auto port2 = io::publish(serv, 0, "127.0.0.1"); auto port2 = io::publish(serv, 0, "127.0.0.1");
CAF_CHECK(port2 > 0); CAF_CHECK(port2 > 0);
CAF_PRINT("second publish succeeded on port " << port2); CAF_PRINT("second publish succeeded on port " << port2);
CAF_LOGF_INFO("running on port " << port2);
// publish local groups as well // publish local groups as well
auto gport = io::publish_local_groups(0); auto gport = io::publish_local_groups(0);
CAF_CHECK(gport > 0); CAF_CHECK(gport > 0);
...@@ -396,7 +389,6 @@ int main(int argc, char** argv) { ...@@ -396,7 +389,6 @@ int main(int argc, char** argv) {
message_builder{argv + 1, argv + argc}.apply({ message_builder{argv + 1, argv + argc}.apply({
on("-c", spro<uint16_t>, spro<uint16_t>, spro<uint16_t>) on("-c", spro<uint16_t>, spro<uint16_t>, spro<uint16_t>)
>> [](uint16_t p1, uint16_t p2, uint16_t gport) { >> [](uint16_t p1, uint16_t p2, uint16_t gport) {
CAF_LOGF_INFO("run in client mode");
scoped_actor self; scoped_actor self;
auto serv = io::remote_actor("localhost", p1); auto serv = io::remote_actor("localhost", p1);
auto serv2 = io::remote_actor("localhost", p2); auto serv2 = io::remote_actor("localhost", p2);
......
...@@ -84,7 +84,6 @@ actor spawn_event_testee2(actor parent) { ...@@ -84,7 +84,6 @@ actor spawn_event_testee2(actor parent) {
dec_actor_instances(); dec_actor_instances();
} }
behavior wait4timeout(int remaining) { behavior wait4timeout(int remaining) {
CAF_LOG_TRACE(CAF_ARG(remaining));
return { return {
after(chrono::milliseconds(1)) >> [=] { after(chrono::milliseconds(1)) >> [=] {
CAF_PRINT(CAF_ARG(remaining)); CAF_PRINT(CAF_ARG(remaining));
...@@ -218,17 +217,14 @@ testee1::~testee1() { ...@@ -218,17 +217,14 @@ testee1::~testee1() {
} }
behavior testee1::make_behavior() { behavior testee1::make_behavior() {
CAF_LOGF_TRACE("");
return { return {
after(chrono::milliseconds(10)) >> [=] { after(chrono::milliseconds(10)) >> [=] {
CAF_LOGF_TRACE("");
unbecome(); unbecome();
} }
}; };
} }
string behavior_test(scoped_actor& self, actor et) { string behavior_test(scoped_actor& self, actor et) {
CAF_LOGF_TRACE(CAF_TARG(et, to_string));
string result; string result;
self->send(et, 1); self->send(et, 1);
self->send(et, 2); self->send(et, 2);
...@@ -245,7 +241,7 @@ string behavior_test(scoped_actor& self, actor et) { ...@@ -245,7 +241,7 @@ string behavior_test(scoped_actor& self, actor et) {
result = str; result = str;
}, },
after(chrono::minutes(1)) >> [&]() { after(chrono::minutes(1)) >> [&]() {
CAF_LOGF_ERROR("actor does not reply"); CAF_PRINTERR("actor does not reply");
throw runtime_error("actor does not reply"); throw runtime_error("actor does not reply");
} }
); );
......
...@@ -214,7 +214,6 @@ void test_sync_send() { ...@@ -214,7 +214,6 @@ void test_sync_send() {
CAF_FAILURE("received: " << to_string(self->current_message())); CAF_FAILURE("received: " << to_string(self->current_message()));
}); });
self->spawn<monitored + blocking_api>([](blocking_actor* s) { self->spawn<monitored + blocking_api>([](blocking_actor* s) {
CAF_LOGC_TRACE("NONE", "main$sync_failure_test", "id = " << s->id());
int invocations = 0; int invocations = 0;
auto foi = s->spawn<float_or_int, linked>(); auto foi = s->spawn<float_or_int, linked>();
s->send(foi, i_atom::value); s->send(foi, i_atom::value);
......
...@@ -73,7 +73,7 @@ uint16_t run_server() { ...@@ -73,7 +73,7 @@ uint16_t run_server() {
} }
int main(int argc, char** argv) { int main(int argc, char** argv) {
CAF_TEST(test_typed_remote_actor) CAF_TEST(test_typed_remote_actor);
announce<ping>("ping", &ping::value); announce<ping>("ping", &ping::value);
announce<pong>("pong", &pong::value); announce<pong>("pong", &pong::value);
message_builder{argv + 1, argv + argc}.apply({ message_builder{argv + 1, argv + argc}.apply({
......
...@@ -187,11 +187,15 @@ void test_event_testee() { ...@@ -187,11 +187,15 @@ void test_event_testee() {
// we expect three 42s // we expect three 42s
int i = 0; int i = 0;
self->receive_for(i, 3)([](int value) { CAF_CHECK_EQUAL(value, 42); }); self->receive_for(i, 3)([](int value) { CAF_CHECK_EQUAL(value, 42); });
self->receive([&](const string& str) { result = str; }, self->receive(
after(chrono::minutes(1)) >> [&]() { [&](const string& str) {
CAF_LOGF_ERROR("event_testee does not reply"); result = str;
throw runtime_error("event_testee does not reply"); },
}); after(chrono::minutes(1)) >> [&] {
CAF_PRINTERR("event_testee does not reply");
throw runtime_error("event_testee does not reply");
}
);
self->send_exit(et, exit_reason::user_shutdown); self->send_exit(et, exit_reason::user_shutdown);
self->await_all_other_actors_done(); self->await_all_other_actors_done();
CAF_CHECK_EQUAL(result, "wait4int"); CAF_CHECK_EQUAL(result, "wait4int");
......
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