Exclude testGetNeighborsQuery from NetworkStackCoverageTests.
sepolicy gates RTM_GETNEIGH{TBL} with a new permission nlmsg_getneigh
and block access from untrusted_apps, but NetworkStackCoverageTests
uses the same UID with NetworkStack module, so it still has the
permission to send RTM_GETNEIGH(context: u:r:network_stack:s0<00>),
which causes the test always fails. Add the same assumeFalse check
for tests with network_stack context.
Bug: 283346574
Test: atest NetworkStackCoverageTests
Change-Id: Iaf652841bb9868783c924aa22fdf0c4f07e1e391
diff --git a/staticlibs/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java b/staticlibs/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java
index 3a72dd1..5e9b004 100644
--- a/staticlibs/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java
+++ b/staticlibs/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java
@@ -88,6 +88,11 @@
if (SdkLevel.isAtLeastT() && targetSdk > 31) {
var ctxt = new String(Files.readAllBytes(Paths.get("/proc/thread-self/attr/current")));
assumeFalse("must not be platform app", ctxt.startsWith("u:r:platform_app:s0:"));
+ // NetworkStackCoverageTests uses the same UID with NetworkStack module, which
+ // still has the permission to send RTM_GETNEIGH message (sepolicy just blocks the
+ // access from untrusted_apps), also exclude the NetworkStackCoverageTests.
+ assumeFalse("network_stack context is expected to have permission to send RTM_GETNEIGH",
+ ctxt.startsWith("u:r:network_stack:s0"));
try {
NetlinkUtils.sendMessage(fd, req, 0, req.length, TEST_TIMEOUT_MS);
fail("RTM_GETNEIGH is not allowed for apps targeting SDK > 31 on T+ platforms,"