time02.at 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Test clamping mtime GNU tar. -*- Autotest -*-
  2. #
  3. # Copyright 2016 Free Software Foundation, Inc.
  4. #
  5. # This program 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, or (at your option)
  8. # any later version.
  9. #
  10. # This program 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. # written by Daniel Kahn Gillmor
  18. AT_SETUP([time: clamping mtime])
  19. AT_KEYWORDS([time time02])
  20. AT_TAR_CHECK([
  21. export TZ=UTC0
  22. mkdir dir
  23. touch -d 2015-12-01T00:00:00 dir/a >/dev/null 2>&1 || AT_SKIP_TEST
  24. touch -d 2016-01-01T00:00:00 dir/b >/dev/null 2>&1 || AT_SKIP_TEST
  25. touch -d 2016-02-01T00:00:00 dir/c >/dev/null 2>&1 || AT_SKIP_TEST
  26. touch -d 2038-01-01T00:00:00 dir/d >/dev/null 2>&1 || AT_SKIP_TEST
  27. tar -c --mtime 2016-01-15T00:00:00 --clamp-mtime -f archive.tar dir
  28. tar -d -f archive.tar dir
  29. ],
  30. [1],
  31. [
  32. dir/c: Mod time differs
  33. dir/d: Mod time differs
  34. ], [], [], [],
  35. [pax])
  36. AT_CLEANUP