summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRuediger Meier2015-03-19 17:11:43 +0100
committerRuediger Meier2015-03-19 17:11:43 +0100
commit51d455ce16a4e42bb17bea893e5cae2edc1872b4 (patch)
tree5f07014aec6722e94271b3fbc9210f7dc88352b6 /tests
parentfindmnt: add --mountpoint command line option (diff)
downloadkernel-qcow2-util-linux-51d455ce16a4e42bb17bea893e5cae2edc1872b4.tar.gz
kernel-qcow2-util-linux-51d455ce16a4e42bb17bea893e5cae2edc1872b4.tar.xz
kernel-qcow2-util-linux-51d455ce16a4e42bb17bea893e5cae2edc1872b4.zip
tests: mount/move also tests findmnt vs. mountpoint
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/commands.sh1
-rwxr-xr-xtests/ts/mount/move15
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/commands.sh b/tests/commands.sh
index fd07b175d..420feb9ae 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 1e50d01d4..b42a93f4f 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