Merge "Revert "connectivity_native_test: remove retries"" am: 749fd994f8

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2134515

Change-Id: Ifa65e3195945034b8fe02d08084db7ab7387e3cf
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Steven Moreland 2022-06-22 20:44:26 +00:00 • committed by Automerger Merge Worker
commit 8d48c6156b

View file

@ -233,29 +233,54 @@ TEST_F(ConnectivityNativeBinderTest, UnblockAllPorts) {
}
TEST_F(ConnectivityNativeBinderTest, BlockNegativePort) {
ndk::ScopedAStatus status = mService->blockPortForBind(-1);
int retry = 0;
ndk::ScopedAStatus status;
do {
status = mService->blockPortForBind(-1);
// TODO: find out why transaction failed is being thrown on the first attempt.
} while (status.getExceptionCode() == EX_TRANSACTION_FAILED && retry++ < 5);
EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
}
TEST_F(ConnectivityNativeBinderTest, UnblockNegativePort) {
ndk::ScopedAStatus status = mService->unblockPortForBind(-1);
int retry = 0;
ndk::ScopedAStatus status;
do {
status = mService->unblockPortForBind(-1);
// TODO: find out why transaction failed is being thrown on the first attempt.
} while (status.getExceptionCode() == EX_TRANSACTION_FAILED && retry++ < 5);
EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
}
TEST_F(ConnectivityNativeBinderTest, BlockMaxPort) {
ndk::ScopedAStatus status = mService->blockPortForBind(65536);
int retry = 0;
ndk::ScopedAStatus status;
do {
status = mService->blockPortForBind(65536);
// TODO: find out why transaction failed is being thrown on the first attempt.
} while (status.getExceptionCode() == EX_TRANSACTION_FAILED && retry++ < 5);
EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
}
TEST_F(ConnectivityNativeBinderTest, UnblockMaxPort) {
ndk::ScopedAStatus status = mService->unblockPortForBind(65536);
int retry = 0;
ndk::ScopedAStatus status;
do {
status = mService->unblockPortForBind(65536);
// TODO: find out why transaction failed is being thrown on the first attempt.
} while (status.getExceptionCode() == EX_TRANSACTION_FAILED && retry++ < 5);
EXPECT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
}
TEST_F(ConnectivityNativeBinderTest, CheckPermission) {
int retry = 0;
int curUid = getuid();
EXPECT_EQ(0, seteuid(FIRST_APPLICATION_UID + 2000)) << "seteuid failed: " << strerror(errno);
ndk::ScopedAStatus status = mService->blockPortForBind(5555);
ndk::ScopedAStatus status;
do {
status = mService->blockPortForBind(5555);
// TODO: find out why transaction failed is being thrown on the first attempt.
} while (status.getExceptionCode() == EX_TRANSACTION_FAILED && retry++ < 5);
EXPECT_EQ(EX_SECURITY, status.getExceptionCode());
EXPECT_EQ(0, seteuid(curUid)) << "seteuid failed: " << strerror(errno);
}