From: Ruediger Meier Date: Thu, 19 Mar 2015 16:11:43 +0000 (+0100) Subject: tests: mount/move also tests findmnt vs. mountpoint X-Git-Tag: v2.27-rc1~337 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=51d455ce16a4e42bb17bea893e5cae2edc1872b4;p=thirdparty%2Futil-linux.git tests: mount/move also tests findmnt vs. mountpoint Signed-off-by: Ruediger Meier --- diff --git a/tests/commands.sh b/tests/commands.sh index fd07b175d2..420feb9aeb 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -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"} diff --git a/tests/ts/mount/move b/tests/ts/mount/move index 1e50d01d4f..b42a93f4f3 100755 --- a/tests/ts/mount/move +++ b/tests/ts/mount/move @@ -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