Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/umpire/ResourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1093,9 +1093,8 @@ int ResourceManager::getNextId() noexcept
std::string ResourceManager::getAllocatorInformation() const noexcept
{
std::ostringstream info;

for (auto& it : m_allocators_by_name) {
info << *it.second << " ";
for (const auto& name : resource::MemoryResourceRegistry::getInstance().getResourceNames()) {
Comment thread
kab163 marked this conversation as resolved.
info << name << ' ';
}

return info.str();
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/resource_manager_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ TEST(ResourceManager, getAllocatorByName)
ASSERT_THROW(rm.getAllocator("BANANA"), umpire::runtime_error);
}

TEST(ResourceManager, getAllocatorByNameErrorListsAvailableAllocators)
{
auto& rm = umpire::ResourceManager::getInstance();

try {
UMPIRE_USE_VAR(rm.getAllocator("BANANA"));
FAIL() << "Expected getAllocator to throw";
} catch (const umpire::runtime_error& e) {
const std::string message{e.what()};
EXPECT_NE(message.find("Available allocators:"), std::string::npos);
EXPECT_NE(message.find("HOST"), std::string::npos);
}
}

TEST(ResourceManager, getAllocatorById)
{
auto& rm = umpire::ResourceManager::getInstance();
Expand Down
Loading