mirror of
https://https.git.savannah.gnu.org/git/findutils.git
synced 2026-01-27 01:44:23 +00:00
tests: make new -mount test more robust
This test failed on non-Linux systems: - On Solaris 11, the output of the native df(1) tool has a different order, and hence the detection of a usable mount point for the test fails. Verify that df(1) is from GNU coreutils, or fall back to 'gdf', else skip the test. - On a FreeBSD system where /home was a symlink to /usr/home, the code for finding a usable mount point failed, because the symlink itself is on the '/' file system. Ensure that the found mount point is identical to the original test directory like /home etc. * tests/find/mount-vs-xdev.sh: Try harder to use a GNU df(1) tool. Check whether the found mount point is identical to the original directory name, thus avoiding symlinks.
This commit is contained in:
parent
3c2af8a185
commit
ebea22e88b
@ -19,9 +19,17 @@
|
||||
. "${srcdir=.}/tests/init.sh"; fu_path_prepend_
|
||||
print_ver_ find
|
||||
|
||||
# Require GNU df in getmntpoint.
|
||||
for f in df gdf; do
|
||||
# Find GNU df.
|
||||
$f --version | grep GNU \
|
||||
&& DF=$f
|
||||
done
|
||||
test "$DF" || skip_ "GNU df required."
|
||||
|
||||
getmntpoint () {
|
||||
# Skip header line and print last field.
|
||||
df "$1" | awk 'NR==2 {print $NF}'
|
||||
$DF "$1" | awk 'NR==2 {print $NF}'
|
||||
}
|
||||
|
||||
mnt_root=$( getmntpoint '/' ) \
|
||||
@ -32,9 +40,10 @@ found=0
|
||||
# Find a directory entry which is mounted (likely) from a different device
|
||||
# than the '/' directory.
|
||||
for m in /dev /home /proc /run /tmp; do
|
||||
test -e "$m" \
|
||||
test -d "$m" \
|
||||
&& mnt_m=$( getmntpoint "$m" ) \
|
||||
&& test "$mnt_root" != "$mnt_m" \
|
||||
&& test "$m" = "$mnt_m" \
|
||||
|| continue
|
||||
|
||||
found=1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user