xref: /netbsd-src/tests/dev/scsipi/t_cd.c (revision 53357666091e4d96696bf05a8cb15ec0541ff5f1)
1*53357666Spooka /*	$NetBSD: t_cd.c,v 1.1 2010/08/24 11:29:45 pooka Exp $	*/
2*53357666Spooka 
3*53357666Spooka /*
4*53357666Spooka  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
5*53357666Spooka  *
6*53357666Spooka  * Redistribution and use in source and binary forms, with or without
7*53357666Spooka  * modification, are permitted provided that the following conditions
8*53357666Spooka  * are met:
9*53357666Spooka  * 1. Redistributions of source code must retain the above copyright
10*53357666Spooka  *    notice, this list of conditions and the following disclaimer.
11*53357666Spooka  * 2. Redistributions in binary form must reproduce the above copyright
12*53357666Spooka  *    notice, this list of conditions and the following disclaimer in the
13*53357666Spooka  *    documentation and/or other materials provided with the distribution.
14*53357666Spooka  *
15*53357666Spooka  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16*53357666Spooka  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17*53357666Spooka  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18*53357666Spooka  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19*53357666Spooka  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20*53357666Spooka  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21*53357666Spooka  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22*53357666Spooka  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23*53357666Spooka  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24*53357666Spooka  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25*53357666Spooka  * SUCH DAMAGE.
26*53357666Spooka  */
27*53357666Spooka 
28*53357666Spooka #include <sys/types.h>
29*53357666Spooka #include <sys/ioctl.h>
30*53357666Spooka 
31*53357666Spooka #include <atf-c.h>
32*53357666Spooka #include <fcntl.h>
33*53357666Spooka #include <stdio.h>
34*53357666Spooka 
35*53357666Spooka #include <rump/rump.h>
36*53357666Spooka #include <rump/rump_syscalls.h>
37*53357666Spooka #include <rump/scsitest.h>
38*53357666Spooka 
39*53357666Spooka #include "../../h_macros.h"
40*53357666Spooka 
41*53357666Spooka ATF_TC(noisyeject);
42*53357666Spooka ATF_TC_HEAD(noisyeject, tc)
43*53357666Spooka {
44*53357666Spooka 
45*53357666Spooka 	atf_tc_set_md_var(tc, "descr", "test for CD eject noisyness "
46*53357666Spooka 	    "(PR kern/43785)");
47*53357666Spooka }
48*53357666Spooka 
49*53357666Spooka ATF_TC_BODY(noisyeject, tc)
50*53357666Spooka {
51*53357666Spooka 	int fd, arg = 0;
52*53357666Spooka 
53*53357666Spooka 	rump_init();
54*53357666Spooka 	RL(fd = rump_sys_open("/dev/rcd0d", O_RDWR));
55*53357666Spooka 	RL(rump_sys_ioctl(fd, DIOCEJECT, &arg));
56*53357666Spooka 
57*53357666Spooka 	ATF_REQUIRE_EQ(rump_scsitest_err[RUMP_SCSITEST_NOISYSYNC], 0);
58*53357666Spooka 	RL(rump_sys_close(fd));
59*53357666Spooka 	atf_tc_expect_fail("PR kern/43785");
60*53357666Spooka 	ATF_REQUIRE_EQ(rump_scsitest_err[RUMP_SCSITEST_NOISYSYNC], 0);
61*53357666Spooka }
62*53357666Spooka 
63*53357666Spooka ATF_TP_ADD_TCS(tp)
64*53357666Spooka {
65*53357666Spooka 
66*53357666Spooka 	ATF_TP_ADD_TC(tp, noisyeject);
67*53357666Spooka 
68*53357666Spooka 	return atf_no_error();
69*53357666Spooka }
70