From f7eddfa6cd72af3f580b0599f7e737c764a52e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezary=20Skrzy=C5=84ski?= Date: Tue, 26 Jan 2021 09:59:25 +0100 Subject: [PATCH] #1217: tests: add separate testcase for lb keeping last elements --- src/vt/vrt/collection/manager.impl.h | 2 +- tests/unit/collection/test_lb.extended.cc | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/vt/vrt/collection/manager.impl.h b/src/vt/vrt/collection/manager.impl.h index c05f3f55a0..74cb18f406 100644 --- a/src/vt/vrt/collection/manager.impl.h +++ b/src/vt/vrt/collection/manager.impl.h @@ -2836,7 +2836,7 @@ MigrateStatus CollectionManager::migrateOut( if (elm_holder->numElements() == 1 and theConfig()->vt_lb_keep_last_elm) { vt_debug_print( vrt_coll, node, - "migrateOut: do not migrate last element\n", + "migrateOut: do not migrate last element\n" ); return MigrateStatus::ElementNotLocal; } diff --git a/tests/unit/collection/test_lb.extended.cc b/tests/unit/collection/test_lb.extended.cc index 4c2d41efd8..e7c7c88ed3 100644 --- a/tests/unit/collection/test_lb.extended.cc +++ b/tests/unit/collection/test_lb.extended.cc @@ -80,14 +80,15 @@ void colHandler(MyMsg*, MyCol* col) { } } -struct TestLoadBalancer : TestParallelHarnessParam { }; +struct TestLoadBalancer : TestParallelHarnessParam { + void runTest(); +}; -TEST_P(TestLoadBalancer, test_load_balancer_1) { +void TestLoadBalancer::runTest() { auto lb_name = GetParam(); vt::theConfig()->vt_lb = true; vt::theConfig()->vt_lb_name = lb_name; - vt::theConfig()->vt_lb_keep_last_elm = true; if (vt::theContext()->getNode() == 0) { fmt::print("Testing lb {}\n", lb_name); } @@ -112,6 +113,16 @@ TEST_P(TestLoadBalancer, test_load_balancer_1) { // Go to the next phase. vt::thePhase()->nextPhaseCollective(); } + return; +} + +TEST_P(TestLoadBalancer, test_load_balancer_1) { + runTest(); +} + +TEST_P(TestLoadBalancer, test_load_balancer_keep_last_elm) { + vt::theConfig()->vt_lb_keep_last_elm = true; + runTest(); } auto balancers = ::testing::Values(