tests: exclude some tests when running on NFS
[coreutils.git] / tests / cp / preserve-slink-time
blob88c1016f81c6ae19dcd6a4f95611b58fe699d075
1 #!/bin/sh
2 # Verify that cp -Pp preserves times even on symlinks.
4 # Copyright (C) 2009-2010 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 if test "$VERBOSE" = yes; then
20 set -x
21 cp --version
24 . $srcdir/test-lib.sh
26 grep '^#define HAVE_UTIMENSAT 1' "$CONFIG_HEADER" > /dev/null ||
27 grep '^#define HAVE_LUTIMES 1' "$CONFIG_HEADER" > /dev/null ||
28 skip_test_ 'this system lacks the utimensat function'
30 ln -s no-such dangle || framework_failure
32 # If the current file system lacks sub-second resolution, sleep for 2s to
33 # ensure that the times on the copy are different from those of the original.
34 case $(stat --format=%y dangle) in
35 ??:??:??.000000000) sleep 2;;
36 esac
38 # Can't use --format=%x, as lstat() modifies atime on some platforms.
39 cp -Pp dangle d2 || framework_failure
40 stat --format=%y dangle > t1 || framework_failure
41 stat --format=%y d2 > t2 || framework_failure
43 compare t1 t2 || fail=1
45 Exit $fail