summaryrefslogtreecommitdiffstats
path: root/tests/ts/libmount/update
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtests/ts/libmount/update112
-rwxr-xr-xtests/ts/libmount/update-py32
2 files changed, 144 insertions, 0 deletions
diff --git a/tests/ts/libmount/update b/tests/ts/libmount/update
new file mode 100755
index 0000000..5437058
--- /dev/null
+++ b/tests/ts/libmount/update
@@ -0,0 +1,112 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="tab update"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_skip_nonroot
+
+TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE"
+
+[ -x $TESTPROG ] || ts_skip "test not compiled"
+
+# IMPORTANT notes:
+#
+# - the $TS_OUTPUT variable is between ts_init_subtest and ts_finalize_subtest
+# redefined to subtest specific namespace -- it means that $TS_OUTPUT is a
+# different file within a subtest.
+#
+# - all this test uses global $TS_OUTPUT.{mtab,mountinfo}
+
+export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
+rm -f $LIBMOUNT_MTAB
+> $LIBMOUNT_MTAB
+
+
+#
+# Traditional /etc/mtab
+#
+has_mtab=$( ts_has_mtab_support )
+if [ "$has_mtab" == "yes" ]; then
+
+ ts_init_subtest "mtab-mount"
+ ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
+ ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
+ ts_run $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
+ ts_run $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
+ ts_run $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_run $TESTPROG --move /mnt/foo /mnt/newfoo
+ ts_run $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_run $TESTPROG --remount /mnt/newfoo "ro,noatime"
+ ts_run $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_run $TESTPROG --remove /mnt/bar
+ ts_run $TESTPROG --remove /mnt/gogo
+ ts_run $TESTPROG --remove /proc
+ cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
+ ts_finalize_subtest # checks the mtab
+fi
+
+#
+# utab
+#
+rm -f $LIBMOUNT_MTAB
+ln -s /proc/mounts $LIBMOUNT_MTAB
+
+export LIBMOUNT_UTAB=$TS_OUTPUT.utab
+rm -f $LIBMOUNT_UTAB
+> $LIBMOUNT_UTAB
+
+ts_init_subtest "utab-mount"
+ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
+ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
+ts_run $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
+ts_run $TESTPROG --add none /proc proc "rw,user"
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-move"
+ts_run $TESTPROG --move /mnt/bar /mnt/newbar
+ts_run $TESTPROG --move /mnt/xyz /mnt/newxyz
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-remount"
+ts_run $TESTPROG --remount /mnt/newbar "ro,noatime"
+ts_run $TESTPROG --remount /mnt/newxyz "rw,user"
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+ts_init_subtest "utab-umount"
+ts_run $TESTPROG --remove /mnt/newbar
+ts_run $TESTPROG --remove /proc
+cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
+ts_finalize_subtest # checks the mtab
+
+#
+# fstab - replace
+#
+export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
+rm -f $LIBMOUNT_FSTAB
+cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
+
+ts_init_subtest "fstab-replace"
+ts_run $TESTPROG --replace "LABEL=foo" "/mnt/foo"
+cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
+ts_finalize_subtest #checks the fstab
+
+ts_finalize
diff --git a/tests/ts/libmount/update-py b/tests/ts/libmount/update-py
new file mode 100755
index 0000000..66f1754
--- /dev/null
+++ b/tests/ts/libmount/update-py
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="tab update-py"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+ts_init_py libmount
+ts_skip_nonroot
+
+if [ -f "$ASAN_SYMBOLIZER_PATH" ]; then
+ TS_KNOWN_FAIL="yes"
+fi
+
+TESTPROG="$TS_HELPER_PYLIBMOUNT_UPDATE"
+[ -x $TESTPROG ] || ts_die "test script missing"
+
+#
+# fstab - replace
+#
+export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
+rm -f $LIBMOUNT_FSTAB
+cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
+
+ts_init_subtest "fstab-replace"
+$PYTHON $TESTPROG --replace "LABEL=foo" "/mnt/foo" >/dev/null 2>&1
+cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
+ts_finalize_subtest #checks the fstab
+
+ts_finalize