]> Dogcows Code - chaz/tar/blob - tests/testsuite.at
Support for POSIX ACLs
[chaz/tar] / tests / testsuite.at
1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
2
3 # Test suite for GNU tar.
4 # Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software
5 # Foundation, Inc.
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3, or (at your option)
10 # any later version.
11
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 # 02110-1301, USA.
21
22 # We need a recent Autotest.
23 m4_version_prereq([2.52g])
24
25 m4_define([AT_TAR_CHECK_HOOK])
26 m4_define([AT_TAR_CHECK],[
27 AT_XFAIL_IF(test -f $[]XFAILFILE)
28 m4_foreach([FMT],
29 [m4_if([$7],[],[v7,oldgnu,ustar,posix,gnu],[$7])],
30 [AT_CHECK([
31 mkdir FMT
32 (cd FMT
33 TEST_TAR_FORMAT=FMT
34 export TEST_TAR_FORMAT
35 TAR_OPTIONS="-H FMT"
36 export TAR_OPTIONS
37 rm -rf *
38 $1)],$2,$3,$4,$5,$6)
39 AT_TAR_CHECK_HOOK])
40 ])
41
42 m4_define([AT_TAR_WITH_HOOK],[
43 m4_pushdef([AT_TAR_CHECK_HOOK],[$1])
44 $2
45
46 m4_popdef([AT_TAR_CHECK_HOOK])])
47
48 m4_define([TAR_IGNREC_HOOK],[
49 AT_CHECK([grep -v '^.*tar: Record size = ' stderr; exit 0])
50 ])
51
52 m4_define([RE_CHECK],[
53 AT_DATA([$1.re],[$2])
54 awk '{print NR " " $[]0}' $1 > $[]$.1
55 awk '{print NR " " $[]0}' $1.re | join - $[]$.1 |
56 while read NUM RE LINE
57 do
58 echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
59 done
60 ])
61
62 m4_define([AT_SKIP_TEST],[exit 77])
63
64 dnl AT_TARBALL_PREREQ(tarball, md5sum) - Check if test tarball exists
65 dnl in $TEST_DATA_DIR. If it does not, try to download it from
66 dnl $TEST_DATA_URL. If download fails, or it the file's md5 sum does not
67 dnl match second argument, skip the test.
68
69 m4_define([AT_TARBALL_PREREQ],[
70 test -z "$[]TEST_DATA_DIR" && AT_SKIP_TEST
71 tarball_prereq $1 $2 $[]TEST_DATA_DIR $[]TEST_DATA_URL || AT_SKIP_TEST])
72
73 dnl AT_STAR_PREREQ(tarball, md5sum) - Same for star testfiles
74 m4_define([AT_STAR_PREREQ],[
75 test -z "$STAR_TESTSCRIPTS" && AT_SKIP_TEST
76 tarball_prereq $1 $2 $[]STAR_TESTSCRIPTS $[]STAR_DATA_URL || AT_SKIP_TEST
77 ])
78
79 dnl AT_GZIP_PREREQ - Skip test unless gzip (or $1) is available
80 m4_define([AT_GZIP_PREREQ],[
81 cat /dev/null | m4_if([$1],[],gzip,[$1]) - > /dev/null 2>&1 || AT_SKIP_TEST
82 ])
83
84 dnl AT_SIGPIPE_PREREQ - Skip test unless SIGPIPE handling is the default
85 m4_define([AT_SIGPIPE_PREREQ],[
86 case `(cat "$at_myself" 2>&3 | :) 3>&1 >/dev/null` in #(
87 ?*) AT_SKIP_TEST;;
88 esac
89 ])
90
91 dnl AT_SORT_PREREQ - Skip test if sort utility outputs unwanted data on stderr
92 m4_define([AT_SORT_PREREQ],[
93 test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST
94 ])
95
96 dnl AT_UNPRIVILEGED_PREREQ - Skip test if running at root privileges
97 m4_define([AT_UNPRIVILEGED_PREREQ],[
98 echo "test" > $[]$
99 chmod 0 $[]$
100 cat $[]$ > /dev/null 2>&1
101 result=$?
102 rm -f $[]$
103 test $result -eq 0 && AT_SKIP_TEST
104 ])
105
106 dnl AT_PRIVILEGED_PREREQ - Skip test if not running at root privileges
107 m4_define([AT_PRIVILEGED_PREREQ],[
108 echo "test" > $[]$
109 chmod 0 $[]$
110 cat $[]$ > /dev/null 2>&1
111 result=$?
112 rm -f $[]$
113 test $result -eq 0 || AT_SKIP_TEST
114 ])
115
116 m4_define([AT_TAR_MKHIER],[
117 install-sh -d $1 >/dev/null dnl
118 m4_if([$2],,,&& genfile --file [$1]/[$2]) || AT_SKIP_TEST])
119
120 dnl Skip test when utlity does not return expected return value
121 m4_define([AT_CHECK_UTIL],[
122 $1 &> /dev/null
123 if test "$?" != $2; then
124 AT_SKIP_TEST
125 fi
126 ])
127
128 m4_define([AT_XATTRS_UTILS_PREREQ],[
129 file=$( mktemp -p . )
130 AT_CHECK_UTIL(setfattr -n user.test -v test $file,0)
131 AT_CHECK_UTIL(getfattr $file,0)
132 ])
133 m4_define([AT_ACLS_UTILS_PREREQ],[
134 file=$( mktemp -p . )
135 AT_CHECK_UTIL(setfacl -m u:$UID:rwx $file,0)
136 AT_CHECK_UTIL(getfacl $file,0)
137 rm -rf $file
138 ])
139 m4_define([AT_CAPABILITIES_UTILS_PREREQ],[
140 file=$( mktemp -p . )
141 AT_CHECK_UTIL(setcap "= cap_chown=ei" $file,0)
142 AT_CHECK_UTIL(getcap $file,0)
143 rm -rf $file
144 ])
145 m4_define([AT_XATTRS_PREREQ],[
146 AT_XATTRS_UTILS_PREREQ
147 file=$( mktemp -p . )
148 setfattr -n user.test -v ahoj $file
149 # check whether tar fails to store xattrs
150 err=$( tar --xattrs -cf /dev/null $file 2>&1 >/dev/null | wc -l )
151 if test "$err" != "0"; then
152 AT_SKIP_TEST
153 fi
154 ])
155 m4_define([AT_ACLS_PREREQ],[
156 AT_XATTRS_UTILS_PREREQ
157 file=$( mktemp -p . )
158 setfacl -m u:$UID:rwx $file
159 err=$( tar --acls -cf /dev/null $file 2>&1 >/dev/null | wc -l )
160 if test "$err" != "0"; then
161 AT_SKIP_TEST
162 fi
163 ])
164
165 m4_include([sparsemvp.at])
166
167 AT_INIT
168
169 AT_TESTED([tar])
170
171 m4_include([version.at])
172
173 m4_include([pipe.at])
174
175 m4_include([options.at])
176 m4_include([options02.at])
177
178 m4_include([T-empty.at])
179 m4_include([T-null.at])
180
181 m4_include([indexfile.at])
182 m4_include([verbose.at])
183
184 m4_include([append.at])
185 m4_include([append01.at])
186 m4_include([append02.at])
187 m4_include([append03.at])
188
189 m4_include([xform-h.at])
190 m4_include([xform01.at])
191
192 m4_include([exclude.at])
193 m4_include([exclude01.at])
194 m4_include([exclude02.at])
195 m4_include([exclude03.at])
196 m4_include([exclude04.at])
197 m4_include([exclude05.at])
198 m4_include([exclude06.at])
199 m4_include([exclude07.at])
200
201 m4_include([delete01.at])
202 m4_include([delete02.at])
203 m4_include([delete03.at])
204 m4_include([delete04.at])
205 m4_include([delete05.at])
206
207 m4_include([extrac01.at])
208 m4_include([extrac02.at])
209 m4_include([extrac03.at])
210 m4_include([extrac04.at])
211 m4_include([extrac05.at])
212 m4_include([extrac06.at])
213 m4_include([extrac07.at])
214 m4_include([extrac08.at])
215 m4_include([extrac09.at])
216 m4_include([extrac10.at])
217 m4_include([extrac11.at])
218 m4_include([extrac12.at])
219 m4_include([extrac13.at])
220 m4_include([extrac14.at])
221 m4_include([extrac15.at])
222 m4_include([extrac16.at])
223 m4_include([extrac17.at])
224 m4_include([extrac18.at])
225 m4_include([extrac19.at])
226
227 m4_include([label01.at])
228 m4_include([label02.at])
229 m4_include([label03.at])
230 m4_include([label04.at])
231 m4_include([label05.at])
232
233 m4_include([backup01.at])
234
235 m4_include([gzip.at])
236
237 m4_include([incremental.at])
238 m4_include([incr01.at])
239 m4_include([incr02.at])
240 m4_include([listed01.at])
241 m4_include([listed02.at])
242 m4_include([listed03.at])
243 m4_include([listed04.at])
244 m4_include([listed05.at])
245 m4_include([incr03.at])
246 m4_include([incr04.at])
247 m4_include([incr05.at])
248 m4_include([incr06.at])
249
250 m4_include([filerem01.at])
251 m4_include([filerem02.at])
252
253 m4_include([rename01.at])
254 m4_include([rename02.at])
255 m4_include([rename03.at])
256 m4_include([rename04.at])
257 m4_include([rename05.at])
258 m4_include([chtype.at])
259
260 m4_include([ignfail.at])
261
262 m4_include([link01.at])
263 m4_include([link02.at])
264 m4_include([link03.at])
265 m4_include([link04.at])
266
267 m4_include([longv7.at])
268 m4_include([long01.at])
269 m4_include([lustar01.at])
270 m4_include([lustar02.at])
271 m4_include([lustar03.at])
272
273 m4_include([multiv01.at])
274 m4_include([multiv02.at])
275 m4_include([multiv03.at])
276 m4_include([multiv04.at])
277 m4_include([multiv05.at])
278 m4_include([multiv06.at])
279 m4_include([multiv07.at])
280 m4_include([multiv08.at])
281
282 m4_include([old.at])
283 m4_include([owner.at])
284
285 m4_include([recurse.at])
286
287 m4_include([same-order01.at])
288 m4_include([same-order02.at])
289
290 m4_include([shortrec.at])
291
292 m4_include([sparse01.at])
293 m4_include([sparse02.at])
294 m4_include([sparse03.at])
295 m4_include([sparse04.at])
296 m4_include([sparsemv.at])
297 m4_include([spmvp00.at])
298 m4_include([spmvp01.at])
299 m4_include([spmvp10.at])
300
301 m4_include([update.at])
302 m4_include([update01.at])
303 m4_include([update02.at])
304
305 m4_include([verify.at])
306
307 m4_include([volume.at])
308 m4_include([volsize.at])
309
310 m4_include([comprec.at])
311 m4_include([shortfile.at])
312 m4_include([shortupd.at])
313
314 m4_include([truncate.at])
315 m4_include([grow.at])
316
317 m4_include([remfiles01.at])
318 m4_include([remfiles02.at])
319 m4_include([remfiles03.at])
320
321 m4_include([sigpipe.at])
322
323 m4_include([xattr01.at])
324 m4_include([xattr02.at])
325 m4_include([xattr03.at])
326 m4_include([xattr04.at])
327
328 m4_include([acls01.at])
329 m4_include([acls02.at])
330
331 m4_include([capabs_raw01.at])
332
333 m4_include([star/gtarfail.at])
334 m4_include([star/gtarfail2.at])
335
336 m4_include([star/multi-fail.at])
337
338 m4_include([star/ustar-big-2g.at])
339 m4_include([star/ustar-big-8g.at])
340
341 m4_include([star/pax-big-10g.at])
342
This page took 0.051957 seconds and 5 git commands to generate.