summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc/gen/t_dir.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-23 06:37:07 -0300
committerRenato Botelho <renato@netgate.com>2017-02-23 06:37:07 -0300
commit4ef888db25896b2295f521c736ef04aa2e5e64ec (patch)
tree3fcc00dda536bd32ae85bc09f21be4081d32bad5 /contrib/netbsd-tests/lib/libc/gen/t_dir.c
parent272ffd7c3e4e5e27910eb918e2e36556f2a8ec3a (diff)
parentaf015c5bcac0e333adeec07eff0698bad3b91e95 (diff)
downloadFreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.zip
FreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.tar.gz
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen/t_dir.c')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_dir.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_dir.c b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
index c058738..362692f 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_dir.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dir.c,v 1.8 2017/01/11 07:26:17 christos Exp $ */
+/* $NetBSD: t_dir.c,v 1.10 2017/01/11 18:15:02 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -75,33 +75,40 @@ ATF_TC_BODY(seekdir_basic, tc)
/* skip two for . and .. */
entry = readdir(dp);
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ ".", strerror(errno));
+
entry = readdir(dp);
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "..", strerror(errno));
/* get first entry */
entry = readdir(dp);
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "first", strerror(errno));
+
here = telldir(dp);
- ATF_REQUIRE_MSG(here != -1,
- "telldir failed: %s", strerror(errno));
+ ATF_REQUIRE_MSG(here != -1, "telldir failed: %s", strerror(errno));
/* get second entry */
entry = readdir(dp);
-#ifdef __FreeBSD__
- ATF_REQUIRE_MSG(entry != NULL,
- "readdir failed: %s", strerror(errno));
-#endif
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "second", strerror(errno));
+
wasname = strdup(entry->d_name);
if (wasname == NULL)
atf_tc_fail("cannot allocate memory");
/* get third entry */
entry = readdir(dp);
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "third", strerror(errno));
/* try to return to the position after the first entry */
seekdir(dp, here);
entry = readdir(dp);
-
- if (entry == NULL)
- atf_tc_fail("entry 1 not found");
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "first[1]", strerror(errno));
if (strcmp(entry->d_name, wasname) != 0)
atf_tc_fail("1st seekdir found wrong name");
@@ -109,18 +116,17 @@ ATF_TC_BODY(seekdir_basic, tc)
seekdir(dp, here);
here = telldir(dp);
entry = readdir(dp);
-
- if (entry == NULL)
- atf_tc_fail("entry 2 not found");
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "second[1]", strerror(errno));
if (strcmp(entry->d_name, wasname) != 0)
atf_tc_fail("2nd seekdir found wrong name");
/* One more time, to make sure that telldir() doesn't affect result */
seekdir(dp, here);
entry = readdir(dp);
+ ATF_REQUIRE_MSG(entry != NULL, "readdir[%s] failed: %s",
+ "third[1]", strerror(errno));
- if (entry == NULL)
- atf_tc_fail("entry 3 not found");
if (strcmp(entry->d_name, wasname) != 0)
atf_tc_fail("3rd seekdir found wrong name");
OpenPOWER on IntegriCloud