]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/update
ba93e0bbe7c26dfa311baa1df0b489181a08c52a
[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.mountinfo
23
24 #
25 # utab
26 #
27 export LIBMOUNT_UTAB=$TS_OUTPUT.utab
28 rm -f $LIBMOUNT_UTAB
29 > $LIBMOUNT_UTAB
30
31 ts_init_subtest "utab-mount"
32 ts_run $TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
33 ts_run $TESTPROG --add /dev/sdb1 /mnt/bar ext3 "ro,user"
34 ts_run $TESTPROG --add /dev/sda2 /mnt/xyz ext3 "rw,loop=/dev/loop0,uhelper=hal"
35 ts_run $TESTPROG --add none /proc proc "rw,user"
36 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
37 ts_finalize_subtest # checks the utab
38
39 ts_init_subtest "utab-move"
40 ts_run $TESTPROG --move /mnt/bar /mnt/newbar
41 ts_run $TESTPROG --move /mnt/xyz /mnt/newxyz
42 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
43 ts_finalize_subtest # checks the utab
44
45 ts_init_subtest "utab-remount"
46 ts_run $TESTPROG --remount /mnt/newbar "ro,noatime"
47 ts_run $TESTPROG --remount /mnt/newxyz "rw,user"
48 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
49 ts_finalize_subtest # checks the utab
50
51 ts_init_subtest "utab-umount"
52 ts_run $TESTPROG --remove /mnt/newbar
53 ts_run $TESTPROG --remove /proc
54 cp $LIBMOUNT_UTAB $TS_OUTPUT # save the utab aside
55 ts_finalize_subtest # checks the utab
56
57 #
58 # fstab - replace
59 #
60 export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab
61 rm -f $LIBMOUNT_FSTAB
62 cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB
63
64 ts_init_subtest "fstab-replace"
65 ts_run $TESTPROG --replace "LABEL=foo" "/mnt/foo"
66 cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside
67 ts_finalize_subtest #checks the fstab
68
69 ts_finalize