tests: adjust memory limits in head-c.sh
[coreutils.git] / tests / cp / link-symlink.sh
blob8576d914fd0d4320a65db052cdf81c203bfffb16
1 #!/bin/sh
2 # Ensure that cp -a --link maintains timestamps if possible
4 # Copyright (C) 2011-2016 Free Software Foundation, Inc.
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20 print_ver_ cp
22 # Check that the timestamps of the symlink are copied
23 # if we're using hardlink to symlink emulation.
24 touch file
25 ln -s file link || framework_failure_
26 touch -m -h -d 2011-01-01 link ||
27 skip_ "Your system doesn't support updating symlink timestamps"
28 case $(stat --format=%y link) in
29 2011-01-01*) ;;
30 *) skip_ "Your system doesn't support updating symlink timestamps" ;;
31 esac
33 # link.cp is probably a hardlink, but may also be a symlink
34 # In either case the timestamp should match the original.
35 cp -al link link.cp || fail=1
36 case $(stat --format=%y link.cp) in
37 2011-01-01*) ;;
38 *) fail=1 ;;
39 esac
41 Exit $fail