tests: avoid false failure in tail inotify test
[coreutils.git] / tests / df / df-symlink.sh
blob01dff24e11bde68df4633c226fcd86a1ea116549
1 #!/bin/sh
2 # Ensure that df dereferences symlinks to disk nodes
4 # Copyright (C) 2013-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_ df
22 disk=$(df --out=source '.' | tail -n1) ||
23 skip_ "cannot determine '.' file system"
25 ln -s "$disk" symlink || framework_failure_
27 df --out=source,target "$disk" > exp || skip_ "cannot get info for $disk"
28 df --out=source,target symlink > out || fail=1
29 compare exp out || fail=1
31 # Ensure we output the same values for device nodes and '.'
32 # This was not the case in coreutil-8.22 on systems
33 # where the device in the mount list was a symlink itself.
34 # I.e., '.' => /dev/mapper/fedora-home -> /dev/dm-2
35 # Restrict this test to systems with a 1:1 mapping between
36 # source and target. This excludes for example BTRFS sub-volumes.
37 if test "$(df --output=source | grep -F "$disk" | wc -l)" = 1; then
38 df --out=source,target '.' > out || fail=1
39 compare exp out || fail=1
42 test "$fail" = 1 && dump_mount_list_
44 Exit $fail