Lines Matching refs:grp

480 static void check_group(const group* grp, const char* group_name, gid_t gid,  in check_group()  argument
482 ASSERT_TRUE(grp != nullptr); in check_group()
484 EXPECT_STREQ(group_name, grp->gr_name); in check_group()
486 EXPECT_EQ(gid, grp->gr_gid); in check_group()
487 ASSERT_TRUE(grp->gr_mem != nullptr); in check_group()
489 EXPECT_STREQ(group_name, grp->gr_mem[0]); in check_group()
491 EXPECT_TRUE(grp->gr_mem[1] == nullptr); in check_group()
498 group* grp = getgrgid(gid); in check_getgrgid() local
501 check_group(grp, group_name, gid, check_groupname); in check_getgrgid()
506 group* grp = getgrnam(group_name); in check_getgrnam() local
509 check_group(grp, group_name, gid, check_groupname); in check_getgrnam()
515 group* grp; in check_getgrgid_r() local
518 int result = getgrgid_r(gid, &grp_storage, buf, sizeof(buf), &grp); in check_getgrgid_r()
522 check_group(grp, group_name, gid, check_groupname); in check_getgrgid_r()
528 group* grp; in check_getgrnam_r() local
531 int result = getgrnam_r(group_name, &grp_storage, buf, sizeof(buf), &grp); in check_getgrnam_r()
535 check_group(grp, group_name, gid, check_groupname); in check_getgrnam_r()
594 TEST(grp, getgrnam_platform_ids) { in TEST() argument
607 TEST(grp, getgrnam_oem_ids) { in TEST() argument
616 TEST(grp, getgrnam_non_exist) { in TEST() argument
622 TEST(grp, getgrnam_u0_app_ids) { in TEST() argument
646 TEST(grp, getgrnam_u1_app_ids) { in TEST() argument
669 TEST(grp, getgrnam_u31_app_ids) { in TEST() argument
696 TEST(grp, getpgram_app_id_not_allowed_platform) { in TEST() argument
704 TEST(grp, getgrgid_app_id_u1_non_exist) { in TEST() argument
714 TEST(grp, getgrgid_app_id_u31_non_exist) { in TEST() argument
724 TEST(grp, getgrnam_r_alignment) { in TEST() argument
728 group* grp; in TEST() local
729 int result = getgrnam_r("root", &grp_storage, buf + 1, sizeof(buf) - 1, &grp); in TEST()
731 check_group(grp, "root", 0); in TEST()
737 TEST(grp, getgrgid_r_alignment) { in TEST() argument
741 group* grp; in TEST() local
742 int result = getgrgid_r(0, &grp_storage, buf + 1, sizeof(buf) - 1, &grp); in TEST()
744 check_group(grp, "root", 0); in TEST()
750 TEST(grp, getgrnam_r_reentrancy) { in TEST() argument
754 group* grp[3]; in TEST() local
755 int result = getgrnam_r("root", &grp_storage[0], buf[0], sizeof(buf[0]), &grp[0]); in TEST()
757 check_group(grp[0], "root", 0); in TEST()
758 grp[1] = getgrnam("system"); in TEST()
759 check_group(grp[1], "system", 1000); in TEST()
760 result = getgrnam_r("radio", &grp_storage[1], buf[1], sizeof(buf[1]), &grp[2]); in TEST()
762 check_group(grp[2], "radio", 1001); in TEST()
763 check_group(grp[0], "root", 0); in TEST()
764 check_group(grp[1], "system", 1000); in TEST()
770 TEST(grp, getgrgid_r_reentrancy) { in TEST() argument
774 group* grp[3]; in TEST() local
775 int result = getgrgid_r(0, &grp_storage[0], buf[0], sizeof(buf[0]), &grp[0]); in TEST()
777 check_group(grp[0], "root", 0); in TEST()
778 grp[1] = getgrgid(1000); in TEST()
779 check_group(grp[1], "system", 1000); in TEST()
780 result = getgrgid_r(1001, &grp_storage[1], buf[1], sizeof(buf[1]), &grp[2]); in TEST()
782 check_group(grp[2], "radio", 1001); in TEST()
783 check_group(grp[0], "root", 0); in TEST()
784 check_group(grp[1], "system", 1000); in TEST()
790 TEST(grp, getgrnam_r_large_enough_suggested_buffer_size) { in TEST() argument
795 group* grp; in TEST() local
796 ASSERT_EQ(0, getgrnam_r("root", &grp_storage, buf, size, &grp)); in TEST()
797 check_group(grp, "root", 0); in TEST()
800 TEST(grp, getgrent_iterate) { in TEST() argument
802 group* grp; in TEST() local
806 while ((grp = getgrent()) != nullptr) { in TEST()
807 ASSERT_TRUE(grp->gr_name != nullptr) << "grp->gr_gid: " << grp->gr_gid; in TEST()
808 ASSERT_TRUE(grp->gr_mem != nullptr) << "grp->gr_gid: " << grp->gr_gid; in TEST()
809 EXPECT_STREQ(grp->gr_name, grp->gr_mem[0]) << "grp->gr_gid: " << grp->gr_gid; in TEST()
810 EXPECT_TRUE(grp->gr_mem[1] == nullptr) << "grp->gr_gid: " << grp->gr_gid; in TEST()
812 EXPECT_EQ(0U, gids.count(grp->gr_gid)) << "grp->gr_gid: " << grp->gr_gid; in TEST()
813 gids.emplace(grp->gr_gid); in TEST()