Skip to content

Commit

Permalink
[fzl] Clear free buffer list on re-init
Browse files Browse the repository at this point in the history
Test: libfzl-test
Change-Id: I63c6d9533e8823942441e9d66bee7653bf8647b0
  • Loading branch information
dgstevens authored and CQ bot account: [email protected] committed Sep 27, 2018
1 parent 0ce697a commit e71529b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions system/ulib/fzl/vmo-pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ zx_status_t VmoPool::Init(const zx::vmo* vmos, size_t num_vmos) {
return ZX_ERR_NO_MEMORY;
}
buffers_ = fbl::move(buffers);
free_buffers_.clear_unsafe();

zx_status_t status;
for (size_t i = 0; i < num_vmos; ++i) {
Expand Down
12 changes: 12 additions & 0 deletions system/utest/libfzl/vmo-pool-tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,17 @@ bool vmo_pool_reset_test() {
END_TEST;
}

bool vmo_pool_reinit() {
BEGIN_TEST;
VmoPoolTester tester;
ASSERT_TRUE(tester.Init());
ASSERT_TRUE(tester.CheckAccounting(false, 0));

ASSERT_TRUE(tester.Init());
ASSERT_TRUE(tester.CheckAccounting(false, 0));
END_TEST;
}

} // namespace

BEGIN_TEST_CASE(vmo_pool_tests)
Expand All @@ -292,4 +303,5 @@ RUN_NAMED_TEST("vmo_pool_release_wrong_buffer", vmo_pool_release_wrong_buffer_te
RUN_NAMED_TEST("vmo_pool_release_before_complete", vmo_pool_release_before_complete_test)
RUN_NAMED_TEST("vmo_pool_fill_and_empty_pool", vmo_pool_fill_and_empty_pool_test)
RUN_NAMED_TEST("vmo_pool_out_of_order", vmo_pool_out_of_order_test)
RUN_NAMED_TEST("vmo_pool_reinit", vmo_pool_reinit)
END_TEST_CASE(vmo_pool_tests)

0 comments on commit e71529b

Please sign in to comment.