From 878aae0856f77e5268c7ed52784c29b3bc4d6bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= Date: Sat, 15 Jun 2024 11:54:36 -0700 Subject: [PATCH] BpfMapTest: fixes for testGetFd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test: TreeHugger, atest BpfMapTest happier Signed-off-by: Maciej Żenczykowski Change-Id: Ib2915d48fab2c1e90300f1d4aa5d2cb2f69741f9 --- .../src/com/android/networkstack/tethering/BpfMapTest.java | 4 +++- bpf_progs/test.c | 2 ++ tests/mts/bpf_existence_test.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Tethering/tests/privileged/src/com/android/networkstack/tethering/BpfMapTest.java b/Tethering/tests/privileged/src/com/android/networkstack/tethering/BpfMapTest.java index d5d941a2b2..a0928c5b81 100644 --- a/Tethering/tests/privileged/src/com/android/networkstack/tethering/BpfMapTest.java +++ b/Tethering/tests/privileged/src/com/android/networkstack/tethering/BpfMapTest.java @@ -71,6 +71,8 @@ public final class BpfMapTest { "/sys/fs/bpf/tethering/map_test_tether_downstream6_map"; private static final String TETHER2_DOWNSTREAM6_FS_PATH = "/sys/fs/bpf/tethering/map_test_tether2_downstream6_map"; + private static final String TETHER3_DOWNSTREAM6_FS_PATH = + "/sys/fs/bpf/tethering/map_test_tether3_downstream6_map"; private ArrayMap mTestData; @@ -156,7 +158,7 @@ public final class BpfMapTest { assertEquals(OsConstants.EPERM, expected.errno); } } - try (BpfMap writeOnlyMap = new BpfMap<>(TETHER_DOWNSTREAM6_FS_PATH, BpfMap.BPF_F_WRONLY, + try (BpfMap writeOnlyMap = new BpfMap<>(TETHER3_DOWNSTREAM6_FS_PATH, BpfMap.BPF_F_WRONLY, TetherDownstream6Key.class, Tether6Value.class)) { assertNotNull(writeOnlyMap); try { diff --git a/bpf_progs/test.c b/bpf_progs/test.c index fd6f9b5c00..6a4471cb98 100644 --- a/bpf_progs/test.c +++ b/bpf_progs/test.c @@ -47,6 +47,8 @@ DEFINE_BPF_MAP_GRW(tether_downstream6_map, HASH, TetherDownstream6Key, Tether6Va TETHERING_GID) DEFINE_BPF_MAP_GRW(tether2_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16, TETHERING_GID) +DEFINE_BPF_MAP_GRW(tether3_downstream6_map, HASH, TetherDownstream6Key, Tether6Value, 16, + TETHERING_GID) // Used only by BpfBitmapTest, not by production code. DEFINE_BPF_MAP_GRW(bitmap, ARRAY, int, uint64_t, 2, TETHERING_GID) diff --git a/tests/mts/bpf_existence_test.cpp b/tests/mts/bpf_existence_test.cpp index 1dc2e90218..e212e7de1a 100644 --- a/tests/mts/bpf_existence_test.cpp +++ b/tests/mts/bpf_existence_test.cpp @@ -69,6 +69,7 @@ static const set MAINLINE_FOR_S_PLUS = { TETHERING "map_test_bitmap", TETHERING "map_test_tether_downstream6_map", TETHERING "map_test_tether2_downstream6_map", + TETHERING "map_test_tether3_downstream6_map", TETHERING "prog_offload_schedcls_tether_downstream4_ether", TETHERING "prog_offload_schedcls_tether_downstream4_rawip", TETHERING "prog_offload_schedcls_tether_downstream6_ether",