#
# - all this test uses global $TS_OUTPUT.{mtab,mountinfo}
-
-#
-# Traditional /etc/mtab
-#
export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
rm -f $LIBMOUNT_MTAB
> $LIBMOUNT_MTAB
-ts_init_subtest "mtab-mount"
-ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
-ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
-ts_valgrind $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
-ts_valgrind $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
-ts_valgrind $TESTPROG --add none /proc proc defaults
-cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
-ts_finalize_subtest # checks the mtab
-
-ts_init_subtest "mtab-move"
-ts_valgrind $TESTPROG --move /mnt/foo /mnt/newfoo
-ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
-cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
-ts_finalize_subtest # checks the mtab
-
-ts_init_subtest "mtab-remount"
-ts_valgrind $TESTPROG --remount /mnt/newfoo "ro,noatime"
-ts_valgrind $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
-cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
-ts_finalize_subtest # checks the mtab
-ts_init_subtest "mtab-umount"
-ts_valgrind $TESTPROG --remove /mnt/bar
-ts_valgrind $TESTPROG --remove /mnt/gogo
-ts_valgrind $TESTPROG --remove /proc
-cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
-ts_finalize_subtest # checks the mtab
+#
+# Traditional /etc/mtab
+#
+has_mtab=$( ts_has_mtab_support )
+if [ "$has_mtab" == "yes" ]; then
+
+ ts_init_subtest "mtab-mount"
+ ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
+ ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
+ ts_valgrind $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
+ ts_valgrind $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
+ ts_valgrind $TESTPROG --add none /proc proc defaults
+ cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ ts_finalize_subtest # checks the mtab
+
+ ts_init_subtest "mtab-move"
+ ts_valgrind $TESTPROG --move /mnt/foo /mnt/newfoo
+ ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
+ cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ ts_finalize_subtest # checks the mtab
+
+ ts_init_subtest "mtab-remount"
+ ts_valgrind $TESTPROG --remount /mnt/newfoo "ro,noatime"
+ ts_valgrind $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
+ cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ ts_finalize_subtest # checks the mtab
+
+ ts_init_subtest "mtab-umount"
+ ts_valgrind $TESTPROG --remove /mnt/bar
+ ts_valgrind $TESTPROG --remove /mnt/gogo
+ ts_valgrind $TESTPROG --remove /proc
+ cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ ts_finalize_subtest # checks the mtab
+fi
#
# utab
ts_device_init
DEVICE=$TS_LODEV
+MTAB_FILE="/proc/mounts"
+has_mtab=$( ts_has_mtab_support )
+if [ "$has_mtab" == "yes" ]; then
+ MTAB_FILE="/etc/mtab"
+fi
+
mkfs.ext3 $DEVICE &> /dev/null || ts_die "Cannot make ext3 on $DEVICE"
ts_device_has "TYPE" "ext3" $DEVICE || ts_die "Cannot find ext3 on $DEVICE"
ts_is_mounted $DEVICE || ts_die "Cannot find $DEVICE in /proc/mounts"
-grep -q $DEVICE /etc/mtab ||
- echo "mount failed: cannot find $DEVICE in mtab" >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $MTAB_FILE ||
+ echo "mount failed: cannot find $DEVICE in $MTAB_FILE" >> $TS_OUTPUT 2>&1
$TS_CMD_UMOUNT $DEVICE || ts_die "Cannot umount $DEVICE"
-grep -q $DEVICE /etc/mtab &&
- echo "umount failed: found $DEVICE in mtab" >> $TS_OUTPUT 2>&1
+grep -q $DEVICE $MTAB_FILE &&
+ echo "umount failed: found $DEVICE in $MTAB_FILE" >> $TS_OUTPUT 2>&1
ts_log "Success"
ts_finalize