]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/update
cleanup: Remove some spurious spaces
[thirdparty/util-linux.git] / tests / ts / libmount / update
1 #!/bin/bash
2
3 # Copyright (C) 2010 Karel Zak <kzak@redhat.com>
4
5 TS_TOPDIR="${0%/*}/../.."
6 TS_DESC="tab update"
7
8 . $TS_TOPDIR/functions.sh
9 ts_init "$*"
10 ts_skip_nonroot
11
12 TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE"
13
14 [ -x $TESTPROG ] || ts_skip "test not compiled"
15
16 # IMPORTANT notes:
17 #
18 # - the $TS_OUTPUT variable is between ts_init_subtest and ts_finalize_subtest
19 # redefined to subtest specific namespace -- it means that $TS_OUTPUT is a
20 # different file within a subtest.
21 #
22 # - all this test uses global $TS_OUTPUT.{mtab,mountinfo}
23
24 export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
25 rm -f $LIBMOUNT_MTAB
26 > $LIBMOUNT_MTAB
27
28
29 #
30 # Traditional /etc/mtab
31 #
32 has_mtab=$( ts_has_mtab_support )
33 if [ "$has_mtab" == "yes" ]; then
34
35 ts_init_subtest "mtab-mount"
36 ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
37 ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
38 ts_run $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
39 ts_run $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
40 ts_run $TESTPROG --add none /proc proc defaults
41 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
42 ts_finalize_subtest # checks the mtab
43
44 ts_init_subtest "mtab-move"
45 ts_run $TESTPROG --move /mnt/foo /mnt/newfoo
46 ts_run $TESTPROG --move /mnt/bar /mnt/newbar
47 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
48 ts_finalize_subtest # checks the mtab
49
50 ts_init_subtest "mtab-remount"
51 ts_run $TESTPROG --remount /mnt/newfoo "ro,noatime"
52 ts_run $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
53 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
54 ts_finalize_subtest # checks the mtab
55
56 ts_init_subtest "mtab-umount"
57 ts_run $TESTPROG --remove /mnt/bar
58 ts_run $TESTPROG --remove /mnt/gogo
59 ts_run $TESTPROG --remove /proc
60 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
61 ts_finalize_subtest # checks the mtab
62 fi
63
64 #
65 # utab
66 #
67 rm -f $LIBMOUNT_MTAB
68 ln -s /proc/mounts $LIBMOUNT_MTAB
69
70 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
71 rm -f $LIBMOUNT_UTAB
72 > $LIBMOUNT_UTAB
73
74 ts_init_subtest "utab-mount"
75 ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
76 ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
77 ts_run $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
78 ts_run $TESTPROG --add none /proc proc "rw,user"
79 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
80 ts_finalize_subtest # checks the mtab
81
82 ts_init_subtest "utab-move"
83 ts_run $TESTPROG --move /mnt/bar /mnt/newbar
84 ts_run $TESTPROG --move /mnt/xyz /mnt/newxyz
85 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
86 ts_finalize_subtest # checks the mtab
87
88 ts_init_subtest "utab-remount"
89 ts_run $TESTPROG --remount /mnt/newbar "ro,noatime"
90 ts_run $TESTPROG --remount /mnt/newxyz "rw,user"
91 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
92 ts_finalize_subtest # checks the mtab
93
94 ts_init_subtest "utab-umount"
95 ts_run $TESTPROG --remove /mnt/newbar
96 ts_run $TESTPROG --remove /proc
97 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
98 ts_finalize_subtest # checks the mtab
99
100 #
101 # fstab - replace
102 #
103 export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
104 rm -f $LIBMOUNT_FSTAB
105 cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
106
107 ts_init_subtest "fstab-replace"
108 ts_run $TESTPROG --replace "LABEL=foo" "/mnt/foo"
109 cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
110 ts_finalize_subtest #checks the fstab
111
112 ts_finalize