~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to tests/ls/block-size.sh

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Exercise ls --block-size and related options.
 
3
 
 
4
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 
 
19
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 
20
print_ver_ ls
 
21
 
 
22
TZ=UTC0
 
23
export TZ
 
24
 
 
25
mkdir sub
 
26
cd sub
 
27
 
 
28
for size in 1024 4096 262144; do
 
29
  echo foo | dd conv=sync bs=$size >file$size || fail=1
 
30
done
 
31
touch -d '2001-01-01 00:00' file* || fail=1
 
32
 
 
33
size_etc='s/[^ ]* *[^ ]* *[^ ]* *[^ ]* *//'
 
34
 
 
35
ls -l * | sed "$size_etc" >../out || fail=1
 
36
POSIXLY_CORRECT=1 ls -l * | sed "$size_etc" >>../out || fail=1
 
37
POSIXLY_CORRECT=1 ls -k -l * | sed "$size_etc" >>../out || fail=1
 
38
 
 
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
     ls -l * &&
 
43
     ls -l -k * &&
 
44
     ls -l -k --block-size=$blocksize *
 
45
    ) | sed "$size_etc" >>../out || fail=1
 
46
  done
 
47
done
 
48
 
 
49
cd ..
 
50
 
 
51
cat >exp <<'EOF'
 
52
1024 Jan  1  2001 file1024
 
53
262144 Jan  1  2001 file262144
 
54
4096 Jan  1  2001 file4096
 
55
1024 Jan  1  2001 file1024
 
56
262144 Jan  1  2001 file262144
 
57
4096 Jan  1  2001 file4096
 
58
1024 Jan  1  2001 file1024
 
59
262144 Jan  1  2001 file262144
 
60
4096 Jan  1  2001 file4096
 
61
1024 Jan  1  2001 file1024
 
62
262144 Jan  1  2001 file262144
 
63
4096 Jan  1  2001 file4096
 
64
1024 Jan  1  2001 file1024
 
65
262144 Jan  1  2001 file262144
 
66
4096 Jan  1  2001 file4096
 
67
1024 Jan  1  2001 file1024
 
68
262144 Jan  1  2001 file262144
 
69
4096 Jan  1  2001 file4096
 
70
1024 Jan  1  2001 file1024
 
71
262144 Jan  1  2001 file262144
 
72
4096 Jan  1  2001 file4096
 
73
1024 Jan  1  2001 file1024
 
74
262144 Jan  1  2001 file262144
 
75
4096 Jan  1  2001 file4096
 
76
2 Jan  1  2001 file1024
 
77
512 Jan  1  2001 file262144
 
78
8 Jan  1  2001 file4096
 
79
1024 Jan  1  2001 file1024
 
80
262144 Jan  1  2001 file262144
 
81
4096 Jan  1  2001 file4096
 
82
1024 Jan  1  2001 file1024
 
83
262144 Jan  1  2001 file262144
 
84
4096 Jan  1  2001 file4096
 
85
1 Jan  1  2001 file1024
 
86
256 Jan  1  2001 file262144
 
87
4 Jan  1  2001 file4096
 
88
1024 Jan  1  2001 file1024
 
89
262144 Jan  1  2001 file262144
 
90
4096 Jan  1  2001 file4096
 
91
1024 Jan  1  2001 file1024
 
92
262144 Jan  1  2001 file262144
 
93
4096 Jan  1  2001 file4096
 
94
1 Jan  1  2001 file1024
 
95
256 Jan  1  2001 file262144
 
96
4 Jan  1  2001 file4096
 
97
1024 Jan  1  2001 file1024
 
98
262144 Jan  1  2001 file262144
 
99
4096 Jan  1  2001 file4096
 
100
1024 Jan  1  2001 file1024
 
101
262144 Jan  1  2001 file262144
 
102
4096 Jan  1  2001 file4096
 
103
1024 Jan  1  2001 file1024
 
104
262144 Jan  1  2001 file262144
 
105
4096 Jan  1  2001 file4096
 
106
2 Jan  1  2001 file1024
 
107
512 Jan  1  2001 file262144
 
108
8 Jan  1  2001 file4096
 
109
2 Jan  1  2001 file1024
 
110
512 Jan  1  2001 file262144
 
111
8 Jan  1  2001 file4096
 
112
2 Jan  1  2001 file1024
 
113
512 Jan  1  2001 file262144
 
114
8 Jan  1  2001 file4096
 
115
1 Jan  1  2001 file1024
 
116
256 Jan  1  2001 file262144
 
117
4 Jan  1  2001 file4096
 
118
1 Jan  1  2001 file1024
 
119
256 Jan  1  2001 file262144
 
120
4 Jan  1  2001 file4096
 
121
1 Jan  1  2001 file1024
 
122
256 Jan  1  2001 file262144
 
123
4 Jan  1  2001 file4096
 
124
1 Jan  1  2001 file1024
 
125
256 Jan  1  2001 file262144
 
126
4 Jan  1  2001 file4096
 
127
1 Jan  1  2001 file1024
 
128
256 Jan  1  2001 file262144
 
129
4 Jan  1  2001 file4096
 
130
1 Jan  1  2001 file1024
 
131
256 Jan  1  2001 file262144
 
132
4 Jan  1  2001 file4096
 
133
1024 Jan  1  2001 file1024
 
134
262144 Jan  1  2001 file262144
 
135
4096 Jan  1  2001 file4096
 
136
1024 Jan  1  2001 file1024
 
137
262144 Jan  1  2001 file262144
 
138
4096 Jan  1  2001 file4096
 
139
1024 Jan  1  2001 file1024
 
140
262144 Jan  1  2001 file262144
 
141
4096 Jan  1  2001 file4096
 
142
2 Jan  1  2001 file1024
 
143
512 Jan  1  2001 file262144
 
144
8 Jan  1  2001 file4096
 
145
2 Jan  1  2001 file1024
 
146
512 Jan  1  2001 file262144
 
147
8 Jan  1  2001 file4096
 
148
2 Jan  1  2001 file1024
 
149
512 Jan  1  2001 file262144
 
150
8 Jan  1  2001 file4096
 
151
1 Jan  1  2001 file1024
 
152
256 Jan  1  2001 file262144
 
153
4 Jan  1  2001 file4096
 
154
1 Jan  1  2001 file1024
 
155
256 Jan  1  2001 file262144
 
156
4 Jan  1  2001 file4096
 
157
1 Jan  1  2001 file1024
 
158
256 Jan  1  2001 file262144
 
159
4 Jan  1  2001 file4096
 
160
1 Jan  1  2001 file1024
 
161
256 Jan  1  2001 file262144
 
162
4 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
EOF
 
170
 
 
171
compare exp out || fail=1
 
172
 
 
173
Exit $fail