mirror of https://gitee.com/bigwinds/arangodb
Fixed several ASan errors in the catch tests (#8624)
This commit is contained in:
parent
9ab9cc7857
commit
1ac2c314de
|
@ -48,7 +48,7 @@ class AqlItemBlockManager {
|
|||
TEST_VIRTUAL AqlItemBlock* requestBlock(size_t nrItems, RegisterId nrRegs);
|
||||
|
||||
/// @brief return a block to the manager
|
||||
void returnBlock(AqlItemBlock*& block) noexcept;
|
||||
TEST_VIRTUAL void returnBlock(AqlItemBlock*& block) noexcept;
|
||||
|
||||
/// @brief return a block to the manager
|
||||
void returnBlock(std::unique_ptr<AqlItemBlock> block) noexcept {
|
||||
|
|
|
@ -85,6 +85,8 @@ SCENARIO("ExecutionBlockImpl", "[AQL][EXECUTOR][EXECBLOCKIMPL]") {
|
|||
|
||||
fakeit::When(Method(mockEngine, itemBlockManager)).AlwaysReturn(blockManager);
|
||||
fakeit::When(Method(mockEngine, getQuery)).AlwaysReturn(&query);
|
||||
fakeit::When(OverloadedMethod(mockBlockManager, returnBlock, void(AqlItemBlock*&)))
|
||||
.AlwaysDo([&](AqlItemBlock*& block) -> void { delete block; block = nullptr; });
|
||||
fakeit::When(ConstOverloadedMethod(mockQuery, queryOptions, QueryOptions const&()))
|
||||
.AlwaysDo([&]() -> QueryOptions const& { return lqueryOptions; });
|
||||
fakeit::When(OverloadedMethod(mockQuery, queryOptions, QueryOptions & ()))
|
||||
|
|
|
@ -56,7 +56,6 @@ namespace aql {
|
|||
SCENARIO("SingleRowFetcher", "[AQL][EXECUTOR][FETCHER]") {
|
||||
ResourceMonitor monitor;
|
||||
ExecutionState state;
|
||||
InputAqlItemRow row{CreateInvalidInputRowHint{}};
|
||||
|
||||
/*
|
||||
* A hopefully temporary hack. Use TEMPLATE_TEST_CASE instead when it's
|
||||
|
@ -82,6 +81,7 @@ SCENARIO("SingleRowFetcher", "[AQL][EXECUTOR][FETCHER]") {
|
|||
GIVEN(std::string{"there are no blocks upstream, passBlocksThrough="} + std::string{passBlocksThrough}) {
|
||||
VPackBuilder input;
|
||||
BlockFetcherMock<passBlocksThrough> blockFetcherMock{monitor, 0};
|
||||
InputAqlItemRow row{CreateInvalidInputRowHint{}};
|
||||
|
||||
WHEN("the producer does not wait") {
|
||||
blockFetcherMock.shouldReturn(ExecutionState::DONE, nullptr);
|
||||
|
@ -132,6 +132,7 @@ GIVEN(std::string{
|
|||
std::string{passBlocksThrough}) {
|
||||
VPackBuilder input;
|
||||
BlockFetcherMock<passBlocksThrough> blockFetcherMock{monitor, 1};
|
||||
InputAqlItemRow row{CreateInvalidInputRowHint{}};
|
||||
|
||||
std::unique_ptr<AqlItemBlock> block = buildBlock<1>(&monitor, {{42}});
|
||||
|
||||
|
@ -251,6 +252,7 @@ GIVEN(std::string{
|
|||
GIVEN(std::string{"there are multiple blocks upstream, passBlocksThrough="} +
|
||||
std::string{passBlocksThrough}) {
|
||||
BlockFetcherMock<passBlocksThrough> blockFetcherMock{monitor, 1};
|
||||
InputAqlItemRow row{CreateInvalidInputRowHint{}};
|
||||
|
||||
// three 1-column matrices with 3, 2 and 1 rows, respectively
|
||||
std::unique_ptr<AqlItemBlock> block1 = buildBlock<1>(&monitor, {{{1}}, {{2}}, {{3}}}),
|
||||
|
|
|
@ -317,7 +317,8 @@ TEST_CASE("ConstantWeightShortestPathFinder", "[graph]") {
|
|||
if (result.length() != vertices.size()) return false;
|
||||
|
||||
for (size_t i = 0; i < result.length(); i++) {
|
||||
auto vert = result.vertexToAqlValue(spo->cache(), i);
|
||||
AqlValue vert = result.vertexToAqlValue(spo->cache(), i);
|
||||
AqlValueGuard guard{vert, true};
|
||||
if (!vert.slice().get(StaticStrings::KeyString).isEqualString(vertices.at(i))) {
|
||||
LOG_DEVEL << "expected vertex " << vertices.at(i) << " but found "
|
||||
<< vert.slice().get(StaticStrings::KeyString).toString();
|
||||
|
@ -328,7 +329,8 @@ TEST_CASE("ConstantWeightShortestPathFinder", "[graph]") {
|
|||
// First edge is by convention null
|
||||
CHECK((result.edgeToAqlValue(spo->cache(), 0).isNull(true)));
|
||||
for (size_t i = 1; i < result.length(); i++) {
|
||||
auto edge = result.edgeToAqlValue(spo->cache(), i);
|
||||
AqlValue edge = result.edgeToAqlValue(spo->cache(), i);
|
||||
AqlValueGuard guard{edge, true};
|
||||
if (!edge.slice().get(StaticStrings::FromString).isEqualString(edges.at(i).first) ||
|
||||
!edge.slice().get(StaticStrings::ToString).isEqualString(edges.at(i).second)) {
|
||||
LOG_DEVEL << "expected edge " << edges.at(i).first << " -> "
|
||||
|
|
Loading…
Reference in New Issue