diff options
author | Fabien Sanglard <sanglardf@google.com> | 2022-08-24 16:38:07 -0700 |
---|---|---|
committer | Fabien Sanglard <sanglardf@google.com> | 2022-09-07 19:43:30 +0000 |
commit | 3bff3305e26f1bc2be913eaf43756d5bf3bff6dd (patch) | |
tree | aef23a95b964e420c4e8fe66be4b4757374eed1c /socket_test.cpp | |
parent | 27025b8900aef31bd5bf6f59d31d0db18c035991 (diff) | |
download | adb-3bff3305e26f1bc2be913eaf43756d5bf3bff6dd.tar.gz |
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
Diffstat (limited to 'socket_test.cpp')
-rw-r--r-- | socket_test.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/socket_test.cpp b/socket_test.cpp index 716577dd..5a95fa35 100644 --- a/socket_test.cpp +++ b/socket_test.cpp @@ -99,7 +99,7 @@ TEST_F(LocalSocketTest, smoke) { // 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 @@ TEST_F(LocalSocketTest, close_socket_with_packet) { 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 @@ TEST_F(LocalSocketTest, read_from_closing_socket) { 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 @@ TEST_F(LocalSocketTest, read_from_closing_socket) { 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 @@ TEST_F(LocalSocketTest, write_error_when_having_packets) { 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 @@ TEST_F(LocalSocketTest, flush_after_shutdown) { adb_close(tail_fd[0]); WaitForFdeventLoop(); - ASSERT_EQ(GetAdditionalLocalSocketCount(), fdevent_installed_count()); + ASSERT_EQ(0u, fdevent_installed_count()); TerminateThread(); } @@ -310,13 +310,13 @@ TEST_F(LocalSocketTest, close_socket_in_CLOSE_WAIT_state) { }); 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(); } |