summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/netbsd-tests/lib/libc')
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_dir.c31
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_raise.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_sethostname.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/regex/debug.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_select.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_unlink.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c8
8 files changed, 52 insertions, 12 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_dir.c b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
index 81412c1..b37d89d 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_dir.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_dir.c
@@ -39,6 +39,10 @@
#include <sys/stat.h>
+#ifdef __FreeBSD__
+#include <errno.h>
+#endif
+
ATF_TC(seekdir_basic);
ATF_TC_HEAD(seekdir_basic, tc)
{
@@ -54,10 +58,26 @@ ATF_TC_BODY(seekdir_basic, tc)
struct dirent *entry;
long here;
+#ifdef __FreeBSD__
+#define CREAT(x, m) do { \
+ int _creat_fd; \
+ ATF_REQUIRE_MSG((_creat_fd = creat((x), (m))) != -1, \
+ "creat(%s, %x) failed: %s", (x), (m), \
+ strerror(errno)); \
+ (void)close(_creat_fd); \
+ } while(0);
+
+ ATF_REQUIRE_MSG(mkdir("t", 0755) == 0,
+ "mkdir failed: %s", strerror(errno));
+ CREAT("t/a", 0600);
+ CREAT("t/b", 0600);
+ CREAT("t/c", 0600);
+#else
mkdir("t", 0755);
creat("t/a", 0600);
creat("t/b", 0600);
creat("t/c", 0600);
+#endif
dp = opendir("t");
if ( dp == NULL)
@@ -70,9 +90,17 @@ ATF_TC_BODY(seekdir_basic, tc)
/* get first entry */
entry = readdir(dp);
here = telldir(dp);
+#ifdef __FreeBSD__
+ ATF_REQUIRE_MSG(here != -1,
+ "telldir failed: %s", strerror(errno));
+#endif
/* get second entry */
entry = readdir(dp);
+#ifdef __FreeBSD__
+ ATF_REQUIRE_MSG(entry != NULL,
+ "readdir failed: %s", strerror(errno));
+#endif
wasname = strdup(entry->d_name);
if (wasname == NULL)
atf_tc_fail("cannot allocate memory");
@@ -109,6 +137,9 @@ ATF_TC_BODY(seekdir_basic, tc)
atf_tc_fail("3rd seekdir found wrong name");
closedir(dp);
+#ifdef __FreeBSD__
+ free(wasname);
+#endif
}
ATF_TC(telldir_leak);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_raise.c b/contrib/netbsd-tests/lib/libc/gen/t_raise.c
index d6f888f..91a8c37 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_raise.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_raise.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_raise.c,v 1.5 2011/05/10 12:43:42 jruoho Exp $ */
+/* $NetBSD: t_raise.c,v 1.6 2016/11/03 22:08:31 kamil Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_raise.c,v 1.5 2011/05/10 12:43:42 jruoho Exp $");
+__RCSID("$NetBSD: t_raise.c,v 1.6 2016/11/03 22:08:31 kamil Exp $");
#include <atf-c.h>
@@ -180,7 +180,7 @@ ATF_TC_BODY(raise_stress, tc)
(void)raise(SIGUSR1);
if (count != maxiter)
- atf_tc_fail("not all signals were catched");
+ atf_tc_fail("not all signals were caught");
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c b/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c
index f51eb2a..02dd176 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_setdomainname.c
@@ -64,7 +64,7 @@ ATF_TC_BODY(setdomainname_basic, tc)
(void)memset(name, 0, sizeof(name));
#ifdef __FreeBSD__
- /*
+ /*
* Sanity checks to ensure that the wrong invariant isn't being
* tested for per PR # 181127
*/
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c b/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
index 1972f7d..136fa7c 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_sethostname.c
@@ -66,7 +66,7 @@ ATF_TC_BODY(sethostname_basic, tc)
(void)memset(name, 0, sizeof(name));
#ifdef __FreeBSD__
- /*
+ /*
* Sanity checks to ensure that the wrong invariant isn't being
* tested for per PR # 181127
*/
diff --git a/contrib/netbsd-tests/lib/libc/regex/debug.c b/contrib/netbsd-tests/lib/libc/regex/debug.c
index 3fc6d5b..22f0b90 100644
--- a/contrib/netbsd-tests/lib/libc/regex/debug.c
+++ b/contrib/netbsd-tests/lib/libc/regex/debug.c
@@ -48,9 +48,7 @@
#ifdef __NetBSD__
static void s_print(struct re_guts *, FILE *);
static char *regchar(int);
-#endif
-#ifdef __NetBSD__
/*
* regprint - print a regexp for debugging
*/
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_select.c b/contrib/netbsd-tests/lib/libc/sys/t_select.c
index 7af725a..437b67b 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_select.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_select.c
@@ -135,6 +135,9 @@ child(const struct timespec *ts)
"after timeout %s != %s",
prmask(&nset, nbuf, sizeof(nbuf)),
prmask(&oset, obuf, sizeof(obuf)));
+#ifdef __FreeBSD__
+ _exit(0);
+#endif
}
ATF_TC(pselect_sigmask);
@@ -154,6 +157,9 @@ ATF_TC_BODY(pselect_sigmask, tc)
switch (pid = fork()) {
case 0:
child(NULL);
+#ifdef __FreeBSD__
+ break;
+#endif
case -1:
err(1, "fork");
default:
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
index 8d94668..b504bb0 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_unlink.c
@@ -111,8 +111,15 @@ ATF_TC_HEAD(unlink_fifo, tc)
ATF_TC_BODY(unlink_fifo, tc)
{
+#ifdef __FreeBSD__
+ int fd;
+ ATF_REQUIRE_MSG((fd = mkfifo(path, 0666)) == 0,
+ "mkfifo failed: %s", strerror(errno));
+ (void)close(fd);
+#else
ATF_REQUIRE(mkfifo(path, 0666) == 0);
+#endif
ATF_REQUIRE(unlink(path) == 0);
errno = 0;
diff --git a/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c b/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
index 1e42536..7f60d78 100644
--- a/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
+++ b/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ttyio.c,v 1.2 2011/04/19 20:07:53 martin Exp $ */
+/* $NetBSD: t_ttyio.c,v 1.3 2017/01/10 01:31:40 christos Exp $ */
/*
* Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_ttyio.c,v 1.2 2011/04/19 20:07:53 martin Exp $");
+__RCSID("$NetBSD: t_ttyio.c,v 1.3 2017/01/10 01:31:40 christos Exp $");
#include <sys/types.h>
#include <sys/wait.h>
@@ -150,11 +150,9 @@ ATF_TC_BODY(ioctl, tc)
/* wait for last child */
sa.sa_handler = SIG_DFL;
REQUIRE_ERRNO(sigaction(SIGCHLD, &sa, NULL), -1);
- (void) wait(NULL);
+ (void)wait(NULL);
-#ifdef __FreeBSD__
(void)close(s);
-#endif
ATF_REQUIRE_EQ(rc, 0);
}
OpenPOWER on IntegriCloud