]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: mount/move also tests findmnt vs. mountpoint
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 19 Mar 2015 16:11:43 +0000 (17:11 +0100)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 19 Mar 2015 16:11:43 +0000 (17:11 +0100)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
tests/commands.sh
tests/ts/mount/move

index fd07b175d2ef55288f2e6f02f3fa1d207076be3c..420feb9aeba8a6b48bb4cf2b8bd9b9f8bff52880 100644 (file)
@@ -64,6 +64,7 @@ TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"}
 TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"}
 TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"}
 TS_CMD_MOUNT=${TS_CMD_MOUNT:-"$top_builddir/mount"}
+TS_CMD_MOUNTPOINT=${TS_CMD_MOUNTPOINT:-"$top_builddir/mountpoint"}
 TS_CMD_NAMEI=${TS_CMD_NAMEI-"$top_builddir/namei"}
 TS_CMD_PARTX=${TS_CMD_PARTX-"$top_builddir/partx"}
 TS_CMD_RENAME=${TS_CMD_RENAME-"$top_builddir/rename"}
index 1e50d01d4f7052d2264af2731a1864712927c6f7..b42a93f4f38a3298538794c2c0094402ff7dfa7a 100755 (executable)
@@ -24,6 +24,7 @@ ts_init "$*"
 ts_check_test_command "$TS_CMD_MOUNT"
 ts_check_test_command "$TS_CMD_UMOUNT"
 ts_check_test_command "$TS_CMD_FINDMNT"
+ts_check_test_command "$TS_CMD_MOUNTPOINT"
 
 ts_skip_nonroot
 
@@ -59,6 +60,20 @@ $TS_CMD_MOUNT --move $DIR_A $DIR_B
 $TS_CMD_FINDMNT --kernel --mountpoint "$DIR_B" &> /dev/null
 [ "$?" == "0" ] || ts_die "Cannot find binded $DIR_B in /proc/self/mountinfo"
 
+# BTW a basic test for findmnt(8) and mountpoint(1)
+for f in `find $DIR_PRIVATE2 $DIR_PRIVATE`; do
+       xo="$($TS_CMD_MOUNTPOINT -q "$f" 2>&1)"
+       x=$?
+       yo="$($TS_CMD_FINDMNT --kernel --mountpoint "$f" 2>&1)"
+       y=$?
+
+       [ "$x" = "$y" ] || ts_log "error: findmount vs. mountpoint: $x, $y, $f"
+       [ -z "$xo" ] || ts_log "error: mountpoint is not quiet: $x, $y, $f"
+       if [ "$y" = "0" -a "$yo" = "" ] || [ "$y" = "1" -a "$yo" != "" ]; then
+               ts_log "error, findmount return value vs. output: $x, $y, $f"
+       fi
+done
+
 # clean up
 $TS_CMD_UMOUNT $DIR_B
 rmdir $DIR_SRC $DIR_A $DIR_B