]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/update
Merge branch 'pg-manual-page-long-options' of https://github.com/jaalto/util-linux
[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
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 ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
34 ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
35 ts_valgrind $TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
36 ts_valgrind $TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
37 ts_valgrind $TESTPROG --add none /proc proc defaults
38 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
39 ts_finalize_subtest # checks the mtab
40
41 ts_init_subtest "mtab-move"
42 ts_valgrind $TESTPROG --move /mnt/foo /mnt/newfoo
43 ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
44 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
45 ts_finalize_subtest # checks the mtab
46
47 ts_init_subtest "mtab-remount"
48 ts_valgrind $TESTPROG --remount /mnt/newfoo "ro,noatime"
49 ts_valgrind $TESTPROG --remount /mnt/bar "rw,atime,nosuid"
50 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
51 ts_finalize_subtest # checks the mtab
52
53 ts_init_subtest "mtab-umount"
54 ts_valgrind $TESTPROG --remove /mnt/bar
55 ts_valgrind $TESTPROG --remove /mnt/gogo
56 ts_valgrind $TESTPROG --remove /proc
57 cp $LIBMOUNT_MTAB $TS_OUTPUT # save the mtab aside
58 ts_finalize_subtest # checks the mtab
59
60 #
61 # utab
62 #
63 rm -f $LIBMOUNT_MTAB
64 ln -s /proc/mounts $LIBMOUNT_MTAB
65
66 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
67 rm -f $LIBMOUNT_UTAB
68 > $LIBMOUNT_UTAB
69
70 ts_init_subtest "utab-mount"
71 ts_valgrind $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
72 ts_valgrind $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
73 ts_valgrind $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
74 ts_valgrind $TESTPROG --add none /proc proc "rw,user"
75 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
76 ts_finalize_subtest # checks the mtab
77
78 ts_init_subtest "utab-move"
79 ts_valgrind $TESTPROG --move /mnt/bar /mnt/newbar
80 ts_valgrind $TESTPROG --move /mnt/xyz /mnt/newxyz
81 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
82 ts_finalize_subtest # checks the mtab
83
84 ts_init_subtest "utab-remount"
85 ts_valgrind $TESTPROG --remount /mnt/newbar "ro,noatime"
86 ts_valgrind $TESTPROG --remount /mnt/newxyz "rw,user"
87 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
88 ts_finalize_subtest # checks the mtab
89
90 ts_init_subtest "utab-umount"
91 ts_valgrind $TESTPROG --remove /mnt/newbar
92 ts_valgrind $TESTPROG --remove /proc
93 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the mtab aside
94 ts_finalize_subtest # checks the mtab
95
96 #
97 # fstab - replace
98 #
99 export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
100 rm -f $LIBMOUNT_FSTAB
101 cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
102
103 ts_init_subtest "fstab-replace"
104 ts_valgrind $TESTPROG --replace "LABEL=foo" "/mnt/foo"
105 cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
106 ts_finalize_subtest #checks the fstab
107
108 ts_finalize