dirrem01.at 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Process this file with autom4te to create testsuite. -*- Autotest -*-
  2. # Test suite for GNU tar.
  3. # Copyright 2017-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:
  16. #
  17. # When a directory in a deep directory disappeared during creation
  18. # of incremental dump, tar <= 1.29 exits with TAREXIT_FAILURE (2).
  19. #
  20. # In case of files tar does not return TAREXIT_FAILURE, but instead
  21. # it prints a warning and exits with TAREXIT_DIFFERS.
  22. #
  23. # This test checks whether this behaviour is mimicked for directories, too.
  24. #
  25. # Notes:
  26. # 1. This file is based on 'filerem01.at', which is the test-case for
  27. # a vanishing file.
  28. # 2. Depending on the stat.st_ctime resolution, the "file changed as we
  29. # read it" warning might be issued for dir/sub. The test takes care to
  30. # suppress it.
  31. AT_SETUP([directory removed before reading])
  32. AT_KEYWORDS([create incremental listed dirchange dirrem dirrem01])
  33. AT_TAR_CHECK([
  34. mkdir dir
  35. mkdir dir/sub
  36. genfile --file dir/file1
  37. genfile --file dir/sub/file2
  38. case "$TEST_TAR_FORMAT" in
  39. posix) CPT=5;;
  40. gnu) CPT=3;;
  41. *) AT_SKIP_TEST
  42. esac
  43. genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
  44. tar --blocking-factor=1 -c -f archive.tar \
  45. --listed-incremental db \
  46. --warning=no-file-changed \
  47. -v dir >/dev/null
  48. ],
  49. [1],
  50. [ignore],
  51. [tar: dir: Directory is new
  52. tar: dir/sub: Directory is new
  53. tar: dir/sub: File removed before we read it
  54. ],[],[],[gnu,posix])
  55. AT_CLEANUP