label03.at 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright (C) 2010 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, see <http://www.gnu.org/licenses/>.
  14. # Description: Test the functionality of the --test-label option.
  15. # In versions up to 1.23 it did not match the documentation. This
  16. # test case follows the examples from "9.7 Including a Label in the Archive".
  17. # References: <15929_1268069389_4B95340D_15929_35_1_D621E31C29598A43AF7B4BBD30CCDDFD0838294A@fr0-mailmb04.res.airbus.corp>
  18. #
  19. AT_SETUP([test-label option])
  20. AT_KEYWORDS([label label03 test-label])
  21. AT_TAR_CHECK([
  22. exec <&-
  23. genfile --file file
  24. tar -c --label='iamalabel' --file iamanarchive file
  25. tar -c --file unlabeled.tar file
  26. decho "# Display label"
  27. tar --test-label --file=iamanarchive; echo $?
  28. decho "# Display label: unlabeled"
  29. tar --test-label --file=unlabeled.tar; echo $?
  30. decho "# Test label: success"
  31. tar --test-label --file=iamanarchive 'iamalabel'; echo $?
  32. decho "# Test label: failure"
  33. tar --test-label --file=iamanarchive 'amalabel'; echo $?
  34. decho "# Test label: unlabeled"
  35. tar --test-label --file=unlabeled.tar 'amalabel'; echo $?
  36. decho "# Test label, verbose: success"
  37. tar --test-label --verbose --file=iamanarchive 'iamalabel'; echo $?
  38. decho "# Test label, verbose: failure"
  39. tar --test-label --verbose --file=iamanarchive 'amalabel'; echo $?
  40. decho "# Test label: multiple arguments"
  41. tar --test-label --file=iamanarchive a iamalabel b; echo $?
  42. decho "# Test label: wildcards"
  43. tar --test-label --file=iamanarchive --wildcards '*label'; echo $?
  44. ],
  45. [0],
  46. [# Display label
  47. iamalabel
  48. 0
  49. # Display label: unlabeled
  50. 0
  51. # Test label: success
  52. 0
  53. # Test label: failure
  54. 1
  55. # Test label: unlabeled
  56. 1
  57. # Test label, verbose: success
  58. iamalabel
  59. 0
  60. # Test label, verbose: failure
  61. iamalabel
  62. 1
  63. # Test label: multiple arguments
  64. 0
  65. # Test label: wildcards
  66. 0
  67. ],
  68. [# Display label
  69. # Display label: unlabeled
  70. # Test label: success
  71. # Test label: failure
  72. # Test label: unlabeled
  73. # Test label, verbose: success
  74. # Test label, verbose: failure
  75. tar: Archive label mismatch
  76. # Test label: multiple arguments
  77. # Test label: wildcards
  78. ],[],[],[gnu,oldgnu,posix])
  79. AT_CLEANUP