diff options
author | bluhm <> | 2020-11-09 23:18:51 +0000 |
---|---|---|
committer | bluhm <> | 2020-11-09 23:18:51 +0000 |
commit | c369d42df84f5bdabcac9041e6c5680a0cbfeaf9 (patch) | |
tree | 2233f16128b2705882f46a8369c9f9f47f40af5c /src/regress/lib/libc/sys/t_mlock.c | |
parent | 999ec352efbeb24cccd1d584b91a659b15764151 (diff) | |
download | openbsd-c369d42df84f5bdabcac9041e6c5680a0cbfeaf9.tar.gz openbsd-c369d42df84f5bdabcac9041e6c5680a0cbfeaf9.tar.bz2 openbsd-c369d42df84f5bdabcac9041e6c5680a0cbfeaf9.zip |
Sync libc syscall tests with changes in upstream NetBSD. Use #ifdef
to document differences to NetBSD behaviour, this helps to track
upstream. Mark currently failing test as expected failures. So
test programs get compiled and executed, but it shows that further
investigation is necceassry.
Diffstat (limited to 'src/regress/lib/libc/sys/t_mlock.c')
-rw-r--r-- | src/regress/lib/libc/sys/t_mlock.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/regress/lib/libc/sys/t_mlock.c b/src/regress/lib/libc/sys/t_mlock.c index 1fd986383d..e41f52443c 100644 --- a/src/regress/lib/libc/sys/t_mlock.c +++ b/src/regress/lib/libc/sys/t_mlock.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* $OpenBSD: t_mlock.c,v 1.1.1.1 2019/11/19 19:57:04 bluhm Exp $ */ | 1 | /* $OpenBSD: t_mlock.c,v 1.2 2020/11/09 23:18:51 bluhm Exp $ */ |
2 | /* $NetBSD: t_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $ */ | 2 | /* $NetBSD: t_mlock.c,v 1.8 2020/01/24 08:45:16 skrll Exp $ */ |
3 | 3 | ||
4 | /*- | 4 | /*- |
5 | * Copyright (c) 2012 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2012 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_mlock.c,v 1.7 2019/03/13 08:50:12 kre Exp $"); | 36 | __RCSID("$NetBSD: t_mlock.c,v 1.8 2020/01/24 08:45:16 skrll Exp $"); |
37 | 37 | ||
38 | #include <sys/mman.h> | 38 | #include <sys/mman.h> |
39 | #include <sys/resource.h> | 39 | #include <sys/resource.h> |
@@ -108,8 +108,11 @@ ATF_TC_BODY(mlock_err, tc) | |||
108 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); | 108 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)0, page) == -1); |
109 | 109 | ||
110 | errno = 0; | 110 | errno = 0; |
111 | /* Adjusted for OpenBSD, initially ENOMEM */ | 111 | #ifdef __OpenBSD__ |
112 | ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); | 112 | ATF_REQUIRE_ERRNO(EINVAL, mlock((char *)-1, page) == -1); |
113 | #else | ||
114 | ATF_REQUIRE_ERRNO(ENOMEM, mlock((char *)-1, page) == -1); | ||
115 | #endif | ||
113 | 116 | ||
114 | errno = 0; | 117 | errno = 0; |
115 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); | 118 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(NULL, page) == -1); |
@@ -118,8 +121,11 @@ ATF_TC_BODY(mlock_err, tc) | |||
118 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); | 121 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)0, page) == -1); |
119 | 122 | ||
120 | errno = 0; | 123 | errno = 0; |
121 | /* Adjusted for OpenBSD, initially ENOMEM */ | 124 | #ifdef __OpenBSD__ |
122 | ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); | 125 | ATF_REQUIRE_ERRNO(EINVAL, munlock((char *)-1, page) == -1); |
126 | #else | ||
127 | ATF_REQUIRE_ERRNO(ENOMEM, munlock((char *)-1, page) == -1); | ||
128 | #endif | ||
123 | 129 | ||
124 | buf = malloc(page); | 130 | buf = malloc(page); |
125 | ATF_REQUIRE(buf != NULL); | 131 | ATF_REQUIRE(buf != NULL); |
@@ -129,11 +135,10 @@ ATF_TC_BODY(mlock_err, tc) | |||
129 | * unlocking memory that is not locked is an error... | 135 | * unlocking memory that is not locked is an error... |
130 | */ | 136 | */ |
131 | 137 | ||
132 | /* | 138 | #ifndef __OpenBSD__ |
133 | * Adjusted for OpenBSD | 139 | errno = 0; |
134 | * errno = 0; | 140 | ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); |
135 | * ATF_REQUIRE_ERRNO(ENOMEM, munlock(buf, page) == -1); | 141 | #endif |
136 | */ | ||
137 | 142 | ||
138 | /* | 143 | /* |
139 | * These are permitted to fail (EINVAL) but do not on NetBSD | 144 | * These are permitted to fail (EINVAL) but do not on NetBSD |
@@ -229,8 +234,11 @@ ATF_TC_HEAD(mlock_mmap, tc) | |||
229 | 234 | ||
230 | ATF_TC_BODY(mlock_mmap, tc) | 235 | ATF_TC_BODY(mlock_mmap, tc) |
231 | { | 236 | { |
232 | /* Adjusted for OpenBSD, initially ... | MAP_WIRED */ | 237 | #ifdef __OpenBSD__ |
233 | static const int flags = MAP_ANON | MAP_PRIVATE; | 238 | static const int flags = MAP_ANON | MAP_PRIVATE; |
239 | #else | ||
240 | static const int flags = MAP_ANON | MAP_PRIVATE | MAP_WIRED; | ||
241 | #endif | ||
234 | void *buf; | 242 | void *buf; |
235 | 243 | ||
236 | /* | 244 | /* |
@@ -312,7 +320,6 @@ ATF_TP_ADD_TCS(tp) | |||
312 | { | 320 | { |
313 | 321 | ||
314 | page = sysconf(_SC_PAGESIZE); | 322 | page = sysconf(_SC_PAGESIZE); |
315 | fprintf(stderr, "t_mlock: pagesize %ld\n", page); | ||
316 | ATF_REQUIRE(page >= 0); | 323 | ATF_REQUIRE(page >= 0); |
317 | 324 | ||
318 | ATF_TP_ADD_TC(tp, mlock_clip); | 325 | ATF_TP_ADD_TC(tp, mlock_clip); |