t_df.sh revision 1.2 1 1.2 ryo # $NetBSD: t_df.sh,v 1.2 2020/08/23 15:51:30 ryo Exp $
2 1.1 jruoho #
3 1.1 jruoho # Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
4 1.1 jruoho # All rights reserved.
5 1.1 jruoho #
6 1.1 jruoho # Redistribution and use in source and binary forms, with or without
7 1.1 jruoho # modification, are permitted provided that the following conditions
8 1.1 jruoho # are met:
9 1.1 jruoho # 1. Redistributions of source code must retain the above copyright
10 1.1 jruoho # notice, this list of conditions and the following disclaimer.
11 1.1 jruoho # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 jruoho # notice, this list of conditions and the following disclaimer in the
13 1.1 jruoho # documentation and/or other materials provided with the distribution.
14 1.1 jruoho #
15 1.1 jruoho # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 1.1 jruoho # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 1.1 jruoho # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 1.1 jruoho # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 1.1 jruoho # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 1.1 jruoho # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 1.1 jruoho # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 1.1 jruoho # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 1.1 jruoho # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 1.1 jruoho # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 1.1 jruoho # POSSIBILITY OF SUCH DAMAGE.
26 1.1 jruoho #
27 1.1 jruoho
28 1.1 jruoho atf_test_case normal
29 1.1 jruoho normal_head() {
30 1.1 jruoho atf_set "descr" "Checks that the output of df without flags is" \
31 1.1 jruoho "correct according to some already-known, sane" \
32 1.1 jruoho "output"
33 1.1 jruoho }
34 1.1 jruoho normal_body() {
35 1.1 jruoho cat >expout <<EOF
36 1.2 ryo Filesystem 1K-blocks Used Avail %Cap Mounted on
37 1.2 ryo filer:/ 1202716672 135168 1202581504 0% /filer
38 1.2 ryo filer:/ 1202716672 0 1202716672 0% /filer
39 1.2 ryo filer:/ 1202716672 240543334 962173337 20% /filer
40 1.2 ryo filer:/ 1202716672 721630003 481086668 60% /filer
41 1.2 ryo filer:/ 1202716672 1142580838 60135833 95% /filer
42 1.2 ryo filer:/ 1202716672 1202716672 0 100% /filer
43 1.2 ryo filer:/ 1202716672 0 1142580838 0% /filer
44 1.2 ryo filer:/ 1202716672 240543334 902037504 21% /filer
45 1.2 ryo filer:/ 1202716672 721630003 420950835 63% /filer
46 1.2 ryo filer:/ 1202716672 1142580838 0 100% /filer
47 1.2 ryo filer:/ 1202716672 1202716672 -60135833 105% /filer
48 1.2 ryo filer:/ 1202716672 0 1082445004 0% /filer
49 1.2 ryo filer:/ 1202716672 240543334 841901670 22% /filer
50 1.2 ryo filer:/ 1202716672 721630003 360815001 66% /filer
51 1.2 ryo filer:/ 1202716672 1142580838 -60135833 105% /filer
52 1.2 ryo filer:/ 1202716672 1202716672 -120271667 111% /filer
53 1.2 ryo filer:/ 1202716672 0 1022309171 0% /filer
54 1.2 ryo filer:/ 1202716672 240543334 781765836 23% /filer
55 1.2 ryo filer:/ 1202716672 721630003 300679168 70% /filer
56 1.2 ryo filer:/ 1202716672 1142580838 -120271667 111% /filer
57 1.2 ryo filer:/ 1202716672 1202716672 -180407500 117% /filer
58 1.2 ryo /dev/ld0g 1308726116 17901268 1225388540 1% /anon-root
59 1.2 ryo /dev/ld0g 1308726116 0 1308726116 0% /anon-root
60 1.2 ryo /dev/ld0g 1308726116 261745224 1046980892 20% /anon-root
61 1.2 ryo /dev/ld0g 1308726116 785235672 523490444 60% /anon-root
62 1.2 ryo /dev/ld0g 1308726116 1243289812 65436304 95% /anon-root
63 1.2 ryo /dev/ld0g 1308726116 1308726116 0 100% /anon-root
64 1.2 ryo /dev/ld0g 1308726116 0 1243289808 0% /anon-root
65 1.2 ryo /dev/ld0g 1308726116 261745224 981544584 21% /anon-root
66 1.2 ryo /dev/ld0g 1308726116 785235672 458054140 63% /anon-root
67 1.2 ryo /dev/ld0g 1308726116 1243289812 0 100% /anon-root
68 1.2 ryo /dev/ld0g 1308726116 1308726116 -65436304 105% /anon-root
69 1.2 ryo /dev/ld0g 1308726116 0 1177853504 0% /anon-root
70 1.2 ryo /dev/ld0g 1308726116 261745224 916108280 22% /anon-root
71 1.2 ryo /dev/ld0g 1308726116 785235672 392617832 66% /anon-root
72 1.2 ryo /dev/ld0g 1308726116 1243289812 -65436304 105% /anon-root
73 1.2 ryo /dev/ld0g 1308726116 1308726116 -130872608 111% /anon-root
74 1.2 ryo /dev/ld0g 1308726116 0 1112417196 0% /anon-root
75 1.2 ryo /dev/ld0g 1308726116 261745224 850671972 23% /anon-root
76 1.2 ryo /dev/ld0g 1308726116 785235672 327181528 70% /anon-root
77 1.2 ryo /dev/ld0g 1308726116 1243289812 -130872608 111% /anon-root
78 1.2 ryo /dev/ld0g 1308726116 1308726116 -196308916 117% /anon-root
79 1.2 ryo /dev/strpct 21474836476 10737418240 10737418236 50% /strpct
80 1.2 ryo /dev/wd0e 10485688 2859932 7625756 27% /mount/windows/C
81 1.1 jruoho EOF
82 1.1 jruoho atf_check -s eq:0 -o file:expout -e empty \
83 1.1 jruoho -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n"
84 1.1 jruoho }
85 1.1 jruoho
86 1.1 jruoho atf_test_case hflag
87 1.1 jruoho hflag_head() {
88 1.1 jruoho atf_set "descr" "Checks that the output of df is correct according" \
89 1.1 jruoho "to some already-known, sane output when using the" \
90 1.1 jruoho "human readable format"
91 1.1 jruoho }
92 1.1 jruoho hflag_body() {
93 1.1 jruoho cat >expout <<EOF
94 1.2 ryo Filesystem Size Used Avail %Cap Mounted on
95 1.2 ryo filer:/ 1.1T 132M 1.1T 0% /filer
96 1.2 ryo filer:/ 1.1T 0B 1.1T 0% /filer
97 1.2 ryo filer:/ 1.1T 229G 918G 20% /filer
98 1.2 ryo filer:/ 1.1T 688G 459G 60% /filer
99 1.2 ryo filer:/ 1.1T 1.1T 57G 95% /filer
100 1.2 ryo filer:/ 1.1T 1.1T 0B 100% /filer
101 1.2 ryo filer:/ 1.1T 0B 1.1T 0% /filer
102 1.2 ryo filer:/ 1.1T 229G 860G 21% /filer
103 1.2 ryo filer:/ 1.1T 688G 401G 63% /filer
104 1.2 ryo filer:/ 1.1T 1.1T 0B 100% /filer
105 1.2 ryo filer:/ 1.1T 1.1T -57G 105% /filer
106 1.2 ryo filer:/ 1.1T 0B 1.0T 0% /filer
107 1.2 ryo filer:/ 1.1T 229G 803G 22% /filer
108 1.2 ryo filer:/ 1.1T 688G 344G 66% /filer
109 1.2 ryo filer:/ 1.1T 1.1T -57G 105% /filer
110 1.2 ryo filer:/ 1.1T 1.1T -115G 111% /filer
111 1.2 ryo filer:/ 1.1T 0B 975G 0% /filer
112 1.2 ryo filer:/ 1.1T 229G 746G 23% /filer
113 1.2 ryo filer:/ 1.1T 688G 287G 70% /filer
114 1.2 ryo filer:/ 1.1T 1.1T -115G 111% /filer
115 1.2 ryo filer:/ 1.1T 1.1T -172G 117% /filer
116 1.2 ryo /dev/ld0g 1.2T 17G 1.1T 1% /anon-root
117 1.2 ryo /dev/ld0g 1.2T 0B 1.2T 0% /anon-root
118 1.2 ryo /dev/ld0g 1.2T 250G 998G 20% /anon-root
119 1.2 ryo /dev/ld0g 1.2T 749G 499G 60% /anon-root
120 1.2 ryo /dev/ld0g 1.2T 1.2T 62G 95% /anon-root
121 1.2 ryo /dev/ld0g 1.2T 1.2T 0B 100% /anon-root
122 1.2 ryo /dev/ld0g 1.2T 0B 1.2T 0% /anon-root
123 1.2 ryo /dev/ld0g 1.2T 250G 936G 21% /anon-root
124 1.2 ryo /dev/ld0g 1.2T 749G 437G 63% /anon-root
125 1.2 ryo /dev/ld0g 1.2T 1.2T 0B 100% /anon-root
126 1.2 ryo /dev/ld0g 1.2T 1.2T -62G 105% /anon-root
127 1.2 ryo /dev/ld0g 1.2T 0B 1.1T 0% /anon-root
128 1.2 ryo /dev/ld0g 1.2T 250G 874G 22% /anon-root
129 1.2 ryo /dev/ld0g 1.2T 749G 374G 66% /anon-root
130 1.2 ryo /dev/ld0g 1.2T 1.2T -62G 105% /anon-root
131 1.2 ryo /dev/ld0g 1.2T 1.2T -125G 111% /anon-root
132 1.2 ryo /dev/ld0g 1.2T 0B 1.0T 0% /anon-root
133 1.2 ryo /dev/ld0g 1.2T 250G 811G 23% /anon-root
134 1.2 ryo /dev/ld0g 1.2T 749G 312G 70% /anon-root
135 1.2 ryo /dev/ld0g 1.2T 1.2T -125G 111% /anon-root
136 1.2 ryo /dev/ld0g 1.2T 1.2T -187G 117% /anon-root
137 1.2 ryo /dev/strpct 20T 10T 10T 50% /strpct
138 1.2 ryo /dev/wd0e 10G 2.7G 7.3G 27% /mount/windows/C
139 1.1 jruoho EOF
140 1.1 jruoho atf_check -s eq:0 -o file:expout -e empty \
141 1.1 jruoho -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn"
142 1.1 jruoho }
143 1.1 jruoho
144 1.1 jruoho atf_init_test_cases()
145 1.1 jruoho {
146 1.1 jruoho atf_add_test_case normal
147 1.1 jruoho atf_add_test_case hflag
148 1.1 jruoho }
149