Skip to content

Commit

Permalink
#955 remove addAction usage from test_callback_bcast.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
cz4rs committed Aug 11, 2020
1 parent c6e622d commit 1ff1da8
Showing 1 changed file with 38 additions and 50 deletions.
88 changes: 38 additions & 50 deletions tests/unit/pipe/test_callback_bcast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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());
}


Expand Down

0 comments on commit 1ff1da8

Please sign in to comment.