Merge "Disable {getpwent,getgrent}_iterate tests on glibc."

am: b5560355ae

Change-Id: Ifd53b759282b8081217b5c9c768b8cfcc3f93549
This commit is contained in:
Josh Gao 2018-02-28 00:32:46 +00:00 committed by android-build-merger
commit e6d83e6455

View file

@ -115,10 +115,14 @@ static void check_get_passwd(const char* username, uid_t uid, uid_type_t uid_typ
#else // !defined(__BIONIC__)
static void check_get_passwd(const char* /* username */, uid_t /* uid */, uid_type_t /* uid_type */) {
static void print_no_getpwnam_test_info() {
GTEST_LOG_(INFO) << "This test is about uid/username translation for Android, which does nothing on libc other than bionic.\n";
}
static void check_get_passwd(const char* /* username */, uid_t /* uid */, uid_type_t /* uid_type */) {
print_no_getpwnam_test_info();
}
#endif
TEST(pwd, getpwnam_system_id_root) {
@ -238,6 +242,7 @@ static void expect_ids(const T& ids) {
}
TEST(pwd, getpwent_iterate) {
#if defined(__BIONIC__)
passwd* pwd;
std::set<uid_t> uids;
@ -263,6 +268,9 @@ TEST(pwd, getpwent_iterate) {
endpwent();
expect_ids(uids);
#else
print_no_getpwnam_test_info();
#endif
}
static void check_group(const group* grp, const char* group_name, gid_t gid) {
@ -477,6 +485,7 @@ TEST(grp, getgrnam_r_large_enough_suggested_buffer_size) {
}
TEST(grp, getgrent_iterate) {
#if defined(__BIONIC__)
group* grp;
std::set<gid_t> gids;
@ -493,4 +502,7 @@ TEST(grp, getgrent_iterate) {
endgrent();
expect_ids(gids);
#else
print_no_getgrnam_test_info();
#endif
}