2 # Exercise ls --block-size and related options.
4 # Copyright (C) 2011-2024 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 .
"${srcdir=.}/tests/init.sh"; path_prepend_ .
/src
28 for size
in 1024 4096 262144; do
29 echo foo |
dd conv
=sync bs
=$size >file$size || fail
=1
31 touch -d '2001-01-01 00:00' file* || fail
=1
33 size_etc
='s/[^ ]* *[^ ]* *//'
35 ls -og * |
sed "$size_etc" >..
/out || fail
=1
36 POSIXLY_CORRECT
=1 ls -og * |
sed "$size_etc" >>..
/out || fail
=1
37 POSIXLY_CORRECT
=1 ls -k -og * |
sed "$size_etc" >>..
/out || fail
=1
39 for var
in BLOCKSIZE BLOCK_SIZE LS_BLOCK_SIZE
; do
40 for blocksize
in 1 512 1K
1KiB
; do
41 (eval $var=$blocksize && export $var &&
42 echo "x x # $var=$blocksize" &&
45 ls -og -k --block-size=$blocksize *
46 ) |
sed "$size_etc" >>..
/out || fail
=1
53 1024 Jan 1 2001 file1024
54 262144 Jan 1 2001 file262144
55 4096 Jan 1 2001 file4096
56 1024 Jan 1 2001 file1024
57 262144 Jan 1 2001 file262144
58 4096 Jan 1 2001 file4096
59 1024 Jan 1 2001 file1024
60 262144 Jan 1 2001 file262144
61 4096 Jan 1 2001 file4096
63 1024 Jan 1 2001 file1024
64 262144 Jan 1 2001 file262144
65 4096 Jan 1 2001 file4096
66 1024 Jan 1 2001 file1024
67 262144 Jan 1 2001 file262144
68 4096 Jan 1 2001 file4096
69 1024 Jan 1 2001 file1024
70 262144 Jan 1 2001 file262144
71 4096 Jan 1 2001 file4096
73 1024 Jan 1 2001 file1024
74 262144 Jan 1 2001 file262144
75 4096 Jan 1 2001 file4096
76 1024 Jan 1 2001 file1024
77 262144 Jan 1 2001 file262144
78 4096 Jan 1 2001 file4096
80 512 Jan 1 2001 file262144
83 1024 Jan 1 2001 file1024
84 262144 Jan 1 2001 file262144
85 4096 Jan 1 2001 file4096
86 1024 Jan 1 2001 file1024
87 262144 Jan 1 2001 file262144
88 4096 Jan 1 2001 file4096
90 256 Jan 1 2001 file262144
93 1024 Jan 1 2001 file1024
94 262144 Jan 1 2001 file262144
95 4096 Jan 1 2001 file4096
96 1024 Jan 1 2001 file1024
97 262144 Jan 1 2001 file262144
98 4096 Jan 1 2001 file4096
100 256 Jan 1 2001 file262144
101 4 Jan 1 2001 file4096
103 1024 Jan 1 2001 file1024
104 262144 Jan 1 2001 file262144
105 4096 Jan 1 2001 file4096
106 1024 Jan 1 2001 file1024
107 262144 Jan 1 2001 file262144
108 4096 Jan 1 2001 file4096
109 1024 Jan 1 2001 file1024
110 262144 Jan 1 2001 file262144
111 4096 Jan 1 2001 file4096
113 2 Jan 1 2001 file1024
114 512 Jan 1 2001 file262144
115 8 Jan 1 2001 file4096
116 2 Jan 1 2001 file1024
117 512 Jan 1 2001 file262144
118 8 Jan 1 2001 file4096
119 2 Jan 1 2001 file1024
120 512 Jan 1 2001 file262144
121 8 Jan 1 2001 file4096
123 1 Jan 1 2001 file1024
124 256 Jan 1 2001 file262144
125 4 Jan 1 2001 file4096
126 1 Jan 1 2001 file1024
127 256 Jan 1 2001 file262144
128 4 Jan 1 2001 file4096
129 1 Jan 1 2001 file1024
130 256 Jan 1 2001 file262144
131 4 Jan 1 2001 file4096
133 1 Jan 1 2001 file1024
134 256 Jan 1 2001 file262144
135 4 Jan 1 2001 file4096
136 1 Jan 1 2001 file1024
137 256 Jan 1 2001 file262144
138 4 Jan 1 2001 file4096
139 1 Jan 1 2001 file1024
140 256 Jan 1 2001 file262144
141 4 Jan 1 2001 file4096
143 1024 Jan 1 2001 file1024
144 262144 Jan 1 2001 file262144
145 4096 Jan 1 2001 file4096
146 1024 Jan 1 2001 file1024
147 262144 Jan 1 2001 file262144
148 4096 Jan 1 2001 file4096
149 1024 Jan 1 2001 file1024
150 262144 Jan 1 2001 file262144
151 4096 Jan 1 2001 file4096
153 2 Jan 1 2001 file1024
154 512 Jan 1 2001 file262144
155 8 Jan 1 2001 file4096
156 2 Jan 1 2001 file1024
157 512 Jan 1 2001 file262144
158 8 Jan 1 2001 file4096
159 2 Jan 1 2001 file1024
160 512 Jan 1 2001 file262144
161 8 Jan 1 2001 file4096
163 1 Jan 1 2001 file1024
164 256 Jan 1 2001 file262144
165 4 Jan 1 2001 file4096
166 1 Jan 1 2001 file1024
167 256 Jan 1 2001 file262144
168 4 Jan 1 2001 file4096
169 1 Jan 1 2001 file1024
170 256 Jan 1 2001 file262144
171 4 Jan 1 2001 file4096
173 1 Jan 1 2001 file1024
174 256 Jan 1 2001 file262144
175 4 Jan 1 2001 file4096
176 1 Jan 1 2001 file1024
177 256 Jan 1 2001 file262144
178 4 Jan 1 2001 file4096
179 1 Jan 1 2001 file1024
180 256 Jan 1 2001 file262144
181 4 Jan 1 2001 file4096
184 compare exp out || fail
=1