add getClatEgressMapFd() with tests
Test: atest
Bug: 139396664
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: Ic7d952ba32228107b35f97d8b89f9667270718be
diff --git a/server/ClatUtilsTest.cpp b/server/ClatUtilsTest.cpp
index 2a869ba..77b22a1 100644
--- a/server/ClatUtilsTest.cpp
+++ b/server/ClatUtilsTest.cpp
@@ -65,7 +65,15 @@
ASSERT_EQ(ARPHRD_RAWIP, type);
}
-TEST_F(ClatUtilsTest, GetClatMapFd) {
+TEST_F(ClatUtilsTest, GetClatEgressMapFd) {
+ SKIP_IF_BPF_NOT_SUPPORTED;
+
+ int fd = getClatEgressMapFd();
+ ASSERT_LE(3, fd); // 0,1,2 - stdin/out/err, thus 3 <= fd
+ close(fd);
+}
+
+TEST_F(ClatUtilsTest, GetClatIngressMapFd) {
SKIP_IF_BPF_NOT_SUPPORTED;
int fd = getClatIngressMapFd();