Fix catching exception from `boost::filesystem` in `BuildServiceCleanup` and adapt tests
This commit is contained in:
parent
87fd9bb4b1
commit
5af8de2468
|
@ -495,7 +495,7 @@ void BuildServiceCleanup::run()
|
|||
m_concreteCacheDirs.emplace_back(entry.path().filename().string(), std::move(canonical));
|
||||
}
|
||||
}
|
||||
} catch (const boost::filesystem::filesystem_error &e) {
|
||||
} catch (const std::exception &e) {
|
||||
m_messages.errors.emplace_back(argsToString("unable to locate package cache directories: ", e.what()));
|
||||
}
|
||||
m_concreteCacheDirsIterator = m_concreteCacheDirs.begin();
|
||||
|
|
|
@ -947,5 +947,10 @@ void BuildActionsTests::testBuildServiceCleanup()
|
|||
m_buildAction = std::make_shared<BuildAction>(0, &m_setup);
|
||||
m_buildAction->type = BuildActionType::BuildServiceCleanup;
|
||||
runBuildAction("buildservice cleanup");
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("success", BuildActionResult::Success, m_buildAction->result);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("failure", BuildActionResult::Failure, m_buildAction->result);
|
||||
const auto &messages = std::get<BuildActionMessages>(m_buildAction->resultData);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("one error", 1_st, messages.errors.size());
|
||||
TESTUTILS_ASSERT_LIKE("expected error", "unable to locate package cache directories:.*No such file or directory.*", messages.errors.front());
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("no warnings", std::vector<std::string>(), messages.warnings);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE("no notes", std::vector<std::string>(), messages.notes);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue