Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a leak in test_array_list.cpp #149

Merged
merged 3 commits into from
Apr 16, 2019

Conversation

thomas-moulard
Copy link
Contributor

Before this change, test_array_list ASAN was reporting
280 bytes leaked in 4 allocations. After this patch
is applied, test_array_list does not emit any ASAN related
warning anymore.

Fixes #148

Signed-off-by: Thomas Moulard tmoulard@amazon.com

Before this change, test_array_list ASAN was reporting
280 bytes leaked in 4 allocations. After this patch
is applied, test_array_list does not emit any ASAN related
warning anymore.

Fixes ros2#148

Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
@tfoote tfoote added the in progress Actively being worked on (Kanban column) label Apr 10, 2019
@thomas-moulard
Copy link
Contributor Author

Before:

Running main() from ../../../install-asan/gtest_vendor/src/gtest_vendor/src/gtest_main.cc
[==========] Running 31 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 19 tests from ArrayListTest
[ RUN      ] ArrayListTest.init_list_null_fails
[       OK ] ArrayListTest.init_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.init_initial_capacity_zero_fails
[       OK ] ArrayListTest.init_initial_capacity_zero_fails (0 ms)
[ RUN      ] ArrayListTest.init_data_size_zero_fails
[       OK ] ArrayListTest.init_data_size_zero_fails (0 ms)
[ RUN      ] ArrayListTest.init_null_allocator_fails
[       OK ] ArrayListTest.init_null_allocator_fails (0 ms)
[ RUN      ] ArrayListTest.init_success
[       OK ] ArrayListTest.init_success (0 ms)
[ RUN      ] ArrayListTest.fini_list_null
[       OK ] ArrayListTest.fini_list_null (0 ms)
[ RUN      ] ArrayListTest.fini_list_not_initialized
[       OK ] ArrayListTest.fini_list_not_initialized (0 ms)
[ RUN      ] ArrayListTest.fini_success
[       OK ] ArrayListTest.fini_success (0 ms)
[ RUN      ] ArrayListTest.add_list_null_fails
[       OK ] ArrayListTest.add_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.add_list_not_initialized_fails
[       OK ] ArrayListTest.add_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.set_list_null_fails
[       OK ] ArrayListTest.set_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.set_list_not_initialized_fails
[       OK ] ArrayListTest.set_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.remove_list_null_fails
[       OK ] ArrayListTest.remove_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.remove_list_not_initialized_fails
[       OK ] ArrayListTest.remove_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.get_list_null_fails
[       OK ] ArrayListTest.get_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.get_list_not_initialized_fails
[       OK ] ArrayListTest.get_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.get_size_list_null_fails
[       OK ] ArrayListTest.get_size_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.get_size_list_not_initialized_fails
[       OK ] ArrayListTest.get_size_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.add_grow_capacity
[       OK ] ArrayListTest.add_grow_capacity (0 ms)
[----------] 19 tests from ArrayListTest (0 ms total)

[----------] 12 tests from ArrayListPreInitTest
[ RUN      ] ArrayListPreInitTest.add_data_null_fails
[       OK ] ArrayListPreInitTest.add_data_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.add_success
[       OK ] ArrayListPreInitTest.add_success (0 ms)
[ RUN      ] ArrayListPreInitTest.set_data_null_fails
[       OK ] ArrayListPreInitTest.set_data_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.set_data_index_oob_fails
[       OK ] ArrayListPreInitTest.set_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.set_success_changes_data
[       OK ] ArrayListPreInitTest.set_success_changes_data (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_data_index_oob_fails
[       OK ] ArrayListPreInitTest.remove_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_success_removes_from_list
[       OK ] ArrayListPreInitTest.remove_success_removes_from_list (0 ms)
[ RUN      ] ArrayListPreInitTest.get_data_index_oob_fails
[       OK ] ArrayListPreInitTest.get_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.get_data_success_returns_data
[       OK ] ArrayListPreInitTest.get_data_success_returns_data (0 ms)
[ RUN      ] ArrayListPreInitTest.get_size_size_null_fails
[       OK ] ArrayListPreInitTest.get_size_size_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.get_size_increases_with_add
[       OK ] ArrayListPreInitTest.get_size_increases_with_add (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_preserves_data_around_it
[       OK ] ArrayListPreInitTest.remove_preserves_data_around_it (0 ms)
[----------] 12 tests from ArrayListPreInitTest (0 ms total)

[----------] Global test environment tear-down
[==========] 31 tests from 2 test cases ran. (0 ms total)
[  PASSED  ] 31 tests.

=================================================================
==5522==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7fce6828db50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7fce67f9fba5 in __default_allocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3ba5)
    #2 0x7fce67f9fe98 in rcutils_array_list_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3e98)
    #3 0x55a62186398c in ArrayListTest_init_success_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x1c98c)
    #4 0x55a6218f3769 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xac769)
    #5 0x55a6218e5491 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x9e491)
    #6 0x55a6218911ed in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4a1ed)
    #7 0x55a621892618 in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4b618)
    #8 0x55a6218931bc in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4c1bc)
    #9 0x55a6218ae2cd in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x672cd)
    #10 0x55a6218f621c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xaf21c)
    #11 0x55a6218e775a in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xa075a)
    #12 0x55a6218ab061 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x64061)
    #13 0x55a62187e5b0 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x375b0)
    #14 0x55a62187e4f6 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x374f6)
    #15 0x7fce6740cb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Direct leak of 72 byte(s) in 1 object(s) allocated from:
    #0 0x7fce6828db50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7fce67f9fba5 in __default_allocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3ba5)
    #2 0x7fce67f9fe98 in rcutils_array_list_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3e98)
    #3 0x55a62186f09c in ArrayListTest_add_grow_capacity_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x2809c)
    #4 0x55a6218f3769 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xac769)
    #5 0x55a6218e5491 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x9e491)
    #6 0x55a6218911ed in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4a1ed)
    #7 0x55a621892618 in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4b618)
    #8 0x55a6218931bc in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4c1bc)
    #9 0x55a6218ae2cd in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x672cd)
    #10 0x55a6218f621c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xaf21c)
    #11 0x55a6218e775a in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xa075a)
    #12 0x55a6218ab061 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x64061)
    #13 0x55a62187e5b0 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x375b0)
    #14 0x55a62187e4f6 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x374f6)
    #15 0x7fce6740cb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Indirect leak of 128 byte(s) in 1 object(s) allocated from:
    #0 0x7fce6828df40 in realloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdef40)
    #1 0x7fce67f9fbed in __default_reallocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3bed)
    #2 0x7fce67fa00dd in rcutils_array_list_increase_capacity (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x40dd)
    #3 0x7fce67fa0214 in rcutils_array_list_add (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x4214)
    #4 0x55a62186f3cd in ArrayListTest_add_grow_capacity_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x283cd)
    #5 0x55a6218f3769 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xac769)
    #6 0x55a6218e5491 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x9e491)
    #7 0x55a6218911ed in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4a1ed)
    #8 0x55a621892618 in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4b618)
    #9 0x55a6218931bc in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4c1bc)
    #10 0x55a6218ae2cd in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x672cd)
    #11 0x55a6218f621c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xaf21c)
    #12 0x55a6218e775a in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xa075a)
    #13 0x55a6218ab061 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x64061)
    #14 0x55a62187e5b0 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x375b0)
    #15 0x55a62187e4f6 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x374f6)
    #16 0x7fce6740cb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x7fce6828db50 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xdeb50)
    #1 0x7fce67f9fba5 in __default_allocate (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3ba5)
    #2 0x7fce67f9ff23 in rcutils_array_list_init (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/install/rcutils/lib/librcutils.so+0x3f23)
    #3 0x55a62186398c in ArrayListTest_init_success_Test::TestBody() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x1c98c)
    #4 0x55a6218f3769 in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xac769)
    #5 0x55a6218e5491 in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x9e491)
    #6 0x55a6218911ed in testing::Test::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4a1ed)
    #7 0x55a621892618 in testing::TestInfo::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4b618)
    #8 0x55a6218931bc in testing::TestCase::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x4c1bc)
    #9 0x55a6218ae2cd in testing::internal::UnitTestImpl::RunAllTests() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x672cd)
    #10 0x55a6218f621c in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xaf21c)
    #11 0x55a6218e775a in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0xa075a)
    #12 0x55a6218ab061 in testing::UnitTest::Run() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x64061)
    #13 0x55a62187e5b0 in RUN_ALL_TESTS() (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x375b0)
    #14 0x55a62187e4f6 in main (/home/ANT.AMAZON.COM/tmoulard/ros2_ws/build-asan/rcutils/test_array_list+0x374f6)
    #15 0x7fce6740cb96 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)

SUMMARY: AddressSanitizer: 280 byte(s) leaked in 4 allocation(s).

After:

Running main() from ../../../install-asan/gtest_vendor/src/gtest_vendor/src/gtest_main.cc
[==========] Running 31 tests from 2 test cases.
[----------] Global test environment set-up.
[----------] 19 tests from ArrayListTest
[ RUN      ] ArrayListTest.init_list_null_fails
[       OK ] ArrayListTest.init_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.init_initial_capacity_zero_fails
[       OK ] ArrayListTest.init_initial_capacity_zero_fails (0 ms)
[ RUN      ] ArrayListTest.init_data_size_zero_fails
[       OK ] ArrayListTest.init_data_size_zero_fails (0 ms)
[ RUN      ] ArrayListTest.init_null_allocator_fails
[       OK ] ArrayListTest.init_null_allocator_fails (0 ms)
[ RUN      ] ArrayListTest.init_success
[       OK ] ArrayListTest.init_success (0 ms)
[ RUN      ] ArrayListTest.fini_list_null
[       OK ] ArrayListTest.fini_list_null (0 ms)
[ RUN      ] ArrayListTest.fini_list_not_initialized
[       OK ] ArrayListTest.fini_list_not_initialized (0 ms)
[ RUN      ] ArrayListTest.fini_success
[       OK ] ArrayListTest.fini_success (0 ms)
[ RUN      ] ArrayListTest.add_list_null_fails
[       OK ] ArrayListTest.add_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.add_list_not_initialized_fails
[       OK ] ArrayListTest.add_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.set_list_null_fails
[       OK ] ArrayListTest.set_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.set_list_not_initialized_fails
[       OK ] ArrayListTest.set_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.remove_list_null_fails
[       OK ] ArrayListTest.remove_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.remove_list_not_initialized_fails
[       OK ] ArrayListTest.remove_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.get_list_null_fails
[       OK ] ArrayListTest.get_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.get_list_not_initialized_fails
[       OK ] ArrayListTest.get_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.get_size_list_null_fails
[       OK ] ArrayListTest.get_size_list_null_fails (0 ms)
[ RUN      ] ArrayListTest.get_size_list_not_initialized_fails
[       OK ] ArrayListTest.get_size_list_not_initialized_fails (0 ms)
[ RUN      ] ArrayListTest.add_grow_capacity
[       OK ] ArrayListTest.add_grow_capacity (0 ms)
[----------] 19 tests from ArrayListTest (0 ms total)

[----------] 12 tests from ArrayListPreInitTest
[ RUN      ] ArrayListPreInitTest.add_data_null_fails
[       OK ] ArrayListPreInitTest.add_data_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.add_success
[       OK ] ArrayListPreInitTest.add_success (0 ms)
[ RUN      ] ArrayListPreInitTest.set_data_null_fails
[       OK ] ArrayListPreInitTest.set_data_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.set_data_index_oob_fails
[       OK ] ArrayListPreInitTest.set_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.set_success_changes_data
[       OK ] ArrayListPreInitTest.set_success_changes_data (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_data_index_oob_fails
[       OK ] ArrayListPreInitTest.remove_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_success_removes_from_list
[       OK ] ArrayListPreInitTest.remove_success_removes_from_list (0 ms)
[ RUN      ] ArrayListPreInitTest.get_data_index_oob_fails
[       OK ] ArrayListPreInitTest.get_data_index_oob_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.get_data_success_returns_data
[       OK ] ArrayListPreInitTest.get_data_success_returns_data (0 ms)
[ RUN      ] ArrayListPreInitTest.get_size_size_null_fails
[       OK ] ArrayListPreInitTest.get_size_size_null_fails (0 ms)
[ RUN      ] ArrayListPreInitTest.get_size_increases_with_add
[       OK ] ArrayListPreInitTest.get_size_increases_with_add (0 ms)
[ RUN      ] ArrayListPreInitTest.remove_preserves_data_around_it
[       OK ] ArrayListPreInitTest.remove_preserves_data_around_it (0 ms)
[----------] 12 tests from ArrayListPreInitTest (0 ms total)

[----------] Global test environment tear-down
[==========] 31 tests from 2 test cases ran. (0 ms total)
[  PASSED  ] 31 tests.

@thomas-moulard
Copy link
Contributor Author

@wjwwood another one fixing leaks in tests

Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
@thomas-moulard
Copy link
Contributor Author

I tried to apply your comments from the other PR here. Note that the situation is bit different as there already was a fixture to initialize the data structure.

I kept the pattern in the TearDown allowing _fini to fail under the principle that if we test fail (and the list never gets initialized), it's not a reason to have the TearDown failing too. This adds noise and make debugging more difficult (hard to differentiate the real problem from a minor side effect).

test/test_array_list.cpp Outdated Show resolved Hide resolved
Signed-off-by: Thomas Moulard <tmoulard@amazon.com>
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, other than the pre-existing issue I pointed out.

@thomas-moulard
Copy link
Contributor Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@thomas-moulard
Copy link
Contributor Author

I think I fixed everything and it should be OK to merge if CI is green.

@wjwwood wjwwood added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 12, 2019
@thomas-moulard
Copy link
Contributor Author

@wjwwood Should be ok to merge!

@wjwwood wjwwood merged commit 139916e into ros2:master Apr 16, 2019
@wjwwood wjwwood removed the in review Waiting for review (Kanban column) label Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix test_array_list leaks
3 participants