summaryrefslogtreecommitdiffstats
path: root/contrib/netbsd-tests
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-01-09 12:11:05 -0200
committerRenato Botelho <renato@netgate.com>2017-01-09 12:11:05 -0200
commit681a482d8fc4bfc14a24f7a9d75cca6337f2a520 (patch)
tree08368e0c4dcea4baa16f4a34b2cc104c42e1ed27 /contrib/netbsd-tests
parentcbeab2a9b6b7ac70992175202f35fcc05a5821d5 (diff)
parent91f6edbb8913d163d5c16fb615e84baf8a16d390 (diff)
downloadFreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.zip
FreeBSD-src-681a482d8fc4bfc14a24f7a9d75cca6337f2a520.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'contrib/netbsd-tests')
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fexecve.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mknodat.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ftok.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ttyname.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strchr.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strlen.c11
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_kevent.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_listen.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mincore.c18
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_pipe.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_revoke.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_stat.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_umask.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c3
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_swapcontext.c12
17 files changed, 89 insertions, 3 deletions
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c b/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
index d557b00..30b26a7 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c
@@ -70,6 +70,9 @@ ATF_TC_BODY(fexecve, tc)
error = 76;
else
error = EXIT_FAILURE;
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
err(error, "fexecve");
}
}
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
index 1ae023c..3736dfa 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
@@ -63,6 +63,9 @@ ATF_TC_BODY(mkfifoat_fd, tc)
ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(access(FIFO, F_OK) == 0);
+#ifdef __FreeBSD__
+ (void)close(dfd);
+#endif
}
ATF_TC(mkfifoat_fdcwd);
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c b/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
index b04a159..e8f71cd 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c
@@ -80,6 +80,9 @@ ATF_TC_BODY(mknodat_fd, tc)
ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(access(FILE, F_OK) == 0);
+#ifdef __FreeBSD__
+ (void)close(dfd);
+#endif
}
ATF_TC(mknodat_fdcwd);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_ftok.c b/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
index 100bd1b..718d310 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_ftok.c
@@ -68,6 +68,9 @@ ATF_TC_BODY(ftok_link, tc)
fd = open(path, O_RDONLY | O_CREAT);
ATF_REQUIRE(fd >= 0);
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
ATF_REQUIRE(link(path, hlnk) == 0);
ATF_REQUIRE(symlink(path, slnk) == 0);
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
index 0c10c24..1c813fb 100644
--- a/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
+++ b/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c
@@ -78,6 +78,9 @@ ATF_TC_BODY(ttyname_err, tc)
ATF_REQUIRE(ttyname(fd) == NULL);
ATF_REQUIRE(errno == ENOTTY);
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
}
}
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strchr.c b/contrib/netbsd-tests/lib/libc/string/t_strchr.c
index 958b186..4556b2c 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strchr.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strchr.c
@@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc)
ATF_TC_BODY(strchr_basic, tc)
{
+#ifdef __FreeBSD__
+ void *dl_handle;
+#endif
unsigned int t, a;
char *off;
char buf[32];
@@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc)
"abcdefgh/abcdefgh/",
};
-
+#ifdef __FreeBSD__
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strchr_fn = dlsym(dl_handle, "test_strlen");
+#else
strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr");
+#endif
if (!strchr_fn)
strchr_fn = strchr;
@@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc)
verify_strchr(buf + a, 0xff, t, a);
}
}
+#ifdef __FreeBSD__
+ (void)dlclose(dl_handle);
+#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/string/t_strlen.c b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
index 66158fd..7483dc6 100644
--- a/contrib/netbsd-tests/lib/libc/string/t_strlen.c
+++ b/contrib/netbsd-tests/lib/libc/string/t_strlen.c
@@ -40,6 +40,9 @@ ATF_TC_HEAD(strlen_basic, tc)
ATF_TC_BODY(strlen_basic, tc)
{
+#ifdef __FreeBSD__
+ void *dl_handle;
+#endif
/* try to trick the compiler */
size_t (*strlen_fn)(const char *);
@@ -107,7 +110,12 @@ ATF_TC_BODY(strlen_basic, tc)
* During testing it is useful have the rest of the program
* use a known good version!
*/
+#ifdef __FreeBSD__
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strlen_fn = dlsym(dl_handle, "test_strlen");
+#else
strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen");
+#endif
if (!strlen_fn)
strlen_fn = strlen;
@@ -134,6 +142,9 @@ ATF_TC_BODY(strlen_basic, tc)
}
}
}
+#ifdef __FreeBSD__
+ (void)dlclose(dl_handle);
+#endif
}
ATF_TC(strlen_huge);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
index fe298c5..c2fef44 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_kevent.c
@@ -101,6 +101,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc)
m.msg_namelen = 0;
m.msg_control = msg;
m.msg_controllen = CMSG_SPACE(sizeof(int));
+#ifdef __FreeBSD__
+ m.msg_flags = 0;
+#endif
child = fork();
if (child == 0) {
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_listen.c b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
index d7c7d9e..a9ee733 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_listen.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_listen.c
@@ -110,6 +110,9 @@ ATF_TC_BODY(listen_low_port, tc)
int sd, val;
sd = socket(AF_INET, SOCK_STREAM, 0);
+#ifdef __FreeBSD__
+ ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
+#endif
val = IP_PORTRANGE_LOW;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
index 872856e..c31170f 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_mincore.c
@@ -144,6 +144,9 @@ ATF_TC_WITH_CLEANUP(mincore_resid);
ATF_TC_HEAD(mincore_resid, tc)
{
atf_tc_set_md_var(tc, "descr", "Test page residency with mincore(2)");
+#ifdef __FreeBSD__
+ atf_tc_set_md_var(tc, "require.user", "root");
+#endif
}
ATF_TC_BODY(mincore_resid, tc)
@@ -155,6 +158,13 @@ ATF_TC_BODY(mincore_resid, tc)
struct rlimit rlim;
ATF_REQUIRE(getrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
+#ifdef __FreeBSD__
+ /*
+ * Bump the mlock limit to unlimited so the rest of the testcase
+ * passes instead of failing on the mlock call.
+ */
+ rlim.rlim_max = RLIM_INFINITY;
+#endif
rlim.rlim_cur = rlim.rlim_max;
ATF_REQUIRE(setrlimit(RLIMIT_MEMLOCK, &rlim) == 0);
@@ -206,8 +216,9 @@ ATF_TC_BODY(mincore_resid, tc)
"might be low on memory");
#ifdef __FreeBSD__
- ATF_REQUIRE_MSG(mlock(addr, npgs * page) == 0, "mlock failed: %s",
- strerror(errno));
+ if (mlock(addr, npgs * page) == -1 && errno != ENOMEM)
+ atf_tc_skip("could not wire anonymous test area, system might "
+ "be low on memory");
#endif
ATF_REQUIRE(check_residency(addr, npgs) == npgs);
ATF_REQUIRE(munmap(addr, npgs * page) == 0);
@@ -268,6 +279,9 @@ ATF_TC_BODY(mincore_resid, tc)
(void)munmap(addr2, npgs * page);
(void)munmap(addr3, npgs * page);
(void)unlink(path);
+#ifdef __FreeBSD__
+ free(buf);
+#endif
}
ATF_TC_CLEANUP(mincore_resid, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
index b30b94d..32beecc 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe.c
@@ -153,6 +153,9 @@ ATF_TC_BODY(pipe_restart, tc)
ATF_REQUIRE_EQ(WEXITSTATUS(st), 0);
}
+#ifdef __FreeBSD__
+ free(f);
+#endif
}
ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
index 926d2740..8e4c2a3 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_revoke.c
@@ -176,6 +176,9 @@ ATF_TC_BODY(revoke_perm, tc)
if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS)
atf_tc_fail("revoke(2) did not obey permissions");
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
ATF_REQUIRE(unlink(path) == 0);
}
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
index 72175e4..4b21860 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c
@@ -124,6 +124,9 @@ out:
if (lim != 0)
atf_tc_fail("failed to set limit (%d)", lim);
+#ifdef __FreeBSD__
+ free(buf);
+#endif
}
ATF_TC(setrlimit_current);
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_stat.c b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
index 5e1d17e..300c6e8 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_stat.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_stat.c
@@ -398,6 +398,9 @@ ATF_TC_BODY(stat_symlink, tc)
ATF_REQUIRE(unlink(path) == 0);
ATF_REQUIRE(unlink(pathlink) == 0);
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
}
ATF_TC_CLEANUP(stat_symlink, tc)
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_umask.c b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
index 748cbdc..7a65574 100644
--- a/contrib/netbsd-tests/lib/libc/sys/t_umask.c
+++ b/contrib/netbsd-tests/lib/libc/sys/t_umask.c
@@ -129,6 +129,9 @@ ATF_TC_BODY(umask_open, tc)
if (fd < 0)
continue;
+#ifdef __FreeBSD__
+ (void)close(fd);
+#endif
(void)memset(&st, 0, sizeof(struct stat));
if (stat(path, &st) != 0) {
diff --git a/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c b/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
index 5a5ec0f..1e42536 100644
--- a/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
+++ b/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c
@@ -152,6 +152,9 @@ ATF_TC_BODY(ioctl, tc)
REQUIRE_ERRNO(sigaction(SIGCHLD, &sa, NULL), -1);
(void) wait(NULL);
+#ifdef __FreeBSD__
+ (void)close(s);
+#endif
ATF_REQUIRE_EQ(rc, 0);
}
diff --git a/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c b/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
index c0c375f..a18ac2f 100644
--- a/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
+++ b/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c
@@ -30,6 +30,8 @@ __RCSID("$NetBSD");
#ifdef __FreeBSD__
#include <sys/types.h>
+#include <errno.h>
+#include <string.h>
#endif
#include <pthread.h>
#include <ucontext.h>
@@ -80,7 +82,12 @@ threadfunc(void *arg)
oself = (void *)pthread_self();
printf("before swapcontext self = %p\n", oself);
+#ifdef __FreeBSD__
+ ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s",
+ strerror(errno));
+#else
PTHREAD_REQUIRE(swapcontext(&octx, &nctx));
+#endif
/* NOTREACHED */
return NULL;
@@ -102,7 +109,12 @@ ATF_TC_BODY(swapcontext1, tc)
printf("Testing if swapcontext() alters pthread_self()\n");
+#ifdef __FreeBSD__
+ ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s",
+ strerror(errno));
+#else
PTHREAD_REQUIRE(getcontext(&nctx));
+#endif
PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL));
PTHREAD_REQUIRE(pthread_join(thread, NULL));
}
OpenPOWER on IntegriCloud