]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/update
libmount: (tests) don't require root for update tests
[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
11 TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE"
12
13 [ -x $TESTPROG ] || ts_skip "test not compiled"
14
15 # IMPORTANT notes:
16 #
17 # - the $TS_OUTPUT variable is between ts_init_subtest and ts_finalize_subtest
18 # redefined to subtest specific namespace -- it means that $TS_OUTPUT is a
19 # different file within a subtest.
20 #
21 # - all this test uses global $TS_OUTPUT.mountinfo
22
23 #
24 # utab
25 #
26 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
27 rm -f $LIBMOUNT_UTAB
28 > $LIBMOUNT_UTAB
29
30 ts_init_subtest "utab-mount"
31 ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
32 ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
33 ts_run $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
34 ts_run $TESTPROG --add none /proc proc "rw,user"
35 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
36 ts_finalize_subtest # checks the utab
37
38 ts_init_subtest "utab-move"
39 ts_run $TESTPROG --move /mnt/bar /mnt/newbar
40 ts_run $TESTPROG --move /mnt/xyz /mnt/newxyz
41 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
42 ts_finalize_subtest # checks the utab
43
44 ts_init_subtest "utab-remount"
45 ts_run $TESTPROG --remount /mnt/newbar "ro,noatime"
46 ts_run $TESTPROG --remount /mnt/newxyz "rw,user"
47 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
48 ts_finalize_subtest # checks the utab
49
50 ts_init_subtest "utab-umount"
51 ts_run $TESTPROG --remove /mnt/newbar
52 ts_run $TESTPROG --remove /proc
53 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
54 ts_finalize_subtest # checks the utab
55
56 #
57 # fstab - replace
58 #
59 export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
60 rm -f $LIBMOUNT_FSTAB
61 cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
62
63 ts_init_subtest "fstab-replace"
64 ts_run $TESTPROG --replace "LABEL=foo" "/mnt/foo"
65 cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
66 ts_finalize_subtest #checks the fstab
67
68 ts_finalize