static int group_test_getgrent(struct group *grp, void *mdata) { /* Only correctness can be checked when doing 1-pass test for * getgrent(). */ return (group_test_correctness(grp, NULL)); }
static int group_test_getgrnam(struct group *grp_model, void *mdata) { struct group *grp; if (debug) { printf("testing getgrnam() with the following data:\n"); dump_group(grp_model); } grp = getgrnam(grp_model->gr_name); if (group_test_correctness(grp, NULL) != 0) goto errfin; if ((compare_group(grp, grp_model, NULL) != 0) && (group_check_ambiguity((struct group_test_data *)mdata, grp) !=0)) goto errfin; if (debug) printf("ok\n"); return (0); errfin: if (debug) printf("not ok\n"); return (-1); }
static int group_fill_test_data(struct group_test_data *td) { struct group *grp; setgroupent(1); while ((grp = getgrent()) != NULL) { if (group_test_correctness(grp, NULL) == 0) TEST_DATA_APPEND(group, td, grp); else return (-1); } endgrent(); return (0); }
static int group_test_getgrgid(struct group *grp_model, void *mdata) { struct group *grp; printf("testing getgrgid() with the following data...\n"); dump_group(grp_model); grp = getgrgid(grp_model->gr_gid); if (group_test_correctness(grp, NULL) != 0 || (compare_group(grp, grp_model, NULL) != 0 && group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)) { return (-1); } else { return (0); } }
static int group_test_getgrgid(struct group *grp_model, void *mdata) { struct group *grp; if (debug) { printf("testing getgrgid() with the following data...\n"); dump_group(grp_model); } grp = getgrgid(grp_model->gr_gid); if ((group_test_correctness(grp, NULL) != 0) || ((compare_group(grp, grp_model, NULL) != 0) && (group_check_ambiguity((struct group_test_data *)mdata, grp) != 0))) { if (debug) printf("not ok\n"); return (-1); } else { if (debug) printf("ok\n"); return (0); } }