aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cherry <tomcherry@google.com>2018-10-09 11:01:28 -0700
committerTom Cherry <tomcherry@google.com>2018-10-11 19:05:09 +0000
commitb1339084594c7242781db5b264c4db71d425f8a1 (patch)
tree8d6754c295354f66b4ed9eed7d8fa78693a28fc3
parent866374163a1164e1113a4d2e9e0453d68a06dfa3 (diff)
downloadbionic-b1339084594c7242781db5b264c4db71d425f8a1.tar.gz
Waive AID Range check for upgrading devices launched before P
We added a check in P that ensures all vendor provided AIDs only appear in the carved out ranges for vendors to use. However, upgrading devices may be using AIDs outside of this range and it is very difficult to change these AIDs, so we waive this test for them. Bug: 116830906 Test: test succeeds on upgrading devices Change-Id: Iddcacb1dce77a150d5138e7b3115abf25bf60a6e
-rw-r--r--tests/grp_pwd_test.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/grp_pwd_test.cpp b/tests/grp_pwd_test.cpp
index 6316387f0..7474d565b 100644
--- a/tests/grp_pwd_test.cpp
+++ b/tests/grp_pwd_test.cpp
@@ -32,6 +32,10 @@
#include <android-base/strings.h>
#include <private/android_filesystem_config.h>
+#if defined(__BIONIC__)
+#include <android-base/properties.h>
+#endif
+
// Generated android_ids array
#include "generated_android_ids.h"
@@ -207,6 +211,7 @@ TEST(pwd, getpwnam_app_id_u1_i0) {
check_get_passwd("u1_i0", 199000, TYPE_APP);
}
+#if defined(__BIONIC__)
template <typename T>
static void expect_ids(const T& ids) {
std::set<typename T::key_type> expected_ids;
@@ -233,6 +238,12 @@ static void expect_ids(const T& ids) {
expect_range(AID_SHARED_GID_START, AID_SHARED_GID_END);
expect_range(AID_ISOLATED_START, AID_ISOLATED_END);
+ // Upgrading devices launched before API level 28 may not comply with the below check.
+ // Due to the difficulty in changing uids after launch, it is waived for these devices.
+ if (android::base::GetIntProperty("ro.product.first_api_level", 0) < 28) {
+ return;
+ }
+
// Ensure that no other ids were returned.
auto return_differences = [&ids, &expected_ids] {
std::vector<typename T::key_type> missing_from_ids;
@@ -253,6 +264,7 @@ static void expect_ids(const T& ids) {
};
EXPECT_EQ(expected_ids, ids) << return_differences();
}
+#endif
TEST(pwd, getpwent_iterate) {
#if defined(__BIONIC__)