xref: /freebsd/contrib/netbsd-tests/bin/df/t_df.sh (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $NetBSD: t_df.sh,v 1.1 2012/03/17 16:33:11 jruoho Exp $
2#
3# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
4# All rights reserved.
5#
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.
14#
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.
26#
27
28atf_test_case normal
29normal_head() {
30	atf_set "descr" "Checks that the output of df without flags is" \
31	                "correct according to some already-known, sane" \
32	                "output"
33}
34normal_body() {
35	cat >expout <<EOF
36Filesystem    1K-blocks       Used      Avail %Cap Mounted on
37filer:/      1202716672     135168 1202581504   0% /filer
38filer:/      1202716672          0 1202716672   0% /filer
39filer:/      1202716672  240543334  962173337  20% /filer
40filer:/      1202716672  721630003  481086668  60% /filer
41filer:/      1202716672 1142580838   60135833  95% /filer
42filer:/      1202716672 1202716672          0 100% /filer
43filer:/      1202716672          0 1142580838   0% /filer
44filer:/      1202716672  240543334  902037504  21% /filer
45filer:/      1202716672  721630003  420950835  63% /filer
46filer:/      1202716672 1142580838          0 100% /filer
47filer:/      1202716672 1202716672  -60135833 105% /filer
48filer:/      1202716672          0 1082445004   0% /filer
49filer:/      1202716672  240543334  841901670  22% /filer
50filer:/      1202716672  721630003  360815001  66% /filer
51filer:/      1202716672 1142580838  -60135833 105% /filer
52filer:/      1202716672 1202716672 -120271667 111% /filer
53filer:/      1202716672          0 1022309171   0% /filer
54filer:/      1202716672  240543334  781765836  23% /filer
55filer:/      1202716672  721630003  300679168  70% /filer
56filer:/      1202716672 1142580838 -120271667 111% /filer
57filer:/      1202716672 1202716672 -180407500 117% /filer
58/dev/ld0g    1308726116   17901268 1225388540   1% /anon-root
59/dev/ld0g    1308726116          0 1308726116   0% /anon-root
60/dev/ld0g    1308726116  261745224 1046980892  20% /anon-root
61/dev/ld0g    1308726116  785235672  523490444  60% /anon-root
62/dev/ld0g    1308726116 1243289812   65436304  95% /anon-root
63/dev/ld0g    1308726116 1308726116          0 100% /anon-root
64/dev/ld0g    1308726116          0 1243289808   0% /anon-root
65/dev/ld0g    1308726116  261745224  981544584  21% /anon-root
66/dev/ld0g    1308726116  785235672  458054140  63% /anon-root
67/dev/ld0g    1308726116 1243289812          0 100% /anon-root
68/dev/ld0g    1308726116 1308726116  -65436304 105% /anon-root
69/dev/ld0g    1308726116          0 1177853504   0% /anon-root
70/dev/ld0g    1308726116  261745224  916108280  22% /anon-root
71/dev/ld0g    1308726116  785235672  392617832  66% /anon-root
72/dev/ld0g    1308726116 1243289812  -65436304 105% /anon-root
73/dev/ld0g    1308726116 1308726116 -130872608 111% /anon-root
74/dev/ld0g    1308726116          0 1112417196   0% /anon-root
75/dev/ld0g    1308726116  261745224  850671972  23% /anon-root
76/dev/ld0g    1308726116  785235672  327181528  70% /anon-root
77/dev/ld0g    1308726116 1243289812 -130872608 111% /anon-root
78/dev/ld0g    1308726116 1308726116 -196308916 117% /anon-root
79/dev/strpct  21474836476 10737418240 10737418236  50% /strpct
80/dev/wd0e      10485688    2859932    7625756  27% /mount/windows/C
81EOF
82	atf_check -s eq:0 -o file:expout -e empty \
83	    -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
84}
85
86atf_test_case hflag
87hflag_head() {
88	atf_set "descr" "Checks that the output of df is correct according" \
89	                "to some already-known, sane output when using the" \
90	                "human readable format"
91}
92hflag_body() {
93	cat >expout <<EOF
94Filesystem         Size       Used      Avail %Cap Mounted on
95filer:/            1.1T       132M       1.1T   0% /filer
96filer:/            1.1T         0B       1.1T   0% /filer
97filer:/            1.1T       229G       918G  20% /filer
98filer:/            1.1T       688G       459G  60% /filer
99filer:/            1.1T       1.1T        57G  95% /filer
100filer:/            1.1T       1.1T         0B 100% /filer
101filer:/            1.1T         0B       1.1T   0% /filer
102filer:/            1.1T       229G       860G  21% /filer
103filer:/            1.1T       688G       401G  63% /filer
104filer:/            1.1T       1.1T         0B 100% /filer
105filer:/            1.1T       1.1T       -57G 105% /filer
106filer:/            1.1T         0B       1.0T   0% /filer
107filer:/            1.1T       229G       803G  22% /filer
108filer:/            1.1T       688G       344G  66% /filer
109filer:/            1.1T       1.1T       -57G 105% /filer
110filer:/            1.1T       1.1T      -115G 111% /filer
111filer:/            1.1T         0B       975G   0% /filer
112filer:/            1.1T       229G       746G  23% /filer
113filer:/            1.1T       688G       287G  70% /filer
114filer:/            1.1T       1.1T      -115G 111% /filer
115filer:/            1.1T       1.1T      -172G 117% /filer
116/dev/ld0g          1.2T        17G       1.1T   1% /anon-root
117/dev/ld0g          1.2T         0B       1.2T   0% /anon-root
118/dev/ld0g          1.2T       250G       998G  20% /anon-root
119/dev/ld0g          1.2T       749G       499G  60% /anon-root
120/dev/ld0g          1.2T       1.2T        62G  95% /anon-root
121/dev/ld0g          1.2T       1.2T         0B 100% /anon-root
122/dev/ld0g          1.2T         0B       1.2T   0% /anon-root
123/dev/ld0g          1.2T       250G       936G  21% /anon-root
124/dev/ld0g          1.2T       749G       437G  63% /anon-root
125/dev/ld0g          1.2T       1.2T         0B 100% /anon-root
126/dev/ld0g          1.2T       1.2T       -62G 105% /anon-root
127/dev/ld0g          1.2T         0B       1.1T   0% /anon-root
128/dev/ld0g          1.2T       250G       874G  22% /anon-root
129/dev/ld0g          1.2T       749G       374G  66% /anon-root
130/dev/ld0g          1.2T       1.2T       -62G 105% /anon-root
131/dev/ld0g          1.2T       1.2T      -125G 111% /anon-root
132/dev/ld0g          1.2T         0B       1.0T   0% /anon-root
133/dev/ld0g          1.2T       250G       811G  23% /anon-root
134/dev/ld0g          1.2T       749G       312G  70% /anon-root
135/dev/ld0g          1.2T       1.2T      -125G 111% /anon-root
136/dev/ld0g          1.2T       1.2T      -187G 117% /anon-root
137/dev/strpct         20T        10T        10T  50% /strpct
138/dev/wd0e           10G       2.7G       7.3G  27% /mount/windows/C
139EOF
140	atf_check -s eq:0 -o file:expout -e empty \
141	    -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
142}
143
144atf_init_test_cases()
145{
146	atf_add_test_case normal
147	atf_add_test_case hflag
148}
149