diff options
author | Almaz Mingaleev <mingaleev@google.com> | 2024-04-30 13:30:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-04-30 13:30:15 +0000 |
commit | 9265fbef09d9c10e9babe35d368d11a21cc2a94d (patch) | |
tree | 9acb081bad2d5f36a4399eda9c4391c2b4e1b49b | |
parent | 90ebde7475e4c4c5767836e80810f64db499041c (diff) | |
parent | f5c6e8194f134e370fee64d38d40d7523a147e83 (diff) | |
download | libcore-9265fbef09d9c10e9babe35d368d11a21cc2a94d.tar.gz |
Merge "Add Os.capset test." into main
-rw-r--r-- | luni/src/test/java/libcore/android/system/OsTest.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/luni/src/test/java/libcore/android/system/OsTest.java b/luni/src/test/java/libcore/android/system/OsTest.java index 209f30bec27..1d4225e872d 100644 --- a/luni/src/test/java/libcore/android/system/OsTest.java +++ b/luni/src/test/java/libcore/android/system/OsTest.java @@ -22,6 +22,8 @@ import android.system.NetlinkSocketAddress; import android.system.Os; import android.system.OsConstants; import android.system.PacketSocketAddress; +import android.system.StructCapUserData; +import android.system.StructCapUserHeader; import android.system.StructCmsghdr; import android.system.StructMsghdr; import android.system.StructRlimit; @@ -2306,6 +2308,19 @@ public class OsTest { Os.munmap(address, size); } + @Test + public void testCapset() throws Exception { + var header = new StructCapUserHeader(_LINUX_CAPABILITY_VERSION_3, /* pid= */0); + var existing = Os.capget(header); + var noCapabilities = new StructCapUserData(0, 0, 0); + + try { + Os.capset(header, new StructCapUserData[] { noCapabilities, noCapabilities }); + } finally { + Os.capset(header, existing); + } + } + /* * Checks that all ways of accessing the environment are consistent by collecting: * osEnvironment - The environment returned by Os.environ() |