merge irix dmapi test changes
[xfstests-dev.git] / dmapi / src / suite2 / menu_test
1 #!/bin/ksh
2
3 #
4 # Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
5
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of version 2 of the GNU General Public License as
8 # published by the Free Software Foundation.
9
10 # This program is distributed in the hope that it would be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 # Further, this software is distributed without any warranty that it is
15 # free of the rightful claim of any third person regarding infringement
16 # or the like.  Any license provided herein, whether implied or
17 # otherwise, applies only to this software file.  Patent licenses, if
18 # any, provided herein do not apply to combinations of this program with
19 # other software, or any other product whatsoever.
20
21 # You should have received a copy of the GNU General Public License along
22 # with this program; if not, write the Free Software Foundation, Inc., 59
23 # Temple Place - Suite 330, Boston MA 02111-1307, USA.
24
25 # Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
26 # Mountain View, CA  94043, or:
27
28 # http://www.sgi.com 
29
30 # For further information regarding this notice, see: 
31
32 # http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
33
34 #---------------------------------------------------------------------------
35 # CONFIGURATION SECTION:  
36 #    Configure this script by changing the variables in this section.
37 #    Please change ONLY this section!
38 #---------------------------------------------------------------------------
39
40 # Base directory:
41 base_dir="/home/poplar45/kfr/dmapi/test/laguna/jaytest"
42
43 # Primary username:
44 p_user="kfr"
45
46 # Path to the mountpoint of the test filesystem:
47 m_main="/dmapi"
48
49 # m_main concatenated with d_name == the full test directory path
50 #
51 # EXAMPLE:  If m_main is "/dmitest", and the test directory
52 # is "/dmitest/test", set this to "/test"
53 #
54 d_name="/kfr/test_dir"
55
56 # Path to the mountpoint of the nfs2 test filesystem:
57 m_nfs2="/dmapi/kfr/nfs2"
58
59 # Path to the mountpoint of the nfs3 test filesystem:
60 m_nfs3="/dmapi/kfr/nfs3"
61
62 # Path to the mountpoint of the realtime test filesystem:
63 m_rt="/dmf"
64 # Path to the realtime test directory:
65 d_rt="$m_rt/kcm"
66
67 #--------------------------------------------------------------------
68 # END OF CONFIGURATION SECTION:
69 #    No changes should be made past this point!  Please change only   
70 #    the above shell variables to configure this script.
71 #--------------------------------------------------------------------
72
73 # Path to the "bindir" directory:
74 bin="$base_dir/bindir"
75
76 # Path to the "generic file" (a copy of ls): 
77 ls_path="$bin/ls_to_copy"
78
79 # Path to the main test directory:
80 d_main="$m_main$d_name"
81
82 # Path to the nfs2 test directory:
83 d_nfs2="$m_nfs2$d_name"
84
85 # Path to the nfs3 test directory:
86 d_nfs3="$m_nfs2$d_name"
87
88 PS3="> "
89 unset Vflag
90 unset Pflag
91
92 while true
93 do 
94 clear
95 print "+-------------------------+"
96 print "| DMAPI tests:  main menu |"
97 print "+-------------------------+\n"
98 select menu1 in 'DMAPI function tests, which run without a daemon' \
99                 'DMAPI event tests, which invoke and monitor a daemon' \
100                 'Basic DMAPI existence/version test' \
101                 'quit'
102 do case $menu1 in
103     'DMAPI function tests, which run without a daemon')
104     while true 
105     do
106     if [[ $Vflag = -v ]] 
107     then Vstr='turn off verbose mode'
108     else Vstr='turn on verbose mode'
109     fi
110     clear
111     print "+----------------------+"
112     print "| DMAPI function tests |"
113     print "+----------------------+\n"
114     select menu2 in  'ALL of the following function tests:' \
115                     '    get/set_dmattr' \
116                     '    get/set_eventlist' \
117                     '    get/set_fileattr, get_bulkattr, get_dirattrs' \
118                     '    probe/punch_hole' \
119                     '    read/write_invis' \
120                     '    get/set_region' \
121                     '    get_allocinfo vs. xfs_bmap' \
122                     '    get_allocinfo with various buffer sizes' \
123                     '    EFAULT errno' \
124                     '    EACCES errno and access rights' \
125                     "$Vstr" \
126                     'previous menu' \
127                     'quit'
128      do case $menu2 in
129         'ALL of the following function tests:')
130             for run_me in \
131                 "$bin/test_dmattr $Vflag $ls_path $d_main" \
132                 "$bin/test_eventlist $Vflag $ls_path $d_main" \
133                 "$bin/test_fileattr $Vflag $ls_path $d_main" \
134                 "$bin/test_hole $Vflag $ls_path $d_main" \
135                 "$bin/test_invis $Vflag $ls_path $d_main" \
136                 "$bin/test_region $Vflag $ls_path $d_main" \
137                 "$bin/test_efault $Vflag $ls_path $d_main" \
138                 "$bin/test_rights $Vflag $ls_path $d_main" \
139                 "$bin/test_allocinfo_1 $bin $d_main" \
140                 "$bin/test_allocinfo_2  $bin $d_main" 
141             do
142             eval $run_me
143             print "Press enter to continue..."; read go
144             done
145             break;;     
146         '    get/set_dmattr')
147             eval "$bin/test_dmattr $Vflag $ls_path $d_main"
148             print "Press enter to continue..."; read go
149             break;;
150         '    get/set_eventlist')
151             eval "$bin/test_eventlist $Vflag $ls_path $d_main"
152             print "Press enter to continue..."; read go
153             break;;
154         '    get/set_fileattr, get_bulkattr, get_dirattrs')
155             eval "$bin/test_fileattr $Vflag $ls_path $d_main"
156             print "Press enter to continue..."; read go
157             break;;
158         '    probe/punch_hole')
159             eval "$bin/test_hole $Vflag $ls_path $d_main"
160             print "Press enter to continue..."; read go
161             break;;
162         '    read/write_invis')
163             eval "$bin/test_invis $Vflag $ls_path $d_main"
164             print "Press enter to continue..."; read go
165             break;;
166         '    get/set_region')
167             eval "$bin/test_region $Vflag $ls_path $d_main"
168             print "Press enter to continue..."; read go
169             break;; 
170         '    EFAULT errno') 
171             eval "$bin/test_efault $Vflag $ls_path $d_main"
172             print "Press enter to continue..."; read go
173             break;;
174         '    EACCES errno and access rights')
175             eval "$bin/test_rights $Vflag $ls_path $d_main"
176             break;;
177         '    get_allocinfo vs. xfs_bmap')
178             eval "$bin/test_allocinfo_1 $bin $d_main" 
179             print "Press enter to continue..."; read go
180             break;;
181         '    get_allocinfo with various buffer sizes')
182             eval "$bin/test_allocinfo_2  $bin $d_main"
183             print "Press enter to continue..."; read go
184             break;;
185         "$Vstr")
186             if [[ $Vflag = -v ]] 
187             then unset Vflag 
188             else Vflag=-v
189             fi
190             break;;
191         'previous menu')
192             break 2;;
193         'quit')
194             exit 0;;
195         *) break;;
196        esac
197     done
198     done
199     break;;
200
201     'DMAPI event tests, which invoke and monitor a daemon' )
202     while true
203     do
204     if [[ $Pflag = -p ]] 
205     then Pstr='turn off pausing after each command'
206     else Pstr='turn on pausing after each command'
207     fi
208     clear
209     print "+--------------------------+"
210     print "| DMAPI daemon/event tests |"
211     print "+--------------------------+\n"
212     select menu2 in 'ALL of the following four:' \
213                     '    standard i/o' \
214                     '    abort responses to events, and other i/o' \
215                     '    unsuccessful commands (bad file permissions)' \
216                     '    dm_pending' \
217                     'realtime filesystem' \
218                     'small event queue' \
219                     'nfs2 tests' \
220                     'nfs3 tests' \
221                     "$Pstr" \
222                     'previous menu' \
223                     'quit'
224     do case $menu2 in
225         'ALL of the following four:')
226         for run_me in \
227             "$bin/run_test $Pflag -u $p_user -f standard.dat $bin $d_main $m_main" \
228             "$bin/run_test $Pflag -u $p_user $bin $d_main $m_main" \
229             "$bin/run_test $Pflag -u $p_user -f fail.dat $bin $d_main $m_main" \
230             "$bin/run_test $Pflag -u $p_user -f pending.dat $bin $d_main $m_main" 
231         do
232             eval $run_me
233         done
234         break;;
235         '    standard i/o')
236             eval "$bin/run_test $Pflag -u $p_user -f standard.dat $bin $d_main $m_main"
237             break;;
238         '    abort responses to events, and other i/o')
239             eval "$bin/run_test $Pflag -u $p_user $bin $d_main $m_main"
240             break;;
241         '    unsuccessful commands (bad file permissions)')
242             eval "$bin/run_test $Pflag -u $p_user -f fail.dat $bin $d_main $m_main"
243             break;;
244         '    dm_pending')
245             eval "$bin/run_test $Pflag -u $p_user -f pending.dat $bin $d_main $m_main"
246             break;;
247         'nfs2 tests')
248             while true
249             do
250             clear
251             print "+--------------------------------+"
252             print "| DMAPI daemon/event tests: nfs2 |"
253             print "+--------------------------------+\n"
254             select menu3 in 'ALL of the following four:' \
255                             '    nfs2: standard i/o' \
256                             '    nfs2: abort responses to events, and other i/o' \
257                             '    nfs2: unsuccessful commands (bad file permissions)' \
258                             '    nfs2: dm_pending' \
259                             'previous menu' \
260                             'quit'
261             do case $menu3 in
262                 'ALL of the following four:')
263                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f standard_nfs.dat $bin $d_nfs2 $m_main"
264                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f nfs.dat $bin $d_nfs2 $m_main"
265                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f fail.dat $bin $d_nfs2 $m_main"
266                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f pending_nfs.dat $bin $d_nfs2 $m_main"
267                     break;;
268                 '    nfs2: standard i/o')
269                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f standard_nfs.dat $bin $d_nfs2 $m_main"
270                     break;;
271                 '    nfs2: abort responses to events, and other i/o')
272                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f nfs.dat $bin $d_nfs2 $m_main"
273                     break;;
274                 '    nfs2: unsuccessful commands (bad file permissions)')
275                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f fail.dat $bin $d_nfs2 $m_main"
276                     break;;
277                 '    nfs2: dm_pending')
278                     eval "$bin/run_test $Pflag -u $p_user -F nfs2 -M $m_nfs2 -R $d_main -f pending_nfs.dat $bin $d_nfs2 $m_main"
279                     break;;
280                 'previous menu')
281                     break 2;;
282                 'quit')
283                     exit 0;;
284                esac
285             done
286             done
287             break;;
288         'nfs3 tests')
289             while true 
290             do
291             clear
292             print "+--------------------------------+"
293             print "| DMAPI daemon/event tests: nfs3 |"
294             print "+--------------------------------+"
295             select menu3 in 'ALL of the following four:' \
296                             '    nfs3: standard i/o' \
297                             '    nfs3: abort responses to events, and other i/o' \
298                             '    nfs3: unsuccessful commands (bad file permissions)' \
299                             '    nfs3: dm_pending' \
300                             'previous menu' \
301                             'quit'
302             do case $menu3 in
303                 'ALL of the following four:')
304                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f standard_nfs.dat $bin $d_nfs3 $m_main"
305                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f nfs.dat $bin $d_nfs3 $m_main"
306                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f fail.dat $bin $d_nfs3 $m_main"
307                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f pending_nfs.dat $bin $d_nfs3 $m_main"
308                     break;;
309                 '    nfs3: standard i/o')
310                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f standard_nfs.dat $bin $d_nfs3 $m_main"
311                     break;;
312                 '    nfs3: abort responses to events, and other i/o')
313                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f nfs.dat $bin $d_nfs3 $m_main"
314                     break;;
315                 '    nfs3: unsuccessful commands (bad file permissions)')
316                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f fail.dat $bin $d_nfs3 $m_main"
317                     break;;
318                 '    nfs3: dm_pending')
319                     eval "$bin/run_test $Pflag -u $p_user -F nfs3 -M $m_nfs3 -R $d_main -f pending_nfs.dat $bin $d_nfs3 $m_main"
320                     break;;
321                 'previous menu')
322                     break 2;;
323                 'quit')
324                     exit 0;;
325                esac
326             done
327             done
328             break;;
329         'realtime filesystem')
330             eval "$bin/run_test $Pflag -u $p_user -f realtime.dat $bin $d_rt $m_rt"
331             break;;
332         'small event queue')
333             # Set dm_max_queued to about 5 or so before running!
334             eval "$bin/run_test $Pflag -u $p_user -s 2 -f smallq.dat $bin $d_main $m_main"
335             break;;
336         "$Pstr")
337             if [[ $Pflag = -p ]] 
338             then unset Pflag
339             else Pflag=-p
340             fi
341             break;;
342         'previous menu')
343             break 2;;
344         'quit')
345             exit 0;;
346        esac
347     done
348     done
349     break;;
350     'Basic DMAPI existence/version test')
351        eval "$bin/check_dmapi $Vflag"
352        print "Press enter to continue..."; read go
353        break;;
354     quit)
355        break 2;;
356     esac
357     done
358 done