diff --git a/tests/unit/pipe/test_callback_bcast_collection.extended.cc b/tests/unit/pipe/test_callback_bcast_collection.extended.cc index 729d1730a1..556f976204 100644 --- a/tests/unit/pipe/test_callback_bcast_collection.extended.cc +++ b/tests/unit/pipe/test_callback_bcast_collection.extended.cc @@ -89,11 +89,9 @@ struct TestCallbackBcastCollection : TestParallelHarness { struct TestCol : vt::Collection { TestCol() = default; - virtual ~TestCol() { - // fmt::print( - // "{}: destroying {}: val={}\n", - // theContext()->getNode(), this->getIndex(), val - // ); + virtual ~TestCol() = default; + + void check(DataMsg* msg) { if (other) { EXPECT_EQ(val, 29); } else { @@ -130,18 +128,26 @@ static void cb3(DataMsg* msg, TestCol* col) { TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_1) { auto const& this_node = theContext()->getNode(); - - if (this_node == 0) { - auto const& range = Index1D(32); - auto proxy = theCollection()->construct(range); - auto cb = theCB()->makeBcast(proxy); - auto nmsg = makeMessage(8,9,10); - cb.send(nmsg.get()); - - theTerm()->addAction([=]{ - proxy.destroy(); - }); - } + auto const& range = Index1D(32); + auto proxy = theCollection()->construct(range); + + runInEpochCollective([&]{ + if (this_node == 0) { + auto cb = theCB()->makeBcast(proxy); + auto nmsg = makeMessage(8,9,10); + cb.send(nmsg.get()); + } + }); + + runInEpochCollective([&]{ + if (this_node == 0) { + for (auto i = 0; i < 32; i++) { + auto cb = theCB()->makeBcast(proxy); + auto nmsg = makeMessage(); + cb.send(nmsg.get()); + } + } + }); } TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_2) { @@ -152,18 +158,25 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_2) { return; } - if (this_node == 0) { - auto const& range = Index1D(32); - auto proxy = theCollection()->construct(range); - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; - auto cb = theCB()->makeBcast(proxy); - auto msg = makeMessage(cb); - theMsg()->sendMsg(next, msg.get()); - - theTerm()->addAction([=]{ - proxy.destroy(); - }); - } + auto const& range = Index1D(32); + auto proxy = theCollection()->construct(range); + + runInEpochCollective([&]{ + if (this_node == 0) { + auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto cb = theCB()->makeBcast(proxy); + auto msg = makeMessage(cb); + theMsg()->sendMsg(next, msg.get()); + } + }); + + runInEpochCollective([&]{ + if (this_node == 0) { + auto cb = theCB()->makeBcast(proxy); + auto nmsg = makeMessage(); + cb.send(nmsg.get()); + } + }); } TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_3) { @@ -174,18 +187,25 @@ TEST_F(TestCallbackBcastCollection, test_callback_bcast_collection_3) { return; } - if (this_node == 0) { - auto const& range = Index1D(32); - auto proxy = theCollection()->construct(range); - auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; - auto cb = theCB()->makeBcast(proxy); - auto msg = makeMessage(cb); - theMsg()->sendMsg(next, msg.get()); - - theTerm()->addAction([=]{ - proxy.destroy(); - }); - } + auto const& range = Index1D(32); + auto proxy = theCollection()->construct(range); + + runInEpochCollective([&]{ + if (this_node == 0) { + auto next = this_node + 1 < num_nodes ? this_node + 1 : 0; + auto cb = theCB()->makeBcast(proxy); + auto msg = makeMessage(cb); + theMsg()->sendMsg(next, msg.get()); + } + }); + + runInEpochCollective([&]{ + if (this_node == 0) { + auto cb = theCB()->makeBcast(proxy); + auto nmsg = makeMessage(); + cb.send(nmsg.get()); + } + }); } }}} // end namespace vt::tests::unit