Add expected failure test for posix_fadvise() panic reported by yamt

on source-changes-d.
This commit is contained in:
pooka 2010-11-11 14:50:58 +00:00
parent e2e0c29553
commit 7c8241e470
1 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: t_posix_fadvise.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $ */ /* $NetBSD: t_posix_fadvise.c,v 1.2 2010/11/11 14:50:58 pooka Exp $ */
/*- /*-
* Copyright (c) 2008 The NetBSD Foundation, Inc. * Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2008\ __COPYRIGHT("@(#) Copyright (c) 2008\
The NetBSD Foundation, inc. All rights reserved."); The NetBSD Foundation, inc. All rights reserved.");
__RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $"); __RCSID("$NetBSD: t_posix_fadvise.c,v 1.2 2010/11/11 14:50:58 pooka Exp $");
#include <sys/fcntl.h> #include <sys/fcntl.h>
@ -70,6 +70,9 @@ __RCSID("$NetBSD: t_posix_fadvise.c,v 1.1 2009/02/20 21:39:57 jmmv Exp $");
#include "../h_macros.h" #include "../h_macros.h"
#include <rump/rump.h>
#include <rump/rump_syscalls.h>
ATF_TC(posix_fadvise); ATF_TC(posix_fadvise);
ATF_TC_HEAD(posix_fadvise, tc) ATF_TC_HEAD(posix_fadvise, tc)
{ {
@ -80,11 +83,15 @@ ATF_TC_BODY(posix_fadvise, tc)
int fd = STDIN_FILENO; int fd = STDIN_FILENO;
int pipe_fds[2]; int pipe_fds[2];
int badfd = 10; int badfd = 10;
int rfd;
int ret; int ret;
(void)close(badfd); (void)close(badfd);
RL(pipe(pipe_fds)); RL(pipe(pipe_fds));
rump_init();
RL(rfd = rump_sys_open("/a_file", O_CREAT, 0666));
/* /*
* it's hard to check if posix_fadvise is working properly. * it's hard to check if posix_fadvise is working properly.
* only check return values here. * only check return values here.
@ -110,6 +117,8 @@ ATF_TC_BODY(posix_fadvise, tc)
CE(posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED), 0); CE(posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED), 0);
CE(posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED), 0); CE(posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED), 0);
CE(posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE), 0); CE(posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE), 0);
atf_tc_expect_signal(-1, "http://mail-index.netbsd.org/source-changes-d/2010/11/11/msg002508.html");
CE(rump_sys_posix_fadvise(rfd, 0, 0, POSIX_FADV_DONTNEED), 0);
#undef CE #undef CE
} }