ADB: Delete test framework interrupt trick
The test framework features a fd to interrupt the (e)poll(3) call in
the fdevent system. This was created back in aosp/202177 at a time
where the fdevent did not have an interrupt mecanism.
Since then, fdevent has an Interrupt() method which is called automagi-
cally when lambda are added to the runloop via
fdevent_run_on_main_thread which made the test fd interrupt redundant.
Test: Unit tests and integration tests.
Bug: NA
Change-Id: I2500209beddcb98ea2e9aabc124e97aaf54de24a
diff --git a/socket_test.cpp b/socket_test.cpp
index 716577d..5a95fa3 100644
--- a/socket_test.cpp
+++ b/socket_test.cpp
@@ -99,7 +99,7 @@
// Wait until the local sockets are closed.
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}
@@ -165,11 +165,11 @@
ASSERT_EQ(0, adb_close(cause_close_fd[0]));
WaitForFdeventLoop();
- EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ EXPECT_EQ(1u, fdevent_installed_count());
ASSERT_EQ(0, adb_close(socket_fd[0]));
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}
@@ -190,7 +190,7 @@
ASSERT_EQ(0, adb_close(cause_close_fd[0]));
WaitForFdeventLoop();
- EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ EXPECT_EQ(1u, fdevent_installed_count());
// Verify if we can read successfully.
std::vector<char> buf(arg.bytes_written);
@@ -201,7 +201,7 @@
ASSERT_EQ(0, adb_close(socket_fd[0]));
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}
@@ -222,13 +222,13 @@
CreateCloser(&arg);
WaitForFdeventLoop();
- EXPECT_EQ(2u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ EXPECT_EQ(2u, fdevent_installed_count());
ASSERT_EQ(0, adb_close(socket_fd[0]));
std::this_thread::sleep_for(2s);
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}
@@ -265,7 +265,7 @@
adb_close(tail_fd[0]);
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}
@@ -310,13 +310,13 @@
});
WaitForFdeventLoop();
- EXPECT_EQ(1u + GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ EXPECT_EQ(1u, fdevent_installed_count());
// Wait until the client closes its socket.
client_thread.join();
WaitForFdeventLoop();
- ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count());
+ ASSERT_EQ(0u, fdevent_installed_count());
TerminateThread();
}