numeric.at 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2015-2023 Free Software Foundation, Inc.
  4. #
  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. #
  10. # GNU tar is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. AT_SETUP([--numeric-owner basic tests])
  18. AT_KEYWORDS([options numeric numeric-owner])
  19. m4_pushdef([TESTOP],[
  20. decho $1
  21. tar $1 -vvf a dir --numeric-owner |dnl
  22. awk '@S|@2=="'"$MYUID/$MYGID"'" {print "OK"; next} {print}'
  23. tar $1 -vvf a dir |dnl
  24. awk '@S|@2=="'"$MYUSR/$MYGRP"'" {print "OK"; next} {print}'
  25. ])
  26. AT_TAR_CHECK([
  27. MYUID=$(id -u) || AT_SKIP_TEST
  28. MYGID=$(id -g) || AT_SKIP_TEST
  29. MYUSR=$(id -un) || AT_SKIP_TEST
  30. MYGRP=$(id -gn) || AT_SKIP_TEST
  31. mkdir dir
  32. # Ensure correct group id on BSDs.
  33. chown :$MYGID dir >/dev/null 2>/dev/null
  34. genfile --file dir/file
  35. TESTOP([--create])
  36. TESTOP([--list])
  37. TESTOP([--diff])
  38. TESTOP([--extract])
  39. ],
  40. [0],
  41. [--create
  42. OK
  43. OK
  44. OK
  45. OK
  46. --list
  47. OK
  48. OK
  49. OK
  50. OK
  51. --diff
  52. OK
  53. OK
  54. OK
  55. OK
  56. --extract
  57. OK
  58. OK
  59. OK
  60. OK
  61. ],
  62. [--create
  63. --list
  64. --diff
  65. --extract
  66. ],[],[],[posix,gnu,ustar,oldgnu])
  67. AT_CLEANUP
  68. m4_popdef([TESTOP])