From 1ff1da8decf79116ea7122d3cf66180351c4a16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= <cezary.skrzynski@ng-analytics.com> Date: Tue, 11 Aug 2020 16:21:35 +0200 Subject: [PATCH] #955 remove addAction usage from test_callback_bcast.cc --- tests/unit/pipe/test_callback_bcast.cc | 88 +++++++++++--------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/tests/unit/pipe/test_callback_bcast.cc b/tests/unit/pipe/test_callback_bcast.cc index 30db44b4c8..efae718880 100644 --- a/tests/unit/pipe/test_callback_bcast.cc +++ b/tests/unit/pipe/test_callback_bcast.cc @@ -113,42 +113,36 @@ struct CallbackFunctorEmpty { TEST_F(TestCallbackBcast, test_callback_bcast_1) { called = 0; - theCollective()->barrier(); - - auto cb = theCB()->makeBcast<DataMsg,callbackFn>(); - auto nmsg = makeMessage<DataMsg>(1,2,3); - cb.send(nmsg.get()); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 100 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto cb = theCB()->makeBcast<DataMsg,callbackFn>(); + auto nmsg = makeMessage<DataMsg>(1,2,3); + cb.send(nmsg.get()); }); + + EXPECT_EQ(called, 100 * theContext()->getNumNodes()); } TEST_F(TestCallbackBcast, test_callback_bcast_2) { called = 0; - theCollective()->barrier(); - - auto cb = theCB()->makeBcast<CallbackFunctor>(); - auto nmsg = makeMessage<DataMsg>(1,2,3); - cb.send(nmsg.get()); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 200 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto cb = theCB()->makeBcast<CallbackFunctor>(); + auto nmsg = makeMessage<DataMsg>(1,2,3); + cb.send(nmsg.get()); }); + + EXPECT_EQ(called, 200 * theContext()->getNumNodes()); } TEST_F(TestCallbackBcast, test_callback_bcast_3) { called = 0; - theCollective()->barrier(); - - auto cb = theCB()->makeBcast<CallbackFunctorEmpty>(); - cb.send(); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 300 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto cb = theCB()->makeBcast<CallbackFunctorEmpty>(); + cb.send(); }); + + EXPECT_EQ(called, 300 * theContext()->getNumNodes()); } TEST_F(TestCallbackBcast, test_callback_bcast_remote_1) { @@ -157,16 +151,14 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_1) { called = 0; - theCollective()->barrier(); - - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; - auto cb = theCB()->makeBcast<DataMsg,callbackFn>(); - auto msg = makeMessage<CallbackDataMsg>(cb); - theMsg()->sendMsg<CallbackDataMsg, testHandler>(next, msg.get()); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 100 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto cb = theCB()->makeBcast<DataMsg,callbackFn>(); + auto msg = makeMessage<CallbackDataMsg>(cb); + theMsg()->sendMsg<CallbackDataMsg, testHandler>(next, msg.get()); }); + + EXPECT_EQ(called, 100 * theContext()->getNumNodes()); } TEST_F(TestCallbackBcast, test_callback_bcast_remote_2) { @@ -175,16 +167,14 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_2) { called = 0; - theCollective()->barrier(); - - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; - auto cb = theCB()->makeBcast<CallbackFunctor>(); - auto msg = makeMessage<CallbackDataMsg>(cb); - theMsg()->sendMsg<CallbackDataMsg, testHandler>(next, msg.get()); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 200 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto cb = theCB()->makeBcast<CallbackFunctor>(); + auto msg = makeMessage<CallbackDataMsg>(cb); + theMsg()->sendMsg<CallbackDataMsg, testHandler>(next, msg.get()); }); + + EXPECT_EQ(called, 200 * theContext()->getNumNodes()); } TEST_F(TestCallbackBcast, test_callback_bcast_remote_3) { @@ -193,16 +183,14 @@ TEST_F(TestCallbackBcast, test_callback_bcast_remote_3) { called = 0; - theCollective()->barrier(); - - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; - auto cb = theCB()->makeBcast<CallbackFunctorEmpty>(); - auto msg = makeMessage<CallbackMsg>(cb); - theMsg()->sendMsg<CallbackMsg, testHandlerEmpty>(next, msg.get()); - - theTerm()->addAction([=]{ - EXPECT_EQ(called, 300 * theContext()->getNumNodes()); + runInEpochCollective([&]{ + auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto cb = theCB()->makeBcast<CallbackFunctorEmpty>(); + auto msg = makeMessage<CallbackMsg>(cb); + theMsg()->sendMsg<CallbackMsg, testHandlerEmpty>(next, msg.get()); }); + + EXPECT_EQ(called, 300 * theContext()->getNumNodes()); }