stat: add %m to output the mount point for a file
[coreutils/ericb.git] / tests / misc / stat-mount
blobc1c43d49cf274137cc4ef9fc283f7a92a9c97311
1 #!/bin/sh
2 # Test stat -c%m
4 # Copyright (C) 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 . "${srcdir=.}/init.sh"; path_prepend_ ../src
21 # Note we assume that the current directory is not bind mounted
22 # (as then, stat and df may have different results).
23 # This should be the case given the directory is temporary
24 # for the duration of the test.
26 df_mnt=$(df -P . | sed -n '2s/.* \([^ ]*$\)/\1/p')
27 stat_mnt=$(stat -c%m .)
29 test "$df_mnt" = "$stat_mnt" || fail=1
31 Exit $fail