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

Commit 56044031 authored by Steven Moreland's avatar Steven Moreland
Browse files

binderSafeInterfaceTest: over maxFds, not double

This test is timing out, so test only 100 more calls
than maxFds instead of double that number. This still
will check against leaks, but limit the total time
that this testcase takes to run.

Fixes: 283165591
Test: binderSafeInterfaceTest

Change-Id: Ib022d29905997f65bfe85b83a1ff01848d16bd3b
parent 265e9e28
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@

#include <optional>

#include <inttypes.h>
#include <sys/eventfd.h>
#include <sys/prctl.h>

@@ -686,10 +687,12 @@ TEST_F(SafeInterfaceTest, TestIncrementNativeHandle) {
    // Determine the maximum number of fds this process can have open
    struct rlimit limit {};
    ASSERT_EQ(0, getrlimit(RLIMIT_NOFILE, &limit));
    uint32_t maxFds = static_cast<uint32_t>(limit.rlim_cur);
    uint64_t maxFds = limit.rlim_cur;

    ALOG(LOG_INFO, "SafeInterfaceTest", "%s max FDs: %" PRIu64, __PRETTY_FUNCTION__, maxFds);

    // Perform this test enough times to rule out fd leaks
    for (uint32_t iter = 0; iter < (2 * maxFds); ++iter) {
    for (uint32_t iter = 0; iter < (maxFds + 100); ++iter) {
        native_handle* handle = native_handle_create(1 /*numFds*/, 1 /*numInts*/);
        ASSERT_NE(nullptr, handle);
        handle->data[0] = dup(eventFd.get());