mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
tests/libc: use an allowlist for sbrk in NetBSD-derived tests
sbrk is obsolete and libc only provides it on amd64, arm, i386 and powerpc. Replace the growing exclusion lists in t_dir.c and t_mlock.c with a single positive HAVE_SBRK definition per file, so architectures without sbrk need not be enumerated as they are added. Signed-off-by: Xiaoqiang Zhao <[email protected]> Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D60358
This commit is contained in:
1 parent
e8431fae65
commit
d45f069002
2 files changed
+21
-7
No files matched your search
@@ -38,7 +38,14 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
/*
|
||||
* sbrk is obsolete, and libc only provides it on a subset of
|
||||
* architectures.
|
||||
*/
|
||||
#if defined(__amd64__) || defined(__arm__) || defined(__i386__) || \
|
||||
defined(__powerpc__)
|
||||
#define HAVE_SBRK
|
||||
#endif
|
||||
|
||||
ATF_TC(seekdir_basic);
|
||||
ATF_TC_HEAD(seekdir_basic, tc)
|
||||
@@ -134,8 +141,7 @@ ATF_TC_BODY(seekdir_basic, tc)
|
||||
free(wasname);
|
||||
}
|
||||
|
||||
/* There is no sbrk on AArch64 and RISC-V */
|
||||
#if !defined(__aarch64__) && !defined(__riscv)
|
||||
#ifdef HAVE_SBRK
|
||||
ATF_TC(telldir_leak);
|
||||
ATF_TC_HEAD(telldir_leak, tc)
|
||||
{
|
||||
@@ -185,7 +191,7 @@ ATF_TP_ADD_TCS(tp)
|
||||
{
|
||||
|
||||
ATF_TP_ADD_TC(tp, seekdir_basic);
|
||||
#if !defined(__aarch64__) && !defined(__riscv)
|
||||
#ifdef HAVE_SBRK
|
||||
ATF_TP_ADD_TC(tp, telldir_leak);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -46,6 +46,15 @@ __RCSID("$NetBSD: t_mlock.c,v 1.6 2016/08/09 12:02:44 kre Exp $");
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/*
|
||||
* sbrk is obsolete, and libc only provides it on a subset of
|
||||
* architectures.
|
||||
*/
|
||||
#if defined(__amd64__) || defined(__arm__) || defined(__i386__) || \
|
||||
defined(__powerpc__)
|
||||
#define HAVE_SBRK
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <limits.h>
|
||||
#define _KMEMUSER
|
||||
@@ -103,7 +112,7 @@ ATF_TC_BODY(mlock_err, tc)
|
||||
unsigned long vmin = 0;
|
||||
size_t len = sizeof(vmin);
|
||||
#endif
|
||||
#if !defined(__aarch64__) && !defined(__riscv)
|
||||
#ifdef HAVE_SBRK
|
||||
void *invalid_ptr;
|
||||
#endif
|
||||
void *buf;
|
||||
@@ -159,8 +168,7 @@ ATF_TC_BODY(mlock_err, tc)
|
||||
#endif
|
||||
(void)free(buf);
|
||||
|
||||
/* There is no sbrk on AArch64 and RISC-V */
|
||||
#if !defined(__aarch64__) && !defined(__riscv)
|
||||
#ifdef HAVE_SBRK
|
||||
/*
|
||||
* Try to create a pointer to an unmapped page - first after current
|
||||
* brk will likely do.
|
||||
|
||||
Reference in new issue
Block a user