label03.at 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2010-2023 Free Software Foundation, Inc.
  4. # This file is part of GNU tar.
  5. # GNU tar is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 3 of the License, or
  8. # (at your option) any later version.
  9. # GNU tar is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. # Description: Test the functionality of the --test-label option.
  16. # In versions up to 1.23 it did not match the documentation. This
  17. # test case follows the examples from "9.7 Including a Label in the Archive".
  18. # References: <15929_1268069389_4B95340D_15929_35_1_D621E31C29598A43AF7B4BBD30CCDDFD0838294A@fr0-mailmb04.res.airbus.corp>
  19. #
  20. AT_SETUP([test-label option])
  21. AT_KEYWORDS([label label03 test-label])
  22. AT_TAR_CHECK([
  23. exec <&-
  24. genfile --file file
  25. tar -c --label='iamalabel' --file iamanarchive file
  26. tar -c --file unlabeled.tar file
  27. decho "# Display label"
  28. tar --test-label --file=iamanarchive; echo $?
  29. decho "# Display label: unlabeled"
  30. tar --test-label --file=unlabeled.tar; echo $?
  31. decho "# Test label: success"
  32. tar --test-label --file=iamanarchive 'iamalabel'; echo $?
  33. decho "# Test label: failure"
  34. tar --test-label --file=iamanarchive 'amalabel'; echo $?
  35. decho "# Test label: unlabeled"
  36. tar --test-label --file=unlabeled.tar 'amalabel'; echo $?
  37. decho "# Test label, verbose: success"
  38. tar --test-label --verbose --file=iamanarchive 'iamalabel'; echo $?
  39. decho "# Test label, verbose: failure"
  40. tar --test-label --verbose --file=iamanarchive 'amalabel'; echo $?
  41. decho "# Test label: multiple arguments"
  42. tar --test-label --file=iamanarchive a iamalabel b; echo $?
  43. decho "# Test label: wildcards"
  44. tar --test-label --file=iamanarchive --wildcards '*label'; echo $?
  45. ],
  46. [0],
  47. [# Display label
  48. iamalabel
  49. 0
  50. # Display label: unlabeled
  51. 0
  52. # Test label: success
  53. 0
  54. # Test label: failure
  55. 1
  56. # Test label: unlabeled
  57. 1
  58. # Test label, verbose: success
  59. iamalabel
  60. 0
  61. # Test label, verbose: failure
  62. iamalabel
  63. 1
  64. # Test label: multiple arguments
  65. 0
  66. # Test label: wildcards
  67. 0
  68. ],
  69. [# Display label
  70. # Display label: unlabeled
  71. # Test label: success
  72. # Test label: failure
  73. # Test label: unlabeled
  74. # Test label, verbose: success
  75. # Test label, verbose: failure
  76. tar: Archive label mismatch
  77. # Test label: multiple arguments
  78. # Test label: wildcards
  79. ],[],[],[gnu,oldgnu,posix])
  80. AT_CLEANUP