summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/sys
diff options
context:
space:
mode:
authorbluhm <>2019-11-22 15:59:53 +0000
committerbluhm <>2019-11-22 15:59:53 +0000
commitb2bdbc04fb540e09593ae35ff3336dc3b378f73a (patch)
tree0b4653232548242b962f182a56d148a1a4d0b669 /src/regress/lib/libc/sys
parent31d2d72847eddaad8498eaa0129b72d27f6f9aee (diff)
downloadopenbsd-b2bdbc04fb540e09593ae35ff3336dc3b378f73a.tar.gz
openbsd-b2bdbc04fb540e09593ae35ff3336dc3b378f73a.tar.bz2
openbsd-b2bdbc04fb540e09593ae35ff3336dc3b378f73a.zip
Sync tests with current NetBSD. Enable t_mkfifo test.
from Moritz Buhl
Diffstat (limited to 'src/regress/lib/libc/sys')
-rw-r--r--src/regress/lib/libc/sys/README11
-rw-r--r--src/regress/lib/libc/sys/atf-c.c17
-rw-r--r--src/regress/lib/libc/sys/t_access.c8
-rw-r--r--src/regress/lib/libc/sys/t_getitimer.c15
-rw-r--r--src/regress/lib/libc/sys/t_stat.c12
-rw-r--r--src/regress/lib/libc/sys/t_write.c8
6 files changed, 44 insertions, 27 deletions
diff --git a/src/regress/lib/libc/sys/README b/src/regress/lib/libc/sys/README
index 979f3bde4a..84a442eb5d 100644
--- a/src/regress/lib/libc/sys/README
+++ b/src/regress/lib/libc/sys/README
@@ -3,11 +3,11 @@ Regression tests for system calls ported from NetBSD.
3Reimplement ATF with many hacks to adjust the tests as little as possible. 3Reimplement ATF with many hacks to adjust the tests as little as possible.
4 4
5Tests passing without source file adjustments: 5Tests passing without source file adjustments:
6t_access t_getpid t_kill t_msgsnd t_sigaction 6t_access t_getpid t_link t_msgsnd t_sigaction
7t_bind t_link t_msync t_socketpair t_getgroups 7t_bind t_getsid t_listen t_msync t_socketpair
8t_getsid t_listen t_pipe t_truncate t_getitimer 8t_getgroups t_getsockname t_mkdir t_pipe t_truncate
9t_getsockname t_mkdir t_sendrecv t_umask t_getlogin 9t_getitimer t_gettimeofday t_mkfifo t_sendrecv t_umask
10t_gettimeofday t_msgctl t_setuid t_write 10t_getlogin t_kill t_msgctl t_setuid t_write
11 11
12Tests passing after adjustments: 12Tests passing after adjustments:
13t_chroot - fchroot is not implemented 13t_chroot - fchroot is not implemented
@@ -22,7 +22,6 @@ t_revoke - remove basic tests, revoke only on ttys supported
22t_select - remove sigset_t struct as it is int on OpenBSD 22t_select - remove sigset_t struct as it is int on OpenBSD
23 23
24Failing tests: 24Failing tests:
25t_mkfifo - every test case fails now
26t_mlock - wrong errno, succeeds where not expected, POSIX imprecise 25t_mlock - wrong errno, succeeds where not expected, POSIX imprecise
27t_mmap - ENOTBLK on test NetBSD is skipping, remove mmap_va0 test 26t_mmap - ENOTBLK on test NetBSD is skipping, remove mmap_va0 test
28t_msgrcv - msgrcv(id, &r, 3 - 1, 0x41, 004000) != -1 27t_msgrcv - msgrcv(id, &r, 3 - 1, 0x41, 004000) != -1
diff --git a/src/regress/lib/libc/sys/atf-c.c b/src/regress/lib/libc/sys/atf-c.c
index 45181c7353..e550a9b753 100644
--- a/src/regress/lib/libc/sys/atf-c.c
+++ b/src/regress/lib/libc/sys/atf-c.c
@@ -1,4 +1,19 @@
1/* $OpenBSD: atf-c.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ 1/* $OpenBSD: atf-c.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */
2/*
3 * Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
2 17
3#include <sys/wait.h> 18#include <sys/wait.h>
4 19
diff --git a/src/regress/lib/libc/sys/t_access.c b/src/regress/lib/libc/sys/t_access.c
index 33888c7039..ed6410423b 100644
--- a/src/regress/lib/libc/sys/t_access.c
+++ b/src/regress/lib/libc/sys/t_access.c
@@ -1,5 +1,5 @@
1/* $OpenBSD: t_access.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ 1/* $OpenBSD: t_access.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */
2/* $NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $ */ 2/* $NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
33#include "macros.h" 33#include "macros.h"
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__RCSID("$NetBSD: t_access.c,v 1.2 2017/01/10 22:36:29 christos Exp $"); 36__RCSID("$NetBSD: t_access.c,v 1.3 2019/07/16 17:29:18 martin Exp $");
37 37
38#include "atf-c.h" 38#include "atf-c.h"
39 39
@@ -62,7 +62,7 @@ ATF_TC_BODY(access_access, tc)
62 size_t i; 62 size_t i;
63 int fd; 63 int fd;
64 64
65 fd = open(path, O_RDONLY | O_CREAT); 65 fd = open(path, O_RDONLY | O_CREAT, 0600);
66 66
67 if (fd < 0) 67 if (fd < 0)
68 return; 68 return;
diff --git a/src/regress/lib/libc/sys/t_getitimer.c b/src/regress/lib/libc/sys/t_getitimer.c
index b6cc4102bb..fbf9c28ccc 100644
--- a/src/regress/lib/libc/sys/t_getitimer.c
+++ b/src/regress/lib/libc/sys/t_getitimer.c
@@ -1,5 +1,5 @@
1/* $OpenBSD: t_getitimer.c,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ */ 1/* $OpenBSD: t_getitimer.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */
2/* $NetBSD: t_getitimer.c,v 1.2 2012/03/22 18:20:46 christos Exp $ */ 2/* $NetBSD: t_getitimer.c,v 1.3 2019/07/13 12:44:02 gson Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -179,11 +179,13 @@ ATF_TC_BODY(setitimer_old, tc)
179 struct itimerval it, ot; 179 struct itimerval it, ot;
180 180
181 /* 181 /*
182 * Make two calls; the second one 182 * Make two calls; the second one should store the old
183 * should store the old values. 183 * timer value which should be the same as that set in
184 * the first call, or slightly less due to time passing
185 * between the two calls.
184 */ 186 */
185 it.it_value.tv_sec = 4; 187 it.it_value.tv_sec = 4;
186 it.it_value.tv_usec = 3; 188 it.it_value.tv_usec = 999999;
187 189
188 it.it_interval.tv_sec = 0; 190 it.it_interval.tv_sec = 0;
189 it.it_interval.tv_usec = 0; 191 it.it_interval.tv_usec = 0;
@@ -198,7 +200,8 @@ ATF_TC_BODY(setitimer_old, tc)
198 200
199 ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0); 201 ATF_REQUIRE(setitimer(ITIMER_REAL, &it, &ot) == 0);
200 202
201 if (ot.it_value.tv_sec != 4 || ot.it_value.tv_usec != 3) 203 /* Check seconds only as microseconds may have decremented */
204 if (ot.it_value.tv_sec != 4)
202 atf_tc_fail("setitimer(2) did not store old values"); 205 atf_tc_fail("setitimer(2) did not store old values");
203} 206}
204 207
diff --git a/src/regress/lib/libc/sys/t_stat.c b/src/regress/lib/libc/sys/t_stat.c
index ea7f4b24a2..73350c0e6a 100644
--- a/src/regress/lib/libc/sys/t_stat.c
+++ b/src/regress/lib/libc/sys/t_stat.c
@@ -1,5 +1,5 @@
1/* $OpenBSD: t_stat.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ 1/* $OpenBSD: t_stat.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */
2/* $NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $ */ 2/* $NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2011 The NetBSD Foundation, Inc. 5 * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
33#include "macros.h" 33#include "macros.h"
34 34
35#include <sys/cdefs.h> 35#include <sys/cdefs.h>
36__RCSID("$NetBSD: t_stat.c,v 1.5 2017/01/13 20:06:50 christos Exp $"); 36__RCSID("$NetBSD: t_stat.c,v 1.6 2019/07/16 17:29:18 martin Exp $");
37 37
38#include <sys/stat.h> 38#include <sys/stat.h>
39#include <sys/socket.h> 39#include <sys/socket.h>
@@ -214,7 +214,7 @@ ATF_TC_BODY(stat_mtime, tc)
214 (void)memset(&sa, 0, sizeof(struct stat)); 214 (void)memset(&sa, 0, sizeof(struct stat));
215 (void)memset(&sb, 0, sizeof(struct stat)); 215 (void)memset(&sb, 0, sizeof(struct stat));
216 216
217 fd[i] = open(path, O_WRONLY | O_CREAT); 217 fd[i] = open(path, O_WRONLY | O_CREAT, 0600);
218 218
219 ATF_REQUIRE(fd[i] != -1); 219 ATF_REQUIRE(fd[i] != -1);
220 ATF_REQUIRE(write(fd[i], "X", 1) == 1); 220 ATF_REQUIRE(write(fd[i], "X", 1) == 1);
@@ -292,7 +292,7 @@ ATF_TC_BODY(stat_size, tc)
292 size_t i; 292 size_t i;
293 int fd; 293 int fd;
294 294
295 fd = open(path, O_WRONLY | O_CREAT); 295 fd = open(path, O_WRONLY | O_CREAT, 0600);
296 ATF_REQUIRE(fd >= 0); 296 ATF_REQUIRE(fd >= 0);
297 297
298 for (i = 0; i < n; i++) { 298 for (i = 0; i < n; i++) {
@@ -381,7 +381,7 @@ ATF_TC_BODY(stat_symlink, tc)
381 (void)memset(&sa, 0, sizeof(struct stat)); 381 (void)memset(&sa, 0, sizeof(struct stat));
382 (void)memset(&sb, 0, sizeof(struct stat)); 382 (void)memset(&sb, 0, sizeof(struct stat));
383 383
384 fd = open(path, O_WRONLY | O_CREAT); 384 fd = open(path, O_WRONLY | O_CREAT, 0600);
385 385
386 ATF_REQUIRE(fd >= 0); 386 ATF_REQUIRE(fd >= 0);
387 ATF_REQUIRE(symlink(path, pathlink) == 0); 387 ATF_REQUIRE(symlink(path, pathlink) == 0);
diff --git a/src/regress/lib/libc/sys/t_write.c b/src/regress/lib/libc/sys/t_write.c
index d22f32383a..f05edb5bed 100644
--- a/src/regress/lib/libc/sys/t_write.c
+++ b/src/regress/lib/libc/sys/t_write.c
@@ -1,5 +1,5 @@
1/* $OpenBSD: t_write.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ 1/* $OpenBSD: t_write.c,v 1.2 2019/11/22 15:59:53 bluhm Exp $ */
2/* $NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $ */ 2/* $NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc. 5 * Copyright (c) 2001, 2008 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__COPYRIGHT("@(#) Copyright (c) 2008\ 33__COPYRIGHT("@(#) Copyright (c) 2008\
34 The NetBSD Foundation, inc. All rights reserved."); 34 The NetBSD Foundation, inc. All rights reserved.");
35__RCSID("$NetBSD: t_write.c,v 1.6 2017/07/09 22:18:43 christos Exp $"); 35__RCSID("$NetBSD: t_write.c,v 1.7 2019/07/16 17:29:18 martin Exp $");
36 36
37#include <sys/uio.h> 37#include <sys/uio.h>
38#include <sys/mman.h> 38#include <sys/mman.h>
@@ -176,7 +176,7 @@ ATF_TC_BODY(write_ret, tc)
176 size_t i, j; 176 size_t i, j;
177 int fd; 177 int fd;
178 178
179 fd = open(path, O_WRONLY | O_CREAT); 179 fd = open(path, O_WRONLY | O_CREAT, 0600);
180 ATF_REQUIRE(fd >= 0); 180 ATF_REQUIRE(fd >= 0);
181 181
182 (void)memset(buf, 'x', sizeof(buf)); 182 (void)memset(buf, 'x', sizeof(buf));