Commit updates accepted upstream (NetBSD)
This commit is contained in:
parent
ee20625063
commit
40aebef6ad
34
dist/lib/libc/gen/t_dir.c
vendored
34
dist/lib/libc/gen/t_dir.c
vendored
@ -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.
|
||||
@ -57,7 +57,7 @@ ATF_TC_BODY(seekdir_basic, tc)
|
||||
|
||||
#define CREAT(x, m) do { \
|
||||
int _creat_fd; \
|
||||
ATF_REQUIRE_MSG((_creat_fd = creat((x), (m)) != -1), \
|
||||
ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))) != -1, \
|
||||
"creat(%s, %x) failed: %s", (x), (m), \
|
||||
strerror(errno)); \
|
||||
(void)close(_creat_fd); \
|
||||
@ -75,29 +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);
|
||||
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");
|
||||
|
||||
@ -105,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");
|
||||
|
||||
|
5
dist/lib/libc/string/t_memcpy.c
vendored
5
dist/lib/libc/string/t_memcpy.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_memcpy.c,v 1.5 2013/03/17 02:23:31 christos Exp $ */
|
||||
/* $NetBSD: t_memcpy.c,v 1.6 2017/01/11 18:05:54 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -96,7 +96,8 @@ ATF_TC_BODY(memcpy_basic, tc)
|
||||
if (i != j)
|
||||
runTest(start[i], start[j]);
|
||||
MD5End(mc, result);
|
||||
ATF_REQUIRE_EQ(strcmp(result, goodResult), 0);
|
||||
ATF_REQUIRE_EQ_MSG(strcmp(result, goodResult), 0, "%s != %s",
|
||||
result, goodResult);
|
||||
}
|
||||
|
||||
ATF_TC(memccpy_simple);
|
||||
|
5
dist/lib/libc/string/t_memmem.c
vendored
5
dist/lib/libc/string/t_memmem.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: t_memmem.c,v 1.2 2011/07/07 08:27:36 jruoho Exp $ */
|
||||
/* $NetBSD: t_memmem.c,v 1.3 2017/01/11 18:07:37 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005 The NetBSD Foundation, Inc.
|
||||
@ -51,6 +51,8 @@ char p6[] = "9";
|
||||
int lp6 = 1;
|
||||
char p7[] = "654";
|
||||
int lp7 = 3;
|
||||
char p8[] = "89abc";
|
||||
int lp8 = 5;
|
||||
|
||||
char b0[] = "";
|
||||
int lb0 = 0;
|
||||
@ -89,6 +91,7 @@ ATF_TC_BODY(memmem_basic, tc)
|
||||
|
||||
expect(memmem(b2, lb2, p4, lp4) == NULL);
|
||||
expect(memmem(b2, lb2, p7, lp7) == NULL);
|
||||
expect(memmem(b2, lb2, p8, lp8) == NULL);
|
||||
}
|
||||
|
||||
ATF_TP_ADD_TCS(tp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user