diff options
author | ngie <ngie@FreeBSD.org> | 2014-10-10 21:22:25 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-10-10 21:22:25 +0000 |
commit | e2ee0b35f844a7c0f9b4ee0ea49371df496ae584 (patch) | |
tree | 0ac2a7171393c5eb71551fa2ec1912547fdb00f8 /contrib/netbsd-tests/lib/libc/gen | |
parent | 653a540178a700c6fcf8cfc0fa0683eb8ba5043d (diff) | |
download | FreeBSD-src-e2ee0b35f844a7c0f9b4ee0ea49371df496ae584.zip FreeBSD-src-e2ee0b35f844a7c0f9b4ee0ea49371df496ae584.tar.gz |
Port the testcase to FreeBSD
- Make #include path to h_macros.h a non-relative path
- __gl_stat_t is synonymous with struct stat on FreeBSD
- FreeBSD doesn't have _DIRENT_RECLEN
- Skip over glob_star on FreeBSD (testcase doesn't pass)
In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/gen')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/gen/t_glob.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/gen/t_glob.c b/contrib/netbsd-tests/lib/libc/gen/t_glob.c index ff62b63..1611bfa 100644 --- a/contrib/netbsd-tests/lib/libc/gen/t_glob.c +++ b/contrib/netbsd-tests/lib/libc/gen/t_glob.c @@ -46,7 +46,13 @@ __RCSID("$NetBSD: t_glob.c,v 1.3 2013/01/02 11:28:48 martin Exp $"); #include <string.h> #include <errno.h> +#if defined(__FreeBSD__) +#include "h_macros.h" +#define __gl_stat_t struct stat +#define _S_IFDIR S_IFDIR +#else #include "../../../h_macros.h" +#endif #ifdef DEBUG @@ -132,7 +138,11 @@ gl_readdir(void *v) dir.d_ino = dd->pos; dir.d_type = f->dir ? DT_DIR : DT_REG; DPRINTF(("readdir %s %d\n", dir.d_name, dir.d_type)); +#if defined(__FreeBSD__) + dir.d_reclen = -1; /* Does not have _DIRENT_RECLEN */ +#else dir.d_reclen = _DIRENT_RECLEN(&dir, dir.d_namlen); +#endif return &dir; } return NULL; @@ -213,6 +223,7 @@ run(const char *p, int flags, const char **res, size_t len) } +#if !defined(__FreeBSD__) ATF_TC(glob_star); ATF_TC_HEAD(glob_star, tc) { @@ -224,6 +235,7 @@ ATF_TC_BODY(glob_star, tc) { run("a/**", GLOB_STAR, glob_star, __arraycount(glob_star)); } +#endif ATF_TC(glob_star_not); ATF_TC_HEAD(glob_star_not, tc) @@ -260,7 +272,9 @@ ATF_TC_BODY(glob_nocheck, tc) ATF_TP_ADD_TCS(tp) { +#if !defined(__FreeBSD__) ATF_TP_ADD_TC(tp, glob_star); +#endif ATF_TP_ADD_TC(tp, glob_star_not); /* * Remove this test for now - the GLOB_NOCHECK return value has been |