Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 01eeab93 authored by Vova Sharaienko's avatar Vova Sharaienko
Browse files

Fixed gpuservice_unittest mem leaks

  Activated looper to wait on binder transactions
  Binder transaction initiated by libstatspull on behalf of GpuStats
  See GpuStats::registerStatsdCallbacksIfNeeded()

Bug: 222527290
Test: atest gpuservice_unittest
Change-Id: I3797e7bb22f35eda84bc1196a448674e1123e046
parent 7514e3b9
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <gtest/gtest.h>
#include <stats_pull_atom_callback.h>
#include <statslog.h>
#include <utils/Looper.h>
#include <utils/String16.h>
#include <utils/Vector.h>

@@ -62,8 +63,9 @@ enum InputCommand : int32_t {
// clang-format on

class GpuStatsTest : public testing::Test {
    sp<android::Looper> looper;
public:
    GpuStatsTest() {
    GpuStatsTest() : looper(Looper::prepare(0 /* opts */)) {
        const ::testing::TestInfo* const test_info =
                ::testing::UnitTest::GetInstance()->current_test_info();
        ALOGD("**** Setting up for %s.%s\n", test_info->test_case_name(), test_info->name());
@@ -73,6 +75,10 @@ public:
        const ::testing::TestInfo* const test_info =
                ::testing::UnitTest::GetInstance()->current_test_info();
        ALOGD("**** Tearing down after %s.%s\n", test_info->test_case_name(), test_info->name());

        // performs all pending callbacks until all data has been consumed
        // gives time to process binder transactions by thread pool
        looper->pollAll(1000);
    }

    std::string inputCommand(InputCommand cmd);