diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2019-11-19 21:08:07 +0000 |
---|---|---|
committer | android-build-prod (mdb) <android-build-team-robot@google.com> | 2019-11-19 21:08:07 +0000 |
commit | c611b61b7f0ea8691f8cac35fa1dfe042bca0b34 (patch) | |
tree | 1a1e00114dd8b0f643483e8cbd6b000537b59a4b | |
parent | 5a2805599629d028b38fff13ecff17bd85759fc3 (diff) | |
parent | e3425844b86e42e6b5e86d3f9a20762c15cb0453 (diff) | |
download | netd-android10-tests-release.tar.gz |
Snap for 6017365 from e3425844b86e42e6b5e86d3f9a20762c15cb0453 to android10-tests-releaseandroid-vts-10.0_r9android-vts-10.0_r8android-vts-10.0_r7android-vts-10.0_r6android-vts-10.0_r5android-vts-10.0_r4android-vts-10.0_r3android-vts-10.0_r2android-vts-10.0_r16android-vts-10.0_r15android-vts-10.0_r14android-vts-10.0_r13android-vts-10.0_r12android-vts-10.0_r11android-vts-10.0_r10android-cts-10.0_r9android-cts-10.0_r8android-cts-10.0_r7android-cts-10.0_r6android-cts-10.0_r5android-cts-10.0_r4android-cts-10.0_r3android-cts-10.0_r16android-cts-10.0_r15android-cts-10.0_r14android-cts-10.0_r13android-cts-10.0_r12android-cts-10.0_r11android-cts-10.0_r10android10-tests-release
Change-Id: I42929232a16a49392a0684aa55dc8b6523a1750b
-rw-r--r-- | tests/netlink_listener_test.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/netlink_listener_test.cpp b/tests/netlink_listener_test.cpp index 901c1d0c..94e95246 100644 --- a/tests/netlink_listener_test.cpp +++ b/tests/netlink_listener_test.cpp @@ -103,7 +103,7 @@ class NetlinkListenerTest : public testing::Test { return mCookieTagMap.iterateWithValue(checkGarbageTags); } - void checkMassiveSocketDestroy(const int totalNumber, bool expectError) { + void checkMassiveSocketDestroy(int totalNumber, bool expectError) { std::unique_ptr<android::net::NetlinkListenerInterface> skDestroyListener; auto result = android::net::TrafficController::makeSkDestroyListener(); if (!isOk(result)) { @@ -118,16 +118,24 @@ class NetlinkListenerTest : public testing::Test { int fds[totalNumber]; for (int i = 0; i < totalNumber; i++) { fds[i] = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); - EXPECT_LE(0, fds[i]); + // The likely reason for a failure is running out of available file descriptors. + EXPECT_LE(0, fds[i]) << i << " of " << totalNumber; + if (fds[i] < 0) { + // EXPECT_LE already failed above, so test case is a failure, but we don't + // want potentially tens of thousands of extra failures creating and then + // closing all these fds cluttering up the logs. + totalNumber = i; + break; + }; qtaguid_tagSocket(fds[i], TEST_TAG, TEST_UID); } - // TODO: Use a separate thread that have it's own fd table so we can - // close socket faster by terminating that threads. + // TODO: Use a separate thread that has it's own fd table so we can + // close sockets even faster simply by terminating that thread. for (int i = 0; i < totalNumber; i++) { EXPECT_EQ(0, close(fds[i])); } - // wait a bit for netlink listner to handle all the messages. + // wait a bit for netlink listener to handle all the messages. usleep(SOCK_CLOSE_WAIT_US); if (expectError) { // If ENOBUFS triggered, check it only called into the handler once, ie. @@ -153,5 +161,5 @@ TEST_F(NetlinkListenerTest, TestAllSocketUntagged) { TEST_F(NetlinkListenerTest, TestSkDestroyError) { SKIP_IF_BPF_NOT_SUPPORTED; - checkMassiveSocketDestroy(50000, true); + checkMassiveSocketDestroy(32500, true); } |