]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
tests: call umount --fake for tmpfs tests
authorKarel Zak <kzak@redhat.com>
Thu, 20 Oct 2016 16:24:24 +0000 (18:24 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 20 Oct 2016 16:27:24 +0000 (18:27 +0200)
On old systems (e.g. RHEL6) with /sbin/mount.tmpfs the mtab file is
modified although our in-tree mount does not support mtab file. We
need to call umount --fake to be sure that we remove unwanted lines
from the test.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
tests/ts/mount/fstab-broken
tests/ts/mount/fstab-none

index f67d35cb14ee1b4e542a82da402d8396b8a1636e..67dfa6e8125ed76b5750a5caac3f42a6ef91782d 100755 (executable)
@@ -45,7 +45,12 @@ else
        ts_log "OK"
 fi
 $TS_CMD_UMOUNT $MNT &> /dev/null
-[ "$?" = "0" ] || ts_log "error: umount $MNT"
+if [ "$?" = "0" ]; then
+       # for old systems with mtab and /sbin/mount.tmpfs
+       /bin/umount --fake "$MNT" &> /dev/null
+else
+       ts_log "error: umount $MNT"
+fi
 ts_finalize_subtest
 
 
@@ -59,7 +64,12 @@ else
        ts_log "OK"
 fi
 $TS_CMD_UMOUNT $MNT &> /dev/null
-[ "$?" = "0" ] || ts_log "error: umount $MNT"
+if [ "$?" = "0" ]; then
+       # for old systems with mtab and /sbin/mount.tmpfs
+       /bin/umount --fake $MNT &> /dev/null
+else
+       ts_log "error: umount $MNT"
+fi
 ts_finalize_subtest
 
 ts_fstab_clean
index ff610a60727b8a641de0671a8830d69af1fed0cc..65b3b7a5a7869028f8988c11dc85b07bbaf2a704 100755 (executable)
@@ -27,6 +27,9 @@ $TS_CMD_FINDMNT --source "none" --mountpoint "$TS_MOUNTPOINT" &> /dev/null
 
 $TS_CMD_UMOUNT $TS_MOUNTPOINT || ts_die "Cannot umount $TS_MOUNTPOINT"
 
+# for old systems with mtab and /sbin/mount.tmpfs
+/bin/umount --fake "$TS_MOUNTPOINT" &> /dev/null
+
 ts_fstab_clean
 
 ts_log "Success"