Deleted Added
full compact
getgr_test.c (291363) getgr_test.c (292323)
1/*-
2 * Copyright (c) 2006 Michael Bushkov <bushman@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 Michael Bushkov <bushman@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 12 unchanged lines hidden (view full) ---

21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/tools/regression/lib/libc/nss/test-getgr.c 291363 2015-11-26 08:58:13Z ngie $");
29__FBSDID("$FreeBSD: head/lib/libc/tests/nss/getgr_test.c 292323 2015-12-16 08:09:03Z ngie $");
30
31#include <arpa/inet.h>
30
31#include <arpa/inet.h>
32#include <assert.h>
33#include <errno.h>
34#include <grp.h>
35#include <stdio.h>
36#include <stdlib.h>
37#include <string.h>
38#include <stringlist.h>
39#include <unistd.h>
32#include <errno.h>
33#include <grp.h>
34#include <stdio.h>
35#include <stdlib.h>
36#include <string.h>
37#include <stringlist.h>
38#include <unistd.h>
39
40#include <atf-c.h>
41
40#include "testutil.h"
41
42enum test_methods {
42#include "testutil.h"
43
44enum test_methods {
43 TEST_GETGRENT,
44 TEST_GETGRNAM,
45 TEST_GETGRGID,
46 TEST_GETGRENT_2PASS,
47 TEST_BUILD_SNAPSHOT
45 TEST_GETGRENT = 1,
46 TEST_GETGRNAM = 2,
47 TEST_GETGRGID = 4,
48 TEST_GETGRENT_2PASS = 8,
49 TEST_BUILD_SNAPSHOT = 16,
48};
49
50};
51
50static int debug = 0;
51static enum test_methods method = TEST_BUILD_SNAPSHOT;
52
53DECLARE_TEST_DATA(group)
54DECLARE_TEST_FILE_SNAPSHOT(group)
55DECLARE_1PASS_TEST(group)
56DECLARE_2PASS_TEST(group)
57
58static void clone_group(struct group *, struct group const *);

--- 7 unchanged lines hidden (view full) ---

66static int group_check_ambiguity(struct group_test_data *,
67 struct group *);
68static int group_fill_test_data(struct group_test_data *);
69static int group_test_correctness(struct group *, void *);
70static int group_test_getgrnam(struct group *, void *);
71static int group_test_getgrgid(struct group *, void *);
72static int group_test_getgrent(struct group *, void *);
73
52static enum test_methods method = TEST_BUILD_SNAPSHOT;
53
54DECLARE_TEST_DATA(group)
55DECLARE_TEST_FILE_SNAPSHOT(group)
56DECLARE_1PASS_TEST(group)
57DECLARE_2PASS_TEST(group)
58
59static void clone_group(struct group *, struct group const *);

--- 7 unchanged lines hidden (view full) ---

67static int group_check_ambiguity(struct group_test_data *,
68 struct group *);
69static int group_fill_test_data(struct group_test_data *);
70static int group_test_correctness(struct group *, void *);
71static int group_test_getgrnam(struct group *, void *);
72static int group_test_getgrgid(struct group *, void *);
73static int group_test_getgrent(struct group *, void *);
74
74static void usage(void) __attribute__((__noreturn__));
75
76IMPLEMENT_TEST_DATA(group)
77IMPLEMENT_TEST_FILE_SNAPSHOT(group)
78IMPLEMENT_1PASS_TEST(group)
79IMPLEMENT_2PASS_TEST(group)
80
81static void
82clone_group(struct group *dest, struct group const *src)
83{
75IMPLEMENT_TEST_DATA(group)
76IMPLEMENT_TEST_FILE_SNAPSHOT(group)
77IMPLEMENT_1PASS_TEST(group)
78IMPLEMENT_2PASS_TEST(group)
79
80static void
81clone_group(struct group *dest, struct group const *src)
82{
84 assert(dest != NULL);
85 assert(src != NULL);
83 ATF_REQUIRE(dest != NULL);
84 ATF_REQUIRE(src != NULL);
86
87 char **cp;
88 int members_num;
89
90 memset(dest, 0, sizeof(struct group));
91
92 if (src->gr_name != NULL) {
93 dest->gr_name = strdup(src->gr_name);
85
86 char **cp;
87 int members_num;
88
89 memset(dest, 0, sizeof(struct group));
90
91 if (src->gr_name != NULL) {
92 dest->gr_name = strdup(src->gr_name);
94 assert(dest->gr_name != NULL);
93 ATF_REQUIRE(dest->gr_name != NULL);
95 }
96
97 if (src->gr_passwd != NULL) {
98 dest->gr_passwd = strdup(src->gr_passwd);
94 }
95
96 if (src->gr_passwd != NULL) {
97 dest->gr_passwd = strdup(src->gr_passwd);
99 assert(dest->gr_passwd != NULL);
98 ATF_REQUIRE(dest->gr_passwd != NULL);
100 }
101 dest->gr_gid = src->gr_gid;
102
103 if (src->gr_mem != NULL) {
104 members_num = 0;
105 for (cp = src->gr_mem; *cp; ++cp)
106 ++members_num;
107
99 }
100 dest->gr_gid = src->gr_gid;
101
102 if (src->gr_mem != NULL) {
103 members_num = 0;
104 for (cp = src->gr_mem; *cp; ++cp)
105 ++members_num;
106
108 dest->gr_mem = (char **)malloc(
109 (members_num + 1) * (sizeof(char *)));
110 assert(dest->gr_mem != NULL);
111 memset(dest->gr_mem, 0, (members_num+1) * (sizeof(char *)));
107 dest->gr_mem = calloc(1, (members_num + 1) * sizeof(char *));
108 ATF_REQUIRE(dest->gr_mem != NULL);
112
113 for (cp = src->gr_mem; *cp; ++cp) {
114 dest->gr_mem[cp - src->gr_mem] = strdup(*cp);
109
110 for (cp = src->gr_mem; *cp; ++cp) {
111 dest->gr_mem[cp - src->gr_mem] = strdup(*cp);
115 assert(dest->gr_mem[cp - src->gr_mem] != NULL);
112 ATF_REQUIRE(dest->gr_mem[cp - src->gr_mem] != NULL);
116 }
117 }
118}
119
120static void
121free_group(struct group *grp)
122{
123 char **cp;
124
113 }
114 }
115}
116
117static void
118free_group(struct group *grp)
119{
120 char **cp;
121
125 assert(grp != NULL);
122 ATF_REQUIRE(grp != NULL);
126
127 free(grp->gr_name);
128 free(grp->gr_passwd);
129
130 for (cp = grp->gr_mem; *cp; ++cp)
131 free(*cp);
132 free(grp->gr_mem);
133}
134
135static int
136compare_group(struct group *grp1, struct group *grp2, void *mdata)
137{
138 char **c1, **c2;
139
140 if (grp1 == grp2)
141 return (0);
142
123
124 free(grp->gr_name);
125 free(grp->gr_passwd);
126
127 for (cp = grp->gr_mem; *cp; ++cp)
128 free(*cp);
129 free(grp->gr_mem);
130}
131
132static int
133compare_group(struct group *grp1, struct group *grp2, void *mdata)
134{
135 char **c1, **c2;
136
137 if (grp1 == grp2)
138 return (0);
139
143 if ((grp1 == NULL) || (grp2 == NULL))
140 if (grp1 == NULL || grp2 == NULL)
144 goto errfin;
145
141 goto errfin;
142
146 if ((strcmp(grp1->gr_name, grp2->gr_name) != 0) ||
147 (strcmp(grp1->gr_passwd, grp2->gr_passwd) != 0) ||
148 (grp1->gr_gid != grp2->gr_gid))
143 if (strcmp(grp1->gr_name, grp2->gr_name) != 0 ||
144 strcmp(grp1->gr_passwd, grp2->gr_passwd) != 0 ||
145 grp1->gr_gid != grp2->gr_gid)
149 goto errfin;
150
151 c1 = grp1->gr_mem;
152 c2 = grp2->gr_mem;
153
146 goto errfin;
147
148 c1 = grp1->gr_mem;
149 c2 = grp2->gr_mem;
150
154 if ((grp1->gr_mem == NULL) || (grp2->gr_mem == NULL))
151 if (grp1->gr_mem == NULL || grp2->gr_mem == NULL)
155 goto errfin;
156
152 goto errfin;
153
157 for (;*c1 && *c2; ++c1, ++c2)
154 for (; *c1 && *c2; ++c1, ++c2)
158 if (strcmp(*c1, *c2) != 0)
159 goto errfin;
160
155 if (strcmp(*c1, *c2) != 0)
156 goto errfin;
157
161 if ((*c1 != '\0') || (*c2 != '\0'))
158 if (*c1 != '\0' || *c2 != '\0')
162 goto errfin;
163
164 return 0;
165
166errfin:
159 goto errfin;
160
161 return 0;
162
163errfin:
167 if ((debug) && (mdata == NULL)) {
164 if (mdata == NULL) {
168 printf("following structures are not equal:\n");
169 dump_group(grp1);
170 dump_group(grp2);
171 }
172
173 return (-1);
174}
175

--- 30 unchanged lines hidden (view full) ---

206
207static int
208group_read_snapshot_func(struct group *grp, char *line)
209{
210 StringList *sl;
211 char *s, *ps, *ts;
212 int i;
213
165 printf("following structures are not equal:\n");
166 dump_group(grp1);
167 dump_group(grp2);
168 }
169
170 return (-1);
171}
172

--- 30 unchanged lines hidden (view full) ---

203
204static int
205group_read_snapshot_func(struct group *grp, char *line)
206{
207 StringList *sl;
208 char *s, *ps, *ts;
209 int i;
210
214 if (debug)
215 printf("1 line read from snapshot:\n%s\n", line);
211 printf("1 line read from snapshot:\n%s\n", line);
216
217 i = 0;
218 sl = NULL;
219 ps = line;
220 memset(grp, 0, sizeof(struct group));
212
213 i = 0;
214 sl = NULL;
215 ps = line;
216 memset(grp, 0, sizeof(struct group));
221 while ( (s = strsep(&ps, " ")) != NULL) {
217 while ((s = strsep(&ps, " ")) != NULL) {
222 switch (i) {
218 switch (i) {
223 case 0:
224 grp->gr_name = strdup(s);
225 assert(grp->gr_name != NULL);
219 case 0:
220 grp->gr_name = strdup(s);
221 ATF_REQUIRE(grp->gr_name != NULL);
226 break;
227
222 break;
223
228 case 1:
229 grp->gr_passwd = strdup(s);
230 assert(grp->gr_passwd != NULL);
224 case 1:
225 grp->gr_passwd = strdup(s);
226 ATF_REQUIRE(grp->gr_passwd != NULL);
231 break;
232
227 break;
228
233 case 2:
234 grp->gr_gid = (gid_t)strtol(s, &ts, 10);
235 if (*ts != '\0') {
236 free(grp->gr_name);
237 free(grp->gr_passwd);
238 return (-1);
239 }
229 case 2:
230 grp->gr_gid = (gid_t)strtol(s, &ts, 10);
231 if (*ts != '\0') {
232 free(grp->gr_name);
233 free(grp->gr_passwd);
234 grp->gr_name = NULL;
235 grp->gr_passwd = NULL;
236 return (-1);
237 }
240 break;
241
238 break;
239
242 default:
243 if (sl == NULL) {
244 if (strcmp(s, "(null)") == 0)
245 return (0);
240 default:
241 if (sl == NULL) {
242 if (strcmp(s, "(null)") == 0)
243 return (0);
246
244
247 sl = sl_init();
248 assert(sl != NULL);
245 sl = sl_init();
246 ATF_REQUIRE(sl != NULL);
249
247
250 if (strcmp(s, "nomem") != 0) {
251 ts = strdup(s);
252 assert(ts != NULL);
253 sl_add(sl, ts);
254 }
255 } else {
248 if (strcmp(s, "nomem") != 0) {
256 ts = strdup(s);
249 ts = strdup(s);
257 assert(ts != NULL);
250 ATF_REQUIRE(ts != NULL);
258 sl_add(sl, ts);
259 }
251 sl_add(sl, ts);
252 }
253 } else {
254 ts = strdup(s);
255 ATF_REQUIRE(ts != NULL);
256 sl_add(sl, ts);
257 }
260 break;
258 break;
261 };
259 }
262 ++i;
263 }
264
265 if (i < 3) {
266 free(grp->gr_name);
267 free(grp->gr_passwd);
268 memset(grp, 0, sizeof(struct group));
269 return (-1);

--- 33 unchanged lines hidden (view full) ---

303 endgrent();
304
305 return (0);
306}
307
308static int
309group_test_correctness(struct group *grp, void *mdata)
310{
260 ++i;
261 }
262
263 if (i < 3) {
264 free(grp->gr_name);
265 free(grp->gr_passwd);
266 memset(grp, 0, sizeof(struct group));
267 return (-1);

--- 33 unchanged lines hidden (view full) ---

301 endgrent();
302
303 return (0);
304}
305
306static int
307group_test_correctness(struct group *grp, void *mdata)
308{
311 if (debug) {
312 printf("testing correctness with the following data:\n");
313 dump_group(grp);
314 }
309 printf("testing correctness with the following data:\n");
310 dump_group(grp);
315
316 if (grp == NULL)
317 goto errfin;
318
319 if (grp->gr_name == NULL)
320 goto errfin;
321
322 if (grp->gr_passwd == NULL)
323 goto errfin;
324
325 if (grp->gr_mem == NULL)
326 goto errfin;
327
311
312 if (grp == NULL)
313 goto errfin;
314
315 if (grp->gr_name == NULL)
316 goto errfin;
317
318 if (grp->gr_passwd == NULL)
319 goto errfin;
320
321 if (grp->gr_mem == NULL)
322 goto errfin;
323
328 if (debug)
329 printf("correct\n");
324 printf("correct\n");
330
331 return (0);
332errfin:
325
326 return (0);
327errfin:
333 if (debug)
334 printf("incorrect\n");
328 printf("incorrect\n");
335
336 return (-1);
337}
338
339/* group_check_ambiguity() is needed here because when doing the getgrent()
340 * calls sequence, records from different nsswitch sources can be different,
341 * though having the same pw_name/pw_uid */
342static int

--- 4 unchanged lines hidden (view full) ---

347 NULL) != NULL ? 0 : -1);
348}
349
350static int
351group_test_getgrnam(struct group *grp_model, void *mdata)
352{
353 struct group *grp;
354
329
330 return (-1);
331}
332
333/* group_check_ambiguity() is needed here because when doing the getgrent()
334 * calls sequence, records from different nsswitch sources can be different,
335 * though having the same pw_name/pw_uid */
336static int

--- 4 unchanged lines hidden (view full) ---

341 NULL) != NULL ? 0 : -1);
342}
343
344static int
345group_test_getgrnam(struct group *grp_model, void *mdata)
346{
347 struct group *grp;
348
355 if (debug) {
356 printf("testing getgrnam() with the following data:\n");
357 dump_group(grp_model);
358 }
349 printf("testing getgrnam() with the following data:\n");
350 dump_group(grp_model);
359
360 grp = getgrnam(grp_model->gr_name);
361 if (group_test_correctness(grp, NULL) != 0)
362 goto errfin;
363
351
352 grp = getgrnam(grp_model->gr_name);
353 if (group_test_correctness(grp, NULL) != 0)
354 goto errfin;
355
364 if ((compare_group(grp, grp_model, NULL) != 0) &&
365 (group_check_ambiguity((struct group_test_data *)mdata, grp)
366 !=0))
356 if (compare_group(grp, grp_model, NULL) != 0 &&
357 group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)
367 goto errfin;
368
358 goto errfin;
359
369 if (debug)
370 printf("ok\n");
371 return (0);
372
373errfin:
360 return (0);
361
362errfin:
374 if (debug)
375 printf("not ok\n");
376
377 return (-1);
378}
379
380static int
381group_test_getgrgid(struct group *grp_model, void *mdata)
382{
383 struct group *grp;
384
363 return (-1);
364}
365
366static int
367group_test_getgrgid(struct group *grp_model, void *mdata)
368{
369 struct group *grp;
370
385 if (debug) {
386 printf("testing getgrgid() with the following data...\n");
387 dump_group(grp_model);
388 }
371 printf("testing getgrgid() with the following data...\n");
372 dump_group(grp_model);
389
390 grp = getgrgid(grp_model->gr_gid);
373
374 grp = getgrgid(grp_model->gr_gid);
391 if ((group_test_correctness(grp, NULL) != 0) ||
392 ((compare_group(grp, grp_model, NULL) != 0) &&
393 (group_check_ambiguity((struct group_test_data *)mdata, grp)
394 != 0))) {
395 if (debug)
396 printf("not ok\n");
397 return (-1);
375 if (group_test_correctness(grp, NULL) != 0 ||
376 (compare_group(grp, grp_model, NULL) != 0 &&
377 group_check_ambiguity((struct group_test_data *)mdata, grp) != 0)) {
378 return (-1);
398 } else {
379 } else {
399 if (debug)
400 printf("ok\n");
401 return (0);
380 return (0);
402 }
403}
404
405static int
406group_test_getgrent(struct group *grp, void *mdata)
407{
408 /* Only correctness can be checked when doing 1-pass test for
409 * getgrent(). */
410 return (group_test_correctness(grp, NULL));
411}
412
381 }
382}
383
384static int
385group_test_getgrent(struct group *grp, void *mdata)
386{
387 /* Only correctness can be checked when doing 1-pass test for
388 * getgrent(). */
389 return (group_test_correctness(grp, NULL));
390}
391
413static void
414usage(void)
392static int
393run_tests(const char *snapshot_file, enum test_methods method)
415{
394{
416 (void)fprintf(stderr,
417 "Usage: %s -nge2 [-d] [-s <file>]\n",
418 getprogname());
419 exit(1);
420}
421
422int
423main(int argc, char **argv)
424{
425 struct group_test_data td, td_snap, td_2pass;
395 struct group_test_data td, td_snap, td_2pass;
426 char *snapshot_file;
427 int rv;
396 int rv;
428 int c;
429
397
430 if (argc < 2)
431 usage();
432
433 snapshot_file = NULL;
434 while ((c = getopt(argc, argv, "nge2ds:")) != -1)
435 switch (c) {
436 case 'd':
437 debug++;
438 break;
439 case 'n':
440 method = TEST_GETGRNAM;
441 break;
442 case 'g':
443 method = TEST_GETGRGID;
444 break;
445 case 'e':
446 method = TEST_GETGRENT;
447 break;
448 case '2':
449 method = TEST_GETGRENT_2PASS;
450 break;
451 case 's':
452 snapshot_file = strdup(optarg);
453 break;
454 default:
455 usage();
456 }
457
458 TEST_DATA_INIT(group, &td, clone_group, free_group);
459 TEST_DATA_INIT(group, &td_snap, clone_group, free_group);
460 if (snapshot_file != NULL) {
461 if (access(snapshot_file, W_OK | R_OK) != 0) {
462 if (errno == ENOENT)
463 method = TEST_BUILD_SNAPSHOT;
464 else {
398 TEST_DATA_INIT(group, &td, clone_group, free_group);
399 TEST_DATA_INIT(group, &td_snap, clone_group, free_group);
400 if (snapshot_file != NULL) {
401 if (access(snapshot_file, W_OK | R_OK) != 0) {
402 if (errno == ENOENT)
403 method = TEST_BUILD_SNAPSHOT;
404 else {
465 if (debug)
466 printf("can't access the file %s\n",
467 snapshot_file);
405 printf("can't access the file %s\n",
406 snapshot_file);
468
469 rv = -1;
470 goto fin;
471 }
472 } else {
473 if (method == TEST_BUILD_SNAPSHOT) {
474 rv = 0;
475 goto fin;

--- 37 unchanged lines hidden (view full) ---

513 rv = group_fill_test_data(&td_2pass);
514 if (rv != -1)
515 rv = DO_2PASS_TEST(group, &td, &td_2pass,
516 compare_group, NULL);
517 TEST_DATA_DESTROY(group, &td_2pass);
518 break;
519 case TEST_BUILD_SNAPSHOT:
520 if (snapshot_file != NULL)
407
408 rv = -1;
409 goto fin;
410 }
411 } else {
412 if (method == TEST_BUILD_SNAPSHOT) {
413 rv = 0;
414 goto fin;

--- 37 unchanged lines hidden (view full) ---

452 rv = group_fill_test_data(&td_2pass);
453 if (rv != -1)
454 rv = DO_2PASS_TEST(group, &td, &td_2pass,
455 compare_group, NULL);
456 TEST_DATA_DESTROY(group, &td_2pass);
457 break;
458 case TEST_BUILD_SNAPSHOT:
459 if (snapshot_file != NULL)
521 rv = TEST_SNAPSHOT_FILE_WRITE(group, snapshot_file, &td,
522 sdump_group);
460 rv = TEST_SNAPSHOT_FILE_WRITE(group, snapshot_file, &td,
461 sdump_group);
523 break;
524 default:
525 rv = 0;
526 break;
462 break;
463 default:
464 rv = 0;
465 break;
527 };
466 }
528
529fin:
530 TEST_DATA_DESTROY(group, &td_snap);
531 TEST_DATA_DESTROY(group, &td);
467
468fin:
469 TEST_DATA_DESTROY(group, &td_snap);
470 TEST_DATA_DESTROY(group, &td);
532 free(snapshot_file);
471
533 return (rv);
534}
472 return (rv);
473}
474
475#define SNAPSHOT_FILE "snapshot_grp"
476
477ATF_TC_BODY(getgrent, tc)
478{
479
480 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT) == 0);
481}
482
483ATF_TC_WITHOUT_HEAD(getgrent_with_snapshot);
484ATF_TC_BODY(getgrent_with_snapshot, tc)
485{
486
487 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0);
488 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT) == 0);
489}
490
491ATF_TC_WITHOUT_HEAD(getgrent_with_two_pass);
492ATF_TC_BODY(getgrent_with_two_pass, tc)
493{
494
495 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRENT_2PASS) == 0);
496}
497
498ATF_TC_WITHOUT_HEAD(getgrgid);
499ATF_TC_BODY(getgrgid, tc)
500{
501
502 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRGID) == 0);
503}
504
505ATF_TC_WITHOUT_HEAD(getgrgid_with_snapshot);
506ATF_TC_BODY(getgrgid_with_snapshot, tc)
507{
508
509 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0);
510 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRGID) == 0);
511}
512
513ATF_TC_WITHOUT_HEAD(getgrnam);
514ATF_TC_BODY(getgrnam, tc)
515{
516
517 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0);
518}
519
520ATF_TC_WITHOUT_HEAD(getgrnam_with_snapshot);
521ATF_TC_BODY(getgrnam_with_snapshot, tc)
522{
523
524 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_BUILD_SNAPSHOT) == 0);
525 ATF_REQUIRE(run_tests(SNAPSHOT_FILE, TEST_GETGRNAM) == 0);
526}
527
528ATF_TC_WITHOUT_HEAD(getgrent);
529ATF_TP_ADD_TCS(tp)
530{
531
532 ATF_TP_ADD_TC(tp, getgrent);
533 ATF_TP_ADD_TC(tp, getgrent_with_snapshot);
534 ATF_TP_ADD_TC(tp, getgrent_with_two_pass);
535 ATF_TP_ADD_TC(tp, getgrgid);
536 ATF_TP_ADD_TC(tp, getgrgid_with_snapshot);
537 ATF_TP_ADD_TC(tp, getgrnam);
538 ATF_TP_ADD_TC(tp, getgrnam_with_snapshot);
539
540 return (atf_no_error());
541}