summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2017-01-11 08:15:18 +0000
committerEnji Cooper <ngie@FreeBSD.org>2017-01-11 08:15:18 +0000
commitd87ba4cf3a533294eacc9336a78661813906a740 (patch)
treee034e188c5bcf089d41408989f89e649ec1e320d
parent4023a42882d5f9419fef21524cb32cb410a18ad3 (diff)
downloadsrc-test2-d87ba4cf3a533294eacc9336a78661813906a740.tar.gz
src-test2-d87ba4cf3a533294eacc9336a78661813906a740.zip
Pull in changes from upstream for lib/libc/{c063,gen,string,sys} to address
issues resolved in FreeBSD or support added to testcases In collaboration with: <christos@NetBSD.org>
Notes
Notes: svn path=/vendor/NetBSD/tests/dist/; revision=311922
-rw-r--r--lib/libc/c063/t_faccessat.c7
-rw-r--r--lib/libc/c063/t_fchmodat.c7
-rw-r--r--lib/libc/c063/t_fchownat.c7
-rw-r--r--lib/libc/c063/t_fexecve.c5
-rw-r--r--lib/libc/c063/t_fstatat.c7
-rw-r--r--lib/libc/c063/t_mkfifoat.c5
-rw-r--r--lib/libc/c063/t_mknodat.c5
-rw-r--r--lib/libc/c063/t_o_search.c9
-rw-r--r--lib/libc/c063/t_openat.c7
-rw-r--r--lib/libc/c063/t_readlinkat.c7
-rw-r--r--lib/libc/c063/t_unlinkat.c7
-rw-r--r--lib/libc/c063/t_utimensat.c9
-rw-r--r--lib/libc/gen/posix_spawn/t_fileactions.c7
-rw-r--r--lib/libc/gen/t_assert.c20
-rw-r--r--lib/libc/gen/t_dir.c29
-rw-r--r--lib/libc/gen/t_ftok.c5
-rw-r--r--lib/libc/gen/t_humanize_number.c3
-rw-r--r--lib/libc/gen/t_sleep.c12
-rw-r--r--lib/libc/gen/t_time.c5
-rw-r--r--lib/libc/gen/t_ttyname.c5
-rw-r--r--lib/libc/gen/t_vis.c6
-rw-r--r--lib/libc/string/t_strchr.c10
-rw-r--r--lib/libc/string/t_strerror.c5
-rw-r--r--lib/libc/sys/t_access.c10
-rw-r--r--lib/libc/sys/t_chroot.c5
-rw-r--r--lib/libc/sys/t_mincore.c5
-rw-r--r--lib/libc/sys/t_mmap.c5
-rw-r--r--lib/libc/sys/t_wait.c114
-rw-r--r--lib/libc/t_cdb.c7
29 files changed, 229 insertions, 106 deletions
diff --git a/lib/libc/c063/t_faccessat.c b/lib/libc/c063/t_faccessat.c
index c9e0cc803158..5e6829f7ea45 100644
--- a/lib/libc/c063/t_faccessat.c
+++ b/lib/libc/c063/t_faccessat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_faccessat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/faccessat"
diff --git a/lib/libc/c063/t_fchmodat.c b/lib/libc/c063/t_fchmodat.c
index 462d53d9e961..a7bb6831b86c 100644
--- a/lib/libc/c063/t_fchmodat.c
+++ b/lib/libc/c063/t_fchmodat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_fchmodat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/fchmodat"
diff --git a/lib/libc/c063/t_fchownat.c b/lib/libc/c063/t_fchownat.c
index 80c760683eb9..631d55ac521c 100644
--- a/lib/libc/c063/t_fchownat.c
+++ b/lib/libc/c063/t_fchownat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fchownat.c,v 1.4 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fchownat.c,v 1.4 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -40,7 +42,6 @@ __RCSID("$NetBSD: t_fchownat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
#include <string.h>
#include <unistd.h>
#include <pwd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/fchownat"
diff --git a/lib/libc/c063/t_fexecve.c b/lib/libc/c063/t_fexecve.c
index d557b00d92c2..b9aa0170f885 100644
--- a/lib/libc/c063/t_fexecve.c
+++ b/lib/libc/c063/t_fexecve.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $ */
+/* $NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fexecve.c,v 1.2 2013/03/17 04:35:59 jmmv Exp $");
+__RCSID("$NetBSD: t_fexecve.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
#include <sys/wait.h>
@@ -70,6 +70,7 @@ ATF_TC_BODY(fexecve, tc)
error = 76;
else
error = EXIT_FAILURE;
+ (void)close(fd);
err(error, "fexecve");
}
}
diff --git a/lib/libc/c063/t_fstatat.c b/lib/libc/c063/t_fstatat.c
index a48cd5781384..c17961f26494 100644
--- a/lib/libc/c063/t_fstatat.c
+++ b/lib/libc/c063/t_fstatat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_fstatat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_fstatat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/fstatat"
diff --git a/lib/libc/c063/t_mkfifoat.c b/lib/libc/c063/t_mkfifoat.c
index 1ae023c3f4a6..5c496c8d0987 100644
--- a/lib/libc/c063/t_mkfifoat.c
+++ b/lib/libc/c063/t_mkfifoat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.3 2017/01/10 15:15:09 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -63,6 +63,7 @@ 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);
+ (void)close(dfd);
}
ATF_TC(mkfifoat_fdcwd);
diff --git a/lib/libc/c063/t_mknodat.c b/lib/libc/c063/t_mknodat.c
index b04a1595d6e5..7c3ab9b2edbe 100644
--- a/lib/libc/c063/t_mknodat.c
+++ b/lib/libc/c063/t_mknodat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mknodat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_mknodat.c,v 1.4 2017/01/10 15:15:09 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -80,6 +80,7 @@ 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);
+ (void)close(dfd);
}
ATF_TC(mknodat_fdcwd);
diff --git a/lib/libc/c063/t_o_search.c b/lib/libc/c063/t_o_search.c
index d9dbe19e899f..7cefa8bf8822 100644
--- a/lib/libc/c063/t_o_search.c
+++ b/lib/libc/c063/t_o_search.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,9 +29,13 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_o_search.c,v 1.5 2017/01/10 22:25:01 christos Exp $");
#include <atf-c.h>
+
+#include <sys/param.h>
+#include <sys/stat.h>
+
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
@@ -40,7 +44,6 @@ __RCSID("$NetBSD: t_o_search.c,v 1.4 2013/03/17 04:46:06 jmmv Exp $");
#include <string.h>
#include <unistd.h>
#include <pwd.h>
-#include <sys/param.h>
/*
* dholland 20130112: disable tests that require O_SEARCH semantics
diff --git a/lib/libc/c063/t_openat.c b/lib/libc/c063/t_openat.c
index 79b5f38d81fd..f7c8c74b5b15 100644
--- a/lib/libc/c063/t_openat.c
+++ b/lib/libc/c063/t_openat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_openat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_openat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/openat"
diff --git a/lib/libc/c063/t_readlinkat.c b/lib/libc/c063/t_readlinkat.c
index d354ff59b886..cf14652a9efe 100644
--- a/lib/libc/c063/t_readlinkat.c
+++ b/lib/libc/c063/t_readlinkat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_readlinkat.c,v 1.4 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_readlinkat.c,v 1.4 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_readlinkat.c,v 1.3 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/readlinkat"
diff --git a/lib/libc/c063/t_unlinkat.c b/lib/libc/c063/t_unlinkat.c
index 79aa7aa2bf70..9897b928c516 100644
--- a/lib/libc/c063/t_unlinkat.c
+++ b/lib/libc/c063/t_unlinkat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_unlinkat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_unlinkat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,7 +41,6 @@ __RCSID("$NetBSD: t_unlinkat.c,v 1.2 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
#define DIR "dir"
#define FILE "dir/unlinkat"
diff --git a/lib/libc/c063/t_utimensat.c b/lib/libc/c063/t_utimensat.c
index 9f21fd6f126a..682c2df06974 100644
--- a/lib/libc/c063/t_utimensat.c
+++ b/lib/libc/c063/t_utimensat.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $ */
+/* $NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,8 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $");
+__RCSID("$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $");
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/time.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
@@ -39,8 +42,6 @@ __RCSID("$NetBSD: t_utimensat.c,v 1.5 2013/03/17 04:46:06 jmmv Exp $");
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <sys/param.h>
-#include <sys/time.h>
#define DIR "dir"
#define FILE "dir/utimensat"
diff --git a/lib/libc/gen/posix_spawn/t_fileactions.c b/lib/libc/gen/posix_spawn/t_fileactions.c
index 1cf643365c3f..a955d6a65190 100644
--- a/lib/libc/gen/posix_spawn/t_fileactions.c
+++ b/lib/libc/gen/posix_spawn/t_fileactions.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fileactions.c,v 1.5 2012/04/09 19:42:07 martin Exp $ */
+/* $NetBSD: t_fileactions.c,v 1.6 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -32,6 +32,10 @@
#include <atf-c.h>
+
+#include <sys/wait.h>
+#include <sys/stat.h>
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -39,7 +43,6 @@
#include <fcntl.h>
#include <spawn.h>
#include <unistd.h>
-#include <sys/wait.h>
ATF_TC(t_spawn_openmode);
diff --git a/lib/libc/gen/t_assert.c b/lib/libc/gen/t_assert.c
index 140417a38aa8..ce73015142d6 100644
--- a/lib/libc/gen/t_assert.c
+++ b/lib/libc/gen/t_assert.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $ */
+/* $NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,8 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");
+__RCSID("$NetBSD: t_assert.c,v 1.3 2017/01/10 15:17:57 christos Exp $");
+#include <sys/types.h>
+#include <sys/resource.h>
+#include <sys/time.h>
#include <sys/wait.h>
#include <assert.h>
@@ -40,6 +43,17 @@ __RCSID("$NetBSD: t_assert.c,v 1.2 2011/06/14 05:28:00 jruoho Exp $");
#include <string.h>
#include <unistd.h>
+static void
+disable_corefile(void)
+{
+ struct rlimit limits;
+
+ limits.rlim_cur = 0;
+ limits.rlim_max = 0;
+
+ ATF_REQUIRE(setrlimit(RLIMIT_CORE, &limits) == 0);
+}
+
static void handler(int);
static void
@@ -65,6 +79,7 @@ ATF_TC_BODY(assert_false, tc)
if (pid == 0) {
+ disable_corefile();
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
@@ -102,6 +117,7 @@ ATF_TC_BODY(assert_true, tc)
if (pid == 0) {
+ disable_corefile();
(void)closefrom(0);
(void)memset(&sa, 0, sizeof(struct sigaction));
diff --git a/lib/libc/gen/t_dir.c b/lib/libc/gen/t_dir.c
index 81412c1ae898..6142f68caf3c 100644
--- a/lib/libc/gen/t_dir.c
+++ b/lib/libc/gen/t_dir.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_dir.c,v 1.6 2013/10/19 17:45:00 christos Exp $ */
+/* $NetBSD: t_dir.c,v 1.8 2017/01/11 07:26:17 christos Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -26,18 +26,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <atf-c.h>
-
+#include <sys/stat.h>
#include <assert.h>
+#include <atf-c.h>
#include <dirent.h>
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sys/stat.h>
+
ATF_TC(seekdir_basic);
ATF_TC_HEAD(seekdir_basic, tc)
@@ -54,10 +55,19 @@ ATF_TC_BODY(seekdir_basic, tc)
struct dirent *entry;
long here;
- mkdir("t", 0755);
- creat("t/a", 0600);
- creat("t/b", 0600);
- creat("t/c", 0600);
+#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);
dp = opendir("t");
if ( dp == NULL)
@@ -70,6 +80,8 @@ ATF_TC_BODY(seekdir_basic, tc)
/* get first entry */
entry = readdir(dp);
here = telldir(dp);
+ ATF_REQUIRE_MSG(here != -1,
+ "telldir failed: %s", strerror(errno));
/* get second entry */
entry = readdir(dp);
@@ -109,6 +121,7 @@ ATF_TC_BODY(seekdir_basic, tc)
atf_tc_fail("3rd seekdir found wrong name");
closedir(dp);
+ free(wasname);
}
ATF_TC(telldir_leak);
diff --git a/lib/libc/gen/t_ftok.c b/lib/libc/gen/t_ftok.c
index 100bd1bb982f..4c1ab18950eb 100644
--- a/lib/libc/gen/t_ftok.c
+++ b/lib/libc/gen/t_ftok.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ftok.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $ */
+/* $NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ftok.c,v 1.1 2011/11/08 05:47:00 jruoho Exp $");
+__RCSID("$NetBSD: t_ftok.c,v 1.2 2017/01/10 15:19:52 christos Exp $");
#include <sys/types.h>
#include <sys/ipc.h>
@@ -68,6 +68,7 @@ ATF_TC_BODY(ftok_link, tc)
fd = open(path, O_RDONLY | O_CREAT);
ATF_REQUIRE(fd >= 0);
+ (void)close(fd);
ATF_REQUIRE(link(path, hlnk) == 0);
ATF_REQUIRE(symlink(path, slnk) == 0);
diff --git a/lib/libc/gen/t_humanize_number.c b/lib/libc/gen/t_humanize_number.c
index 1af579e61c02..cf701d1112d9 100644
--- a/lib/libc/gen/t_humanize_number.c
+++ b/lib/libc/gen/t_humanize_number.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_humanize_number.c,v 1.8 2012/03/18 07:14:08 jruoho Exp $ */
+/* $NetBSD: t_humanize_number.c,v 1.9 2017/01/10 15:20:44 christos Exp $ */
/*-
* Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -241,6 +241,7 @@ ATF_TC_BODY(humanize_number_basic, tc)
newline();
atf_tc_fail_nonfatal("Failed for table entry %d", i);
}
+ free(buf);
}
ATF_TC(humanize_number_big);
diff --git a/lib/libc/gen/t_sleep.c b/lib/libc/gen/t_sleep.c
index b24f8dd830d5..4545a6941a76 100644
--- a/lib/libc/gen/t_sleep.c
+++ b/lib/libc/gen/t_sleep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_sleep.c,v 1.9 2016/08/11 21:34:11 kre Exp $ */
+/* $NetBSD: t_sleep.c,v 1.11 2017/01/10 15:43:59 maya Exp $ */
/*-
* Copyright (c) 2006 Frank Kardel
@@ -26,8 +26,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/cdefs.h>
+#include <sys/event.h>
+#include <sys/signal.h>
+#include <sys/time.h> /* for TIMESPEC_TO_TIMEVAL on FreeBSD */
+
#include <atf-c.h>
#include <errno.h>
+#include <inttypes.h>
#include <poll.h>
#include <stdio.h>
#include <stdlib.h>
@@ -35,10 +41,6 @@
#include <time.h>
#include <unistd.h>
-#include <sys/cdefs.h>
-#include <sys/event.h>
-#include <sys/signal.h>
-
#include "isqemu.h"
#define BILLION 1000000000LL /* nano-seconds per second */
diff --git a/lib/libc/gen/t_time.c b/lib/libc/gen/t_time.c
index 4496f59efaf0..15a8d585c847 100644
--- a/lib/libc/gen/t_time.c
+++ b/lib/libc/gen/t_time.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $ */
+/* $NetBSD: t_time.c,v 1.4 2017/01/10 15:32:46 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $");
+__RCSID("$NetBSD: t_time.c,v 1.4 2017/01/10 15:32:46 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -38,6 +38,7 @@ __RCSID("$NetBSD: t_time.c,v 1.3 2014/10/31 12:22:38 justin Exp $");
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+#include <sys/time.h>
#include <unistd.h>
ATF_TC(time_copy);
diff --git a/lib/libc/gen/t_ttyname.c b/lib/libc/gen/t_ttyname.c
index 0c10c2496443..61121b8b9c0d 100644
--- a/lib/libc/gen/t_ttyname.c
+++ b/lib/libc/gen/t_ttyname.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $ */
+/* $NetBSD: t_ttyname.c,v 1.4 2017/01/10 15:33:40 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_ttyname.c,v 1.3 2011/05/01 18:14:01 jruoho Exp $");
+__RCSID("$NetBSD: t_ttyname.c,v 1.4 2017/01/10 15:33:40 christos Exp $");
#include <atf-c.h>
#include <errno.h>
@@ -78,6 +78,7 @@ ATF_TC_BODY(ttyname_err, tc)
ATF_REQUIRE(ttyname(fd) == NULL);
ATF_REQUIRE(errno == ENOTTY);
+ (void)close(fd);
}
}
diff --git a/lib/libc/gen/t_vis.c b/lib/libc/gen/t_vis.c
index 38decb3069c9..adb0930a300a 100644
--- a/lib/libc/gen/t_vis.c
+++ b/lib/libc/gen/t_vis.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_vis.c,v 1.8 2015/05/23 14:02:11 christos Exp $ */
+/* $NetBSD: t_vis.c,v 1.9 2017/01/10 15:16:57 christos Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -144,6 +144,7 @@ ATF_TC_BODY(strunvis_hex, tc)
}
}
+#ifdef VIS_NOLOCALE
ATF_TC(strvis_locale);
ATF_TC_HEAD(strvis_locale, tc)
{
@@ -172,6 +173,7 @@ ATF_TC_BODY(strvis_locale, tc)
setlocale(LC_CTYPE, ol);
free(ol);
}
+#endif /* VIS_NOLOCALE */
ATF_TP_ADD_TCS(tp)
{
@@ -180,7 +182,9 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, strvis_null);
ATF_TP_ADD_TC(tp, strvis_empty);
ATF_TP_ADD_TC(tp, strunvis_hex);
+#ifdef VIS_NOLOCALE
ATF_TP_ADD_TC(tp, strvis_locale);
+#endif /* VIS_NOLOCALE */
return atf_no_error();
}
diff --git a/lib/libc/string/t_strchr.c b/lib/libc/string/t_strchr.c
index 958b186e9ceb..5dd9a62213ab 100644
--- a/lib/libc/string/t_strchr.c
+++ b/lib/libc/string/t_strchr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strchr.c,v 1.1 2011/07/07 08:59:33 jruoho Exp $ */
+/* $NetBSD: t_strchr.c,v 1.2 2017/01/10 15:34:49 christos Exp $ */
/*
* Written by J.T. Conklin <jtc@acorntoolworks.com>
@@ -58,9 +58,10 @@ ATF_TC_HEAD(strchr_basic, tc)
ATF_TC_BODY(strchr_basic, tc)
{
- unsigned int t, a;
+ void *dl_handle;
char *off;
char buf[32];
+ unsigned int t, a;
const char *tab[] = {
"",
@@ -245,8 +246,8 @@ ATF_TC_BODY(strchr_basic, tc)
"abcdefgh/abcdefgh/",
};
-
- strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr");
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strchr_fn = dlsym(dl_handle, "test_strlen");
if (!strchr_fn)
strchr_fn = strchr;
@@ -281,6 +282,7 @@ ATF_TC_BODY(strchr_basic, tc)
verify_strchr(buf + a, 0xff, t, a);
}
}
+ (void)dlclose(dl_handle);
}
ATF_TP_ADD_TCS(tp)
diff --git a/lib/libc/string/t_strerror.c b/lib/libc/string/t_strerror.c
index c0e9c06e9185..99b95b4266c6 100644
--- a/lib/libc/string/t_strerror.c
+++ b/lib/libc/string/t_strerror.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $ */
+/* $NetBSD: t_strerror.c,v 1.4 2017/01/10 20:35:49 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,10 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strerror.c,v 1.3 2011/05/10 06:55:27 jruoho Exp $");
+__RCSID("$NetBSD: t_strerror.c,v 1.4 2017/01/10 20:35:49 christos Exp $");
#include <atf-c.h>
#include <errno.h>
+#include <stdio.h> /* Needed for sys_nerr on FreeBSD */
#include <limits.h>
#include <locale.h>
#include <string.h>
diff --git a/lib/libc/sys/t_access.c b/lib/libc/sys/t_access.c
index f15afc25a6f2..f75617235972 100644
--- a/lib/libc/sys/t_access.c
+++ b/lib/libc/sys/t_access.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
+/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
+__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
+
+#include <atf-c.h>
+
+#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
@@ -38,8 +42,6 @@ __RCSID("$NetBSD: t_access.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
#include <stdlib.h>
#include <unistd.h>
-#include <atf-c.h>
-
static const char path[] = "access";
static const int mode[4] = { R_OK, W_OK, X_OK, F_OK };
diff --git a/lib/libc/sys/t_chroot.c b/lib/libc/sys/t_chroot.c
index ce7170875f24..aa761b80967f 100644
--- a/lib/libc/sys/t_chroot.c
+++ b/lib/libc/sys/t_chroot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_chroot.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
+/* $NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,9 +29,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_chroot.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
+__RCSID("$NetBSD: t_chroot.c,v 1.2 2017/01/10 22:36:29 christos Exp $");
#include <sys/wait.h>
+#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
diff --git a/lib/libc/sys/t_mincore.c b/lib/libc/sys/t_mincore.c
index 553207a8af7f..431970953e19 100644
--- a/lib/libc/sys/t_mincore.c
+++ b/lib/libc/sys/t_mincore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mincore.c,v 1.8 2012/06/08 07:18:58 martin Exp $ */
+/* $NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -59,9 +59,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mincore.c,v 1.8 2012/06/08 07:18:58 martin Exp $");
+__RCSID("$NetBSD: t_mincore.c,v 1.9 2017/01/10 22:36:29 christos Exp $");
#include <sys/mman.h>
+#include <sys/stat.h>
#include <sys/shm.h>
#include <atf-c.h>
diff --git a/lib/libc/sys/t_mmap.c b/lib/libc/sys/t_mmap.c
index 8576403fdea3..963b3c5cebeb 100644
--- a/lib/libc/sys/t_mmap.c
+++ b/lib/libc/sys/t_mmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.9 2015/02/28 13:57:08 martin Exp $ */
+/* $NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,10 +55,11 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.9 2015/02/28 13:57:08 martin Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.10 2017/01/10 22:36:29 christos Exp $");
#include <sys/param.h>
#include <sys/mman.h>
+#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/wait.h>
diff --git a/lib/libc/sys/t_wait.c b/lib/libc/sys/t_wait.c
index c06bb5519cae..163709bf3e78 100644
--- a/lib/libc/sys/t_wait.c
+++ b/lib/libc/sys/t_wait.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_wait.c,v 1.4 2016/04/27 21:14:24 christos Exp $ */
+/* $NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $ */
/*-
* Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_wait.c,v 1.4 2016/04/27 21:14:24 christos Exp $");
+__RCSID("$NetBSD: t_wait.c,v 1.7 2016/11/06 15:04:14 kamil Exp $");
#include <sys/wait.h>
#include <sys/resource.h>
@@ -60,22 +60,6 @@ ATF_TC_BODY(wait6_invalid, tc)
&& errno == EINVAL);
}
-ATF_TC(wait6_noproc);
-ATF_TC_HEAD(wait6_noproc, tc)
-{
- atf_tc_set_md_var(tc, "descr",
- "Test that wait6(2) returns ECHILD with for no processes");
-}
-
-ATF_TC_BODY(wait6_noproc, tc)
-{
- siginfo_t si;
- struct wrusage wru;
- int st;
- ATF_REQUIRE(wait6(P_ALL, 0, &st, WEXITED, &wru, &si) == -1
- && errno == ECHILD);
-}
-
ATF_TC(wait6_exited);
ATF_TC_HEAD(wait6_exited, tc)
{
@@ -92,12 +76,12 @@ ATF_TC_BODY(wait6_exited, tc)
switch (pid = fork()) {
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
case 0:
exit(0x5a5a5a5a);
/*NOTREACHED*/
default:
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFEXITED(st) && WEXITSTATUS(st) == 0x5a);
ATF_REQUIRE(si.si_status = 0x5a5a5a5a);
ATF_REQUIRE(si.si_pid == pid);
@@ -128,10 +112,10 @@ ATF_TC_BODY(wait6_terminated, tc)
sleep(100);
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
ATF_REQUIRE(kill(pid, SIGTERM) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGTERM);
ATF_REQUIRE(si.si_status == SIGTERM);
ATF_REQUIRE(si.si_pid == pid);
@@ -164,9 +148,9 @@ ATF_TC_BODY(wait6_coredumped, tc)
*(char *)8 = 0;
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGSEGV
&& WCOREDUMP(st));
ATF_REQUIRE(si.si_status == SIGSEGV);
@@ -200,11 +184,14 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
sleep(100);
/*FALLTHROUGH*/
case -1:
- ATF_REQUIRE(pid > 0);
+ ATF_REQUIRE(pid > 0);
default:
ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
+ ATF_REQUIRE(!WIFCONTINUED(st));
ATF_REQUIRE(si.si_status == SIGSTOP);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -213,8 +200,11 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
(uintmax_t)si.si_utime);
ATF_REQUIRE(kill(pid, SIGCONT) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
ATF_REQUIRE(WIFCONTINUED(st));
+ ATF_REQUIRE(!WIFSTOPPED(st));
ATF_REQUIRE(si.si_status == SIGCONT);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -223,8 +213,11 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
(uintmax_t)si.si_utime);
ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
- ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(!WIFCONTINUED(st));
ATF_REQUIRE(si.si_status == SIGQUIT);
ATF_REQUIRE(si.si_pid == pid);
ATF_REQUIRE(si.si_uid == getuid());
@@ -235,15 +228,78 @@ ATF_TC_BODY(wait6_stop_and_go, tc)
}
}
+ATF_TC(wait6_stopgo_loop);
+ATF_TC_HEAD(wait6_stopgo_loop, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test that wait6(2) handled stopped/continued process loop");
+}
+
+ATF_TC_BODY(wait6_stopgo_loop, tc)
+{
+ siginfo_t si;
+ struct wrusage wru;
+ int st;
+ pid_t pid;
+ static const struct rlimit rl = { 0, 0 };
+ size_t N = 100;
+
+ ATF_REQUIRE(setrlimit(RLIMIT_CORE, &rl) == 0);
+ switch (pid = fork()) {
+ case 0:
+ sleep(100);
+ /*FALLTHROUGH*/
+ case -1:
+ ATF_REQUIRE(pid > 0);
+ }
+
+ printf("Before loop of SIGSTOP/SIGCONT sequence %zu times\n", N);
+ while (N --> 0) {
+ ATF_REQUIRE(kill(pid, SIGSTOP) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WSTOPPED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
+ ATF_REQUIRE(WIFSTOPPED(st) && WSTOPSIG(st) == SIGSTOP);
+ ATF_REQUIRE(!WIFCONTINUED(st));
+ ATF_REQUIRE(si.si_status == SIGSTOP);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_STOPPED);
+
+ ATF_REQUIRE(kill(pid, SIGCONT) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WCONTINUED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(!WIFSIGNALED(st));
+ ATF_REQUIRE(WIFCONTINUED(st));
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(si.si_status == SIGCONT);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_CONTINUED);
+ }
+ ATF_REQUIRE(kill(pid, SIGQUIT) == 0);
+ ATF_REQUIRE(wait6(P_PID, pid, &st, WEXITED, &wru, &si) == pid);
+ ATF_REQUIRE(!WIFEXITED(st));
+ ATF_REQUIRE(WIFSIGNALED(st) && WTERMSIG(st) == SIGQUIT);
+ ATF_REQUIRE(!WIFSTOPPED(st));
+ ATF_REQUIRE(!WIFCONTINUED(st));
+ ATF_REQUIRE(si.si_status == SIGQUIT);
+ ATF_REQUIRE(si.si_pid == pid);
+ ATF_REQUIRE(si.si_uid == getuid());
+ ATF_REQUIRE(si.si_code == CLD_KILLED);
+ printf("user: %ju system: %ju\n", (uintmax_t)si.si_utime,
+ (uintmax_t)si.si_utime);
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, wait6_invalid);
- ATF_TP_ADD_TC(tp, wait6_noproc);
ATF_TP_ADD_TC(tp, wait6_exited);
ATF_TP_ADD_TC(tp, wait6_terminated);
ATF_TP_ADD_TC(tp, wait6_coredumped);
ATF_TP_ADD_TC(tp, wait6_stop_and_go);
+ ATF_TP_ADD_TC(tp, wait6_stopgo_loop);
return atf_no_error();
}
diff --git a/lib/libc/t_cdb.c b/lib/libc/t_cdb.c
index 5e88e6523a26..97da4a34f412 100644
--- a/lib/libc/t_cdb.c
+++ b/lib/libc/t_cdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $ */
+/* $NetBSD: t_cdb.c,v 1.2 2017/01/10 22:24:29 christos Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,12 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_cdb.c,v 1.1 2012/09/27 00:38:57 joerg Exp $");
+__RCSID("$NetBSD: t_cdb.c,v 1.2 2017/01/10 22:24:29 christos Exp $");
#include <atf-c.h>
+
+#include <sys/stat.h>
+
#include <assert.h>
#include <cdbr.h>
#include <cdbw.h>