diff options
author | Maciej Żenczykowski <maze@google.com> | 2023-04-21 01:28:40 -0700 |
---|---|---|
committer | Maciej Żenczykowski <maze@google.com> | 2023-04-21 02:11:25 -0700 |
commit | f627d6781860c5ee36962e1d609a2176f12c8283 (patch) | |
tree | 199f3cce075c7ad15d80bc3bdbe94d09985ffddd | |
parent | efdaea782915c330b142d8aa93e1e2fbd6e0ddfa (diff) | |
download | net-f627d6781860c5ee36962e1d609a2176f12c8283.tar.gz |
NetlinkUtilsTest: add an assumption to testGetNeighborsQuery
after:
com.android.net.moduletests.util.netlink.NetlinkUtilsTest#testGetNeighborsQuery: ASSUMPTION_FAILED
Bug: 200221182
Test: TreeHugger, atest NetworkStaticLibTests
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I556a3a52339e5e2343b02d2b2b67b486cb9b2033
-rw-r--r-- | common/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java b/common/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java index 7a1639ae..dbd31ea4 100644 --- a/common/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java +++ b/common/tests/unit/src/com/android/net/module/util/netlink/NetlinkUtilsTest.java @@ -30,6 +30,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; +import static org.junit.Assume.assumeFalse; import android.content.Context; import android.system.ErrnoException; @@ -51,6 +52,8 @@ import org.junit.runner.RunWith; import java.io.FileDescriptor; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.nio.file.Files; +import java.nio.file.Paths; @RunWith(AndroidJUnit4.class) @SmallTest @@ -82,6 +85,8 @@ public class NetlinkUtilsTest { // Apps targeting an SDK version > S are not allowed to send RTM_GETNEIGH{TBL} messages 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:")); 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," |