testsuite.at 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3, or (at your option)
  7. # any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program; if not, write to the Free Software
  14. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. # 02110-1301, USA.
  16. # We need a recent Autotest.
  17. m4_version_prereq([2.52g])
  18. m4_define([AT_TAR_CHECK],[
  19. AT_XFAIL_IF(test -f $[]XFAILFILE)
  20. m4_foreach([FMT],
  21. [m4_if([$7],[],[v7,oldgnu,ustar,posix,gnu],[$7])],
  22. [AT_CHECK([
  23. mkdir FMT
  24. (cd FMT
  25. TEST_TAR_FORMAT=FMT
  26. export TEST_TAR_FORMAT
  27. TAR_OPTIONS="-H FMT"
  28. export TAR_OPTIONS
  29. rm -rf *
  30. $1)],$2,$3,$4,$5,$6)])
  31. ])
  32. m4_define([RE_CHECK],[
  33. AT_DATA([$1.re],[$2])
  34. awk '{print NR " " $[]0}' $1 > $[]$.1
  35. awk '{print NR " " $[]0}' $1.re | join - $[]$.1 |
  36. while read NUM RE LINE
  37. do
  38. echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
  39. done
  40. ])
  41. m4_define([AT_SKIP_TEST],[exit 77])
  42. dnl AT_TARBALL_PREREQ(tarball, md5sum) - Check if test tarball exists
  43. dnl in $TEST_DATA_DIR. If it does not, try to download it from
  44. dnl $TEST_DATA_URL. If download fails, or it the file's md5 sum does not
  45. dnl match second argument, skip the test.
  46. m4_define([AT_TARBALL_PREREQ],[
  47. test -z "$[]TEST_DATA_DIR" && AT_SKIP_TEST
  48. tarball_prereq $1 $2 $[]TEST_DATA_DIR $[]TEST_DATA_URL || AT_SKIP_TEST])
  49. dnl AT_TARBALL_PREREQ(tarball, md5sum) - Same for star testfiles
  50. m4_define([AT_STAR_PREREQ],[
  51. test -z "$STAR_TESTSCRIPTS" && AT_SKIP_TEST
  52. tarball_prereq $1 $2 $[]STAR_TESTSCRIPTS $[]STAR_DATA_URL || AT_SKIP_TEST
  53. ])
  54. dnl AT_GZIP_PREREQ - Skip test unless gzip (or $1) is available
  55. m4_define([AT_GZIP_PREREQ],[
  56. cat /dev/null | m4_if([$1],[],gzip,[$1]) - > /dev/null 2>&1 || AT_SKIP_TEST
  57. ])
  58. dnl AT_SORT_PREREQ - Skip test if sort utility outputs unwanted data on stderr
  59. m4_define([AT_SORT_PREREQ],[
  60. test -z "`sort < /dev/null 2>&1`" || AT_SKIP_TEST
  61. ])
  62. dnl AT_UNPRIVILEGED_PREREQ - Skip test if running at root privileges
  63. m4_define([AT_UNPRIVILEGED_PREREQ],[
  64. echo "test" > $[]$
  65. chmod 0 $[]$
  66. cat $[]$ > /dev/null 2>&1
  67. result=$?
  68. rm -f $[]$
  69. test $result -eq 0 && AT_SKIP_TEST
  70. ])
  71. m4_define([AT_TAR_MKHIER],[
  72. install-sh -d $1 >/dev/null dnl
  73. m4_if([$2],,,&& genfile --file [$1]/[$2]) || AT_SKIP_TEST])
  74. m4_include([sparsemvp.at])
  75. AT_INIT
  76. AT_TESTED([tar])
  77. m4_include([version.at])
  78. m4_include([pipe.at])
  79. m4_include([options.at])
  80. m4_include([options02.at])
  81. m4_include([T-empty.at])
  82. m4_include([T-null.at])
  83. m4_include([indexfile.at])
  84. m4_include([verbose.at])
  85. m4_include([append.at])
  86. m4_include([append01.at])
  87. m4_include([append02.at])
  88. m4_include([exclude.at])
  89. m4_include([delete01.at])
  90. m4_include([delete02.at])
  91. m4_include([delete03.at])
  92. m4_include([delete04.at])
  93. m4_include([delete05.at])
  94. m4_include([extrac01.at])
  95. m4_include([extrac02.at])
  96. m4_include([extrac03.at])
  97. m4_include([extrac04.at])
  98. m4_include([extrac05.at])
  99. m4_include([extrac06.at])
  100. m4_include([extrac07.at])
  101. m4_include([gzip.at])
  102. m4_include([incremental.at])
  103. m4_include([incr01.at])
  104. m4_include([incr02.at])
  105. m4_include([listed01.at])
  106. m4_include([listed02.at])
  107. m4_include([incr03.at])
  108. m4_include([incr04.at])
  109. m4_include([rename01.at])
  110. m4_include([rename02.at])
  111. m4_include([rename03.at])
  112. m4_include([rename04.at])
  113. m4_include([rename05.at])
  114. m4_include([chtype.at])
  115. m4_include([ignfail.at])
  116. m4_include([link01.at])
  117. m4_include([longv7.at])
  118. m4_include([long01.at])
  119. m4_include([lustar01.at])
  120. m4_include([lustar02.at])
  121. m4_include([lustar03.at])
  122. m4_include([multiv01.at])
  123. m4_include([multiv02.at])
  124. m4_include([multiv03.at])
  125. m4_include([multiv04.at])
  126. m4_include([multiv05.at])
  127. m4_include([multiv06.at])
  128. m4_include([old.at])
  129. m4_include([recurse.at])
  130. m4_include([same-order01.at])
  131. m4_include([same-order02.at])
  132. m4_include([shortrec.at])
  133. m4_include([sparse01.at])
  134. m4_include([sparse02.at])
  135. m4_include([sparse03.at])
  136. m4_include([sparsemv.at])
  137. m4_include([spmvp00.at])
  138. m4_include([spmvp01.at])
  139. m4_include([spmvp10.at])
  140. m4_include([update.at])
  141. m4_include([volume.at])
  142. m4_include([volsize.at])
  143. m4_include([comprec.at])
  144. m4_include([shortfile.at])
  145. m4_include([shortupd.at])
  146. m4_include([truncate.at])
  147. m4_include([grow.at])
  148. m4_include([star/gtarfail.at])
  149. m4_include([star/gtarfail2.at])
  150. m4_include([star/multi-fail.at])
  151. m4_include([star/ustar-big-2g.at])
  152. m4_include([star/ustar-big-8g.at])
  153. m4_include([star/pax-big-10g.at])