1 # Process this file with autom4te to create testsuite. -*- Autotest -*-
3 # Test suite for GNU tar.
4 # Copyright 2004-2008, 2010-2014 Free Software Foundation, Inc.
6 # This file is part of GNU tar.
8 # GNU tar is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
13 # GNU tar is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # We need a recent Autotest.
22 m4_version_prereq([2.52g])
24 m4_define([AT_TAR_CHECK_HOOK])
25 m4_define([AT_TAR_CHECK],[
26 AT_XFAIL_IF(test -f $[]XFAILFILE)
28 [m4_if([$7],[],[v7,oldgnu,ustar,posix,gnu],[$7])],
33 export TEST_TAR_FORMAT
41 m4_define([AT_TAR_WITH_HOOK],[
42 m4_pushdef([AT_TAR_CHECK_HOOK],[$1])
45 m4_popdef([AT_TAR_CHECK_HOOK])])
47 m4_define([TAR_IGNREC_HOOK],[
48 AT_CHECK([grep -v '^.*tar: Record size = ' stderr; exit 0])
51 m4_define([RE_CHECK],[
53 awk '{print NR " " $[]0}' $1 > $[]$.1
54 awk '{print NR " " $[]0}' $1.re | join - $[]$.1 |
55 while read NUM RE LINE
57 echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
61 m4_define([AT_SKIP_TEST],[exit 77])
63 dnl AT_TARBALL_PREREQ(tarball, md5sum) - Check if test tarball exists
64 dnl in $TEST_DATA_DIR. If it does not, try to download it from
65 dnl $TEST_DATA_URL. If download fails, or it the file's md5 sum does not
66 dnl match second argument, skip the test.
68 m4_define([AT_TARBALL_PREREQ],[
69 test -z "$[]TEST_DATA_DIR" && AT_SKIP_TEST
70 tarball_prereq $1 $2 $[]TEST_DATA_DIR $[]TEST_DATA_URL || AT_SKIP_TEST])
72 dnl AT_STAR_PREREQ(tarball, md5sum) - Same for star testfiles
73 m4_define([AT_STAR_PREREQ],[
74 test -z "$STAR_TESTSCRIPTS" && AT_SKIP_TEST
75 tarball_prereq $1 $2 $[]STAR_TESTSCRIPTS $[]STAR_DATA_URL || AT_SKIP_TEST
78 dnl AT_GZIP_PREREQ - Skip test unless gzip (or $1) is available
79 m4_define([AT_GZIP_PREREQ],[
80 cat /dev/null | m4_if([$1],[],gzip,[$1]) - > /dev/null 2>&1 || AT_SKIP_TEST
83 dnl AT_SIGPIPE_PREREQ - Skip test unless SIGPIPE handling is the default
84 m4_define([AT_SIGPIPE_PREREQ],[
85 case `(cat "$at_myself" 2>&3 | :) 3>&1 >/dev/null` in #(
90 dnl AT_SORT_PREREQ - Skip test if sort utility outputs unwanted data on stderr
91 m4_define([AT_SORT_PREREQ],[
92 test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST
95 dnl AT_UNPRIVILEGED_PREREQ - Skip test if running at root privileges
96 m4_define([AT_UNPRIVILEGED_PREREQ],[
99 cat $[]$ > /dev/null 2>&1
102 test $result -eq 0 && AT_SKIP_TEST
105 dnl AT_PRIVILEGED_PREREQ - Skip test if not running at root privileges
106 m4_define([AT_PRIVILEGED_PREREQ],[
109 cat $[]$ > /dev/null 2>&1
112 test $result -eq 0 || AT_SKIP_TEST
115 m4_define([AT_TAR_MKHIER],[
116 install-sh -d $1 >/dev/null dnl
117 m4_if([$2],,,&& genfile --file [$1]/[$2]) || AT_SKIP_TEST])
119 dnl Skip test when utlity does not return expected return value
120 m4_define([AT_CHECK_UTIL],[
122 if test "$?" != $2; then
127 m4_define([AT_XATTRS_UTILS_PREREQ],[
128 file=$(TMPDIR=. mktemp fiXXXXXX)
129 AT_CHECK_UTIL(setfattr -n user.test -v test $file,0)
130 AT_CHECK_UTIL(getfattr $file,0)
132 m4_define([AT_SELINUX_UTILS_PREREQ],[
133 file=$(TMPDIR=. mktemp fiXXXXXX)
134 AT_CHECK_UTIL(restorecon $file, 0)
135 AT_CHECK_UTIL(chcon -h --user=unconfined_u $file,0)
138 m4_define([AT_ACLS_UTILS_PREREQ],[
139 file=$(TMPDIR=. mktemp fiXXXXXX)
140 AT_CHECK_UTIL(setfacl -m u:$UID:rwx $file,0)
141 AT_CHECK_UTIL(getfacl $file,0)
144 m4_define([AT_CAPABILITIES_UTILS_PREREQ],[
145 file=$(TMPDIR=. mktemp fiXXXXXX)
146 AT_CHECK_UTIL(setcap "= cap_chown=ei" $file,0)
147 AT_CHECK_UTIL(getcap $file,0)
150 m4_define([AT_XATTRS_PREREQ],[
151 AT_XATTRS_UTILS_PREREQ
152 file=$(TMPDIR=. mktemp fiXXXXXX)
153 setfattr -n user.test -v ahoj $file
154 # check whether tar fails to store xattrs
155 err=$( tar --xattrs -cf /dev/null $file 2>&1 >/dev/null | wc -l )
156 if test "$err" != "0"; then
160 m4_define([AT_SELINUX_PREREQ],[
161 AT_SELINUX_UTILS_PREREQ
162 file=$(TMPDIR=. mktemp fiXXXXXX)
163 err=$( tar --selinux -cf /dev/null $file 2>&1 >/dev/null | wc -l )
164 if test "$err" != "0"; then
168 m4_define([AT_ACLS_PREREQ],[
170 file=$(TMPDIR=. mktemp fiXXXXXX)
171 setfacl -m u:$UID:rwx $file
172 err=$( tar --acls -cf /dev/null $file 2>&1 >/dev/null | wc -l )
173 if test "$err" != "0"; then
178 m4_include([sparsemvp.at])
184 m4_include([version.at])
186 m4_include([pipe.at])
188 m4_include([options.at])
189 m4_include([options02.at])
191 AT_BANNER([Option compatibility])
192 m4_include([opcomp01.at])
193 m4_include([opcomp02.at])
194 m4_include([opcomp03.at])
195 m4_include([opcomp04.at])
196 m4_include([opcomp05.at])
197 m4_include([opcomp06.at])
199 AT_BANNER([The -T option])
200 m4_include([T-mult.at])
201 m4_include([T-nest.at])
202 m4_include([T-rec.at])
203 m4_include([T-cd.at])
204 m4_include([T-empty.at])
205 m4_include([T-null.at])
206 m4_include([T-zfile.at])
207 m4_include([T-nonl.at])
209 AT_BANNER([Various options])
210 m4_include([indexfile.at])
211 m4_include([verbose.at])
212 m4_include([gzip.at])
213 m4_include([recurse.at])
214 m4_include([shortrec.at])
216 AT_BANNER([The --same-order option])
217 m4_include([same-order01.at])
218 m4_include([same-order02.at])
221 m4_include([append.at])
222 m4_include([append01.at])
223 m4_include([append02.at])
224 m4_include([append03.at])
225 m4_include([append04.at])
227 AT_BANNER([Transforms])
228 m4_include([xform-h.at])
229 m4_include([xform01.at])
232 m4_include([exclude.at])
233 m4_include([exclude01.at])
234 m4_include([exclude02.at])
235 m4_include([exclude03.at])
236 m4_include([exclude04.at])
237 m4_include([exclude05.at])
238 m4_include([exclude06.at])
239 m4_include([exclude07.at])
240 m4_include([exclude08.at])
241 m4_include([exclude09.at])
242 m4_include([exclude10.at])
243 m4_include([exclude11.at])
244 m4_include([exclude12.at])
245 m4_include([exclude13.at])
246 m4_include([exclude14.at])
247 m4_include([exclude15.at])
248 m4_include([exclude16.at])
250 AT_BANNER([Deletions])
251 m4_include([delete01.at])
252 m4_include([delete02.at])
253 m4_include([delete03.at])
254 m4_include([delete04.at])
255 m4_include([delete05.at])
257 AT_BANNER([Extracting])
258 m4_include([extrac01.at])
259 m4_include([extrac02.at])
260 m4_include([extrac03.at])
261 m4_include([extrac04.at])
262 m4_include([extrac05.at])
263 m4_include([extrac06.at])
264 m4_include([extrac07.at])
265 m4_include([extrac08.at])
266 m4_include([extrac09.at])
267 m4_include([extrac10.at])
268 m4_include([extrac11.at])
269 m4_include([extrac12.at])
270 m4_include([extrac13.at])
271 m4_include([extrac14.at])
272 m4_include([extrac15.at])
273 m4_include([extrac16.at])
274 m4_include([extrac17.at])
275 m4_include([extrac18.at])
276 m4_include([extrac19.at])
277 m4_include([backup01.at])
279 AT_BANNER([Volume label operations])
280 m4_include([label01.at])
281 m4_include([label02.at])
282 m4_include([label03.at])
283 m4_include([label04.at])
284 m4_include([label05.at])
286 AT_BANNER([Incremental archives])
287 m4_include([incremental.at])
288 m4_include([incr01.at])
289 m4_include([incr02.at])
290 m4_include([listed01.at])
291 m4_include([listed02.at])
292 m4_include([listed03.at])
293 m4_include([listed04.at])
294 m4_include([listed05.at])
295 m4_include([incr03.at])
296 m4_include([incr04.at])
297 m4_include([incr05.at])
298 m4_include([incr06.at])
299 m4_include([incr07.at])
300 m4_include([incr08.at])
301 m4_include([incr09.at])
303 AT_BANNER([Files removed while archiving])
304 m4_include([filerem01.at])
305 m4_include([filerem02.at])
308 m4_include([rename01.at])
309 m4_include([rename02.at])
310 m4_include([rename03.at])
311 m4_include([rename04.at])
312 m4_include([rename05.at])
313 m4_include([chtype.at])
315 AT_BANNER([Ignore failing reads])
316 m4_include([ignfail.at])
318 AT_BANNER([Link handling])
319 m4_include([link01.at])
320 m4_include([link02.at])
321 m4_include([link03.at])
322 m4_include([link04.at])
324 AT_BANNER([Specific archive formats])
325 m4_include([longv7.at])
326 m4_include([long01.at])
327 m4_include([lustar01.at])
328 m4_include([lustar02.at])
329 m4_include([lustar03.at])
332 m4_include([time01.at])
334 AT_BANNER([Multivolume archives])
335 m4_include([multiv01.at])
336 m4_include([multiv02.at])
337 m4_include([multiv03.at])
338 m4_include([multiv04.at])
339 m4_include([multiv05.at])
340 m4_include([multiv06.at])
341 m4_include([multiv07.at])
342 m4_include([multiv08.at])
344 AT_BANNER([Owner and Groups])
345 m4_include([owner.at])
347 AT_BANNER([Sparse files])
348 m4_include([sparse01.at])
349 m4_include([sparse02.at])
350 m4_include([sparse03.at])
351 m4_include([sparse04.at])
352 m4_include([sparsemv.at])
353 m4_include([spmvp00.at])
354 m4_include([spmvp01.at])
355 m4_include([spmvp10.at])
358 m4_include([update.at])
359 m4_include([update01.at])
360 m4_include([update02.at])
362 AT_BANNER([Verifying the archive])
363 m4_include([verify.at])
365 AT_BANNER([Volume operations])
366 m4_include([volume.at])
367 m4_include([volsize.at])
370 m4_include([comprec.at])
371 m4_include([shortfile.at])
372 m4_include([shortupd.at])
374 m4_include([truncate.at])
375 m4_include([grow.at])
376 m4_include([sigpipe.at])
378 AT_BANNER([Removing files after archiving])
379 m4_include([remfiles01.at])
380 m4_include([remfiles02.at])
381 m4_include([remfiles03.at])
382 m4_include([remfiles04a.at])
383 m4_include([remfiles04b.at])
384 m4_include([remfiles04c.at])
385 m4_include([remfiles05a.at])
386 m4_include([remfiles05b.at])
387 m4_include([remfiles05c.at])
388 m4_include([remfiles06a.at])
389 m4_include([remfiles06b.at])
390 m4_include([remfiles06c.at])
391 m4_include([remfiles07a.at])
392 m4_include([remfiles07b.at])
393 m4_include([remfiles07c.at])
394 m4_include([remfiles08a.at])
395 m4_include([remfiles08b.at])
396 m4_include([remfiles08c.at])
397 m4_include([remfiles09a.at])
398 m4_include([remfiles09b.at])
399 m4_include([remfiles09c.at])
401 AT_BANNER([Extended attributes])
402 m4_include([xattr01.at])
403 m4_include([xattr02.at])
404 m4_include([xattr03.at])
405 m4_include([xattr04.at])
406 m4_include([xattr05.at])
408 m4_include([acls01.at])
409 m4_include([acls02.at])
411 m4_include([selnx01.at])
412 m4_include([selacl01.at])
414 m4_include([capabs_raw01.at])
416 AT_BANNER([One top level])
417 m4_include([onetop01.at])
418 m4_include([onetop02.at])
419 m4_include([onetop03.at])
421 AT_BANNER([Star tests])
422 m4_include([star/gtarfail.at])
423 m4_include([star/gtarfail2.at])
425 m4_include([star/multi-fail.at])
427 m4_include([star/ustar-big-2g.at])
428 m4_include([star/ustar-big-8g.at])
430 m4_include([star/pax-big-10g.at])