1*d8f5b04cSrillig# $NetBSD: t_df.sh,v 1.3 2024/04/28 07:27:40 rillig Exp $ 228604916Sjruoho# 328604916Sjruoho# Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. 428604916Sjruoho# All rights reserved. 528604916Sjruoho# 628604916Sjruoho# Redistribution and use in source and binary forms, with or without 728604916Sjruoho# modification, are permitted provided that the following conditions 828604916Sjruoho# are met: 928604916Sjruoho# 1. Redistributions of source code must retain the above copyright 1028604916Sjruoho# notice, this list of conditions and the following disclaimer. 1128604916Sjruoho# 2. Redistributions in binary form must reproduce the above copyright 1228604916Sjruoho# notice, this list of conditions and the following disclaimer in the 1328604916Sjruoho# documentation and/or other materials provided with the distribution. 1428604916Sjruoho# 1528604916Sjruoho# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 1628604916Sjruoho# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 1728604916Sjruoho# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 1828604916Sjruoho# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 1928604916Sjruoho# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2028604916Sjruoho# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2128604916Sjruoho# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2228604916Sjruoho# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2328604916Sjruoho# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2428604916Sjruoho# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2528604916Sjruoho# POSSIBILITY OF SUCH DAMAGE. 2628604916Sjruoho# 2728604916Sjruoho 2828604916Sjruohoatf_test_case normal 2928604916Sjruohonormal_head() { 3028604916Sjruoho atf_set "descr" "Checks that the output of df without flags is" \ 3128604916Sjruoho "correct according to some already-known, sane" \ 3228604916Sjruoho "output" 3328604916Sjruoho} 3428604916Sjruohonormal_body() { 3528604916Sjruoho cat >expout <<EOF 3628604916SjruohoFilesystem 1K-blocks Used Avail %Cap Mounted on 3728604916Sjruohofiler:/ 1202716672 135168 1202581504 0% /filer 3828604916Sjruohofiler:/ 1202716672 0 1202716672 0% /filer 3928604916Sjruohofiler:/ 1202716672 240543334 962173337 20% /filer 4028604916Sjruohofiler:/ 1202716672 721630003 481086668 60% /filer 4128604916Sjruohofiler:/ 1202716672 1142580838 60135833 95% /filer 4228604916Sjruohofiler:/ 1202716672 1202716672 0 100% /filer 4328604916Sjruohofiler:/ 1202716672 0 1142580838 0% /filer 4428604916Sjruohofiler:/ 1202716672 240543334 902037504 21% /filer 4528604916Sjruohofiler:/ 1202716672 721630003 420950835 63% /filer 4628604916Sjruohofiler:/ 1202716672 1142580838 0 100% /filer 4728604916Sjruohofiler:/ 1202716672 1202716672 -60135833 105% /filer 4828604916Sjruohofiler:/ 1202716672 0 1082445004 0% /filer 4928604916Sjruohofiler:/ 1202716672 240543334 841901670 22% /filer 5028604916Sjruohofiler:/ 1202716672 721630003 360815001 66% /filer 5128604916Sjruohofiler:/ 1202716672 1142580838 -60135833 105% /filer 5228604916Sjruohofiler:/ 1202716672 1202716672 -120271667 111% /filer 5328604916Sjruohofiler:/ 1202716672 0 1022309171 0% /filer 5428604916Sjruohofiler:/ 1202716672 240543334 781765836 23% /filer 5528604916Sjruohofiler:/ 1202716672 721630003 300679168 70% /filer 5628604916Sjruohofiler:/ 1202716672 1142580838 -120271667 111% /filer 5728604916Sjruohofiler:/ 1202716672 1202716672 -180407500 117% /filer 5828604916Sjruoho/dev/ld0g 1308726116 17901268 1225388540 1% /anon-root 5928604916Sjruoho/dev/ld0g 1308726116 0 1308726116 0% /anon-root 6028604916Sjruoho/dev/ld0g 1308726116 261745224 1046980892 20% /anon-root 6128604916Sjruoho/dev/ld0g 1308726116 785235672 523490444 60% /anon-root 6228604916Sjruoho/dev/ld0g 1308726116 1243289812 65436304 95% /anon-root 6328604916Sjruoho/dev/ld0g 1308726116 1308726116 0 100% /anon-root 6428604916Sjruoho/dev/ld0g 1308726116 0 1243289808 0% /anon-root 6528604916Sjruoho/dev/ld0g 1308726116 261745224 981544584 21% /anon-root 6628604916Sjruoho/dev/ld0g 1308726116 785235672 458054140 63% /anon-root 6728604916Sjruoho/dev/ld0g 1308726116 1243289812 0 100% /anon-root 6828604916Sjruoho/dev/ld0g 1308726116 1308726116 -65436304 105% /anon-root 6928604916Sjruoho/dev/ld0g 1308726116 0 1177853504 0% /anon-root 7028604916Sjruoho/dev/ld0g 1308726116 261745224 916108280 22% /anon-root 7128604916Sjruoho/dev/ld0g 1308726116 785235672 392617832 66% /anon-root 7228604916Sjruoho/dev/ld0g 1308726116 1243289812 -65436304 105% /anon-root 7328604916Sjruoho/dev/ld0g 1308726116 1308726116 -130872608 111% /anon-root 7428604916Sjruoho/dev/ld0g 1308726116 0 1112417196 0% /anon-root 7528604916Sjruoho/dev/ld0g 1308726116 261745224 850671972 23% /anon-root 7628604916Sjruoho/dev/ld0g 1308726116 785235672 327181528 70% /anon-root 7728604916Sjruoho/dev/ld0g 1308726116 1243289812 -130872608 111% /anon-root 7828604916Sjruoho/dev/ld0g 1308726116 1308726116 -196308916 117% /anon-root 7928604916Sjruoho/dev/strpct 21474836476 10737418240 10737418236 50% /strpct 8028604916Sjruoho/dev/wd0e 10485688 2859932 7625756 27% /mount/windows/C 8128604916SjruohoEOF 82*d8f5b04cSrillig atf_check -s exit:0 -o file:expout -e empty \ 8328604916Sjruoho -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -n" 8428604916Sjruoho} 8528604916Sjruoho 8628604916Sjruohoatf_test_case hflag 8728604916Sjruohohflag_head() { 8828604916Sjruoho atf_set "descr" "Checks that the output of df is correct according" \ 8928604916Sjruoho "to some already-known, sane output when using the" \ 9028604916Sjruoho "human readable format" 9128604916Sjruoho} 9228604916Sjruohohflag_body() { 9328604916Sjruoho cat >expout <<EOF 9428604916SjruohoFilesystem Size Used Avail %Cap Mounted on 9528604916Sjruohofiler:/ 1.1T 132M 1.1T 0% /filer 9628604916Sjruohofiler:/ 1.1T 0B 1.1T 0% /filer 9728604916Sjruohofiler:/ 1.1T 229G 918G 20% /filer 9828604916Sjruohofiler:/ 1.1T 688G 459G 60% /filer 9928604916Sjruohofiler:/ 1.1T 1.1T 57G 95% /filer 10028604916Sjruohofiler:/ 1.1T 1.1T 0B 100% /filer 10128604916Sjruohofiler:/ 1.1T 0B 1.1T 0% /filer 10228604916Sjruohofiler:/ 1.1T 229G 860G 21% /filer 10328604916Sjruohofiler:/ 1.1T 688G 401G 63% /filer 10428604916Sjruohofiler:/ 1.1T 1.1T 0B 100% /filer 10528604916Sjruohofiler:/ 1.1T 1.1T -57G 105% /filer 10628604916Sjruohofiler:/ 1.1T 0B 1.0T 0% /filer 10728604916Sjruohofiler:/ 1.1T 229G 803G 22% /filer 10828604916Sjruohofiler:/ 1.1T 688G 344G 66% /filer 10928604916Sjruohofiler:/ 1.1T 1.1T -57G 105% /filer 11028604916Sjruohofiler:/ 1.1T 1.1T -115G 111% /filer 11128604916Sjruohofiler:/ 1.1T 0B 975G 0% /filer 11228604916Sjruohofiler:/ 1.1T 229G 746G 23% /filer 11328604916Sjruohofiler:/ 1.1T 688G 287G 70% /filer 11428604916Sjruohofiler:/ 1.1T 1.1T -115G 111% /filer 11528604916Sjruohofiler:/ 1.1T 1.1T -172G 117% /filer 11628604916Sjruoho/dev/ld0g 1.2T 17G 1.1T 1% /anon-root 11728604916Sjruoho/dev/ld0g 1.2T 0B 1.2T 0% /anon-root 11828604916Sjruoho/dev/ld0g 1.2T 250G 998G 20% /anon-root 11928604916Sjruoho/dev/ld0g 1.2T 749G 499G 60% /anon-root 12028604916Sjruoho/dev/ld0g 1.2T 1.2T 62G 95% /anon-root 12128604916Sjruoho/dev/ld0g 1.2T 1.2T 0B 100% /anon-root 12228604916Sjruoho/dev/ld0g 1.2T 0B 1.2T 0% /anon-root 12328604916Sjruoho/dev/ld0g 1.2T 250G 936G 21% /anon-root 12428604916Sjruoho/dev/ld0g 1.2T 749G 437G 63% /anon-root 12528604916Sjruoho/dev/ld0g 1.2T 1.2T 0B 100% /anon-root 12628604916Sjruoho/dev/ld0g 1.2T 1.2T -62G 105% /anon-root 12728604916Sjruoho/dev/ld0g 1.2T 0B 1.1T 0% /anon-root 12828604916Sjruoho/dev/ld0g 1.2T 250G 874G 22% /anon-root 12928604916Sjruoho/dev/ld0g 1.2T 749G 374G 66% /anon-root 13028604916Sjruoho/dev/ld0g 1.2T 1.2T -62G 105% /anon-root 13128604916Sjruoho/dev/ld0g 1.2T 1.2T -125G 111% /anon-root 13228604916Sjruoho/dev/ld0g 1.2T 0B 1.0T 0% /anon-root 13328604916Sjruoho/dev/ld0g 1.2T 250G 811G 23% /anon-root 13428604916Sjruoho/dev/ld0g 1.2T 749G 312G 70% /anon-root 13528604916Sjruoho/dev/ld0g 1.2T 1.2T -125G 111% /anon-root 13628604916Sjruoho/dev/ld0g 1.2T 1.2T -187G 117% /anon-root 13728604916Sjruoho/dev/strpct 20T 10T 10T 50% /strpct 13828604916Sjruoho/dev/wd0e 10G 2.7G 7.3G 27% /mount/windows/C 13928604916SjruohoEOF 140*d8f5b04cSrillig atf_check -s exit:0 -o file:expout -e empty \ 14128604916Sjruoho -x "BLOCKSIZE=1k $(atf_get_srcdir)/h_df -hn" 14228604916Sjruoho} 14328604916Sjruoho 14428604916Sjruohoatf_init_test_cases() 14528604916Sjruoho{ 14628604916Sjruoho atf_add_test_case normal 14728604916Sjruoho atf_add_test_case hflag 14828604916Sjruoho} 149