Drop main() prototype. Syncs with NetBSD-8
[minix.git] / tests / fs / tmpfs / t_mknod.sh
blob62c7cce2283473e46fab9a34939213dba6c685b4
1 # $NetBSD: t_mknod.sh,v 1.5 2010/11/07 17:51:18 jmmv Exp $
3 # Copyright (c) 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 # POSSIBILITY OF SUCH DAMAGE.
29 # Verifies that the mknod operation works.
32 atf_test_case block
33 block_head() {
34 atf_set "descr" "Tests that block devices can be created"
35 atf_set "require.user" "root"
37 block_body() {
38 test_mount
39 umask 022
41 atf_check -s eq:0 -o empty -e empty mknod fd0a b 2 0
42 eval $(stat -s fd0a)
43 [ ${st_mode} = 060644 ] || atf_fail "Invalid mode"
44 [ ${st_rdev} -eq 512 ] || atf_fail "Invalid device"
46 test_unmount
49 atf_test_case block_kqueue
50 block_kqueue_head() {
51 atf_set "descr" "Tests that creating a block device raises the" \
52 "appropriate kqueue events"
53 atf_set "require.user" "root"
55 block_kqueue_body() {
56 test_mount
57 umask 022
59 atf_check -s eq:0 -o empty -e empty mkdir dir
60 echo 'mknod dir/fd0a b 2 0' | kqueue_monitor 1 dir
61 kqueue_check dir NOTE_WRITE
63 test_unmount
66 atf_test_case char
67 char_head() {
68 atf_set "descr" "Tests that character devices can be created"
69 atf_set "require.user" "root"
71 char_body() {
72 test_mount
73 umask 022
75 atf_check -s eq:0 -o empty -e empty mknod null c 2 2
76 eval $(stat -s null)
77 [ ${st_mode} = 020644 ] || atf_fail "Invalid mode"
78 [ ${st_rdev} -eq 514 ] || atf_fail "Invalid device"
80 test_unmount
83 atf_test_case char_kqueue
84 char_kqueue_head() {
85 atf_set "descr" "Tests that creating a character device raises the" \
86 "appropriate kqueue events"
87 atf_set "require.user" "root"
89 char_kqueue_body() {
90 test_mount
91 umask 022
93 atf_check -s eq:0 -o empty -e empty mkdir dir
94 echo 'mknod dir/null c 2 2' | kqueue_monitor 1 dir
95 kqueue_check dir NOTE_WRITE
97 test_unmount
100 atf_test_case pipe
101 pipe_head() {
102 atf_set "descr" "Tests that named pipes can be created"
103 atf_set "require.user" "root"
105 pipe_body() {
106 test_mount
107 umask 022
109 atf_check -s eq:0 -o empty -e empty mknod pipe p
110 eval $(stat -s pipe)
111 [ ${st_mode} = 010644 ] || atf_fail "Invalid mode"
113 test_unmount
116 atf_test_case pipe_kqueue
117 pipe_kqueue_head() {
118 atf_set "descr" "Tests that creating a named pipe raises the" \
119 "appropriate kqueue events"
120 atf_set "require.user" "root"
122 pipe_kqueue_body() {
123 test_mount
124 umask 022
126 atf_check -s eq:0 -o empty -e empty mkdir dir
127 echo 'mknod dir/pipe p' | kqueue_monitor 1 dir
128 kqueue_check dir NOTE_WRITE
130 test_unmount
133 atf_init_test_cases() {
134 . $(atf_get_srcdir)/../h_funcs.subr
135 . $(atf_get_srcdir)/h_funcs.subr
137 atf_add_test_case block
138 atf_add_test_case block_kqueue
139 atf_add_test_case char
140 atf_add_test_case char_kqueue
141 atf_add_test_case pipe
142 atf_add_test_case pipe_kqueue