]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/update
tests: use libmount tab update tests for UID=0 only
[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="$(dirname $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
25 #
26 # Traditional /etc/mtab
27 #
28 export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
29 rm -f $LIBMOUNT_MTAB
30 > $LIBMOUNT_MTAB
31
32 ts_init_subtest "mtab-mount"
33 $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
34 $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
35 $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
36 $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
37 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
38 ts_finalize_subtest # checks the mtab
39
40 ts_init_subtest "mtab-move"
41 $TESTPROG --move /mnt/foo /mnt/newfoo
42 $TESTPROG --move /mnt/bar /mnt/newbar
43 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
44 ts_finalize_subtest # checks the mtab
45
46 ts_init_subtest "mtab-remount"
47 $TESTPROG --remount /mnt/newfoo "ro,noatime"
48 $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
49 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
50 ts_finalize_subtest # checks the mtab
51
52 ts_init_subtest "mtab-umount"
53 $TESTPROG --remove /mnt/bar
54 $TESTPROG --remove /mnt/gogo
55 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
56 ts_finalize_subtest # checks the mtab
57
58 #
59 # utab
60 #
61 rm -f $LIBMOUNT_MTAB
62 ln -s /proc/mounts $LIBMOUNT_MTAB
63
64 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
65 rm -f $LIBMOUNT_UTAB
66 > $LIBMOUNT_UTAB
67
68 ts_init_subtest "utab-mount"
69 $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
70 $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
71 $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
72 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
73 ts_finalize_subtest # checks the mtab
74
75 ts_init_subtest "utab-move"
76 $TESTPROG --move /mnt/bar /mnt/newbar
77 $TESTPROG --move /mnt/xyz /mnt/newxyz
78 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
79 ts_finalize_subtest # checks the mtab
80
81 ts_init_subtest "utab-remount"
82 $TESTPROG --remount /mnt/newbar "ro,noatime"
83 $TESTPROG --remount /mnt/newxyz "rw,user"
84 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
85 ts_finalize_subtest # checks the mtab
86
87 ts_init_subtest "utab-umount"
88 $TESTPROG --remove /mnt/newbar
89 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
90 ts_finalize_subtest # checks the mtab
91
92 ts_finalize