summaryrefslogtreecommitdiff
path: root/tests/ts/libmount/update
blob: 7de942518b012be41c694e2bb2f8e8f9eb4c1794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash

# Copyright (C) 2010 Karel Zak <kzak@redhat.com>

TS_TOPDIR="$(dirname $0)/../.."
TS_DESC="tab update"

. $TS_TOPDIR/functions.sh
ts_init "$*"

TESTPROG="$TS_HELPER_LIBMOUNT_UPDATE"

# IMPORTANT notes:
#
#  - the $TS_OUTPUT variable is between ts_init_subtest and ts_finalize_subtest
#    redefined to subtest specific namespace -- it means that $TS_OUTPUT is a
#    different file within a subtest.
#
#  - all this test uses global $TS_OUTPUT.{mtab,mountinfo}


#
# Traditional /etc/mtab
#
export LIBMOUNT_MTAB=$TS_OUTPUT.mtab
export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab

> $LIBMOUNT_MTAB
> $LIBMOUNT_FSTAB

ts_init_subtest "mtab-mount"
$TESTPROG --add /dev/sda1 /mnt/foo ext3 "rw,bbb,ccc,fff=FFF,ddd,noexec"
$TESTPROG --add /dev/sdb1 /mnt/bar ext3 "gg=G,ffff=f,ro,noatime"
$TESTPROG --add /dev/sda2 /mnt/bar ext3 "rw,noatime"
$TESTPROG --add /dev/sda1 /mnt/gogo ext3 "rw,noatime,nosuid"
cp $LIBMOUNT_MTAB $TS_OUTPUT	# save the mtab aside
ts_finalize_subtest		# checks the mtab

ts_init_subtest "mtab-move"
$TESTPROG --move /mnt/foo /mnt/newfoo
$TESTPROG --move /mnt/bar /mnt/newbar
cp $LIBMOUNT_MTAB $TS_OUTPUT	# save the mtab aside
ts_finalize_subtest		# checks the mtab

ts_init_subtest "mtab-remount"
$TESTPROG --remount /mnt/newfoo "ro,noatime"
$TESTPROG --remount /mnt/bar "rw,atime,nosuid"
cp $LIBMOUNT_MTAB $TS_OUTPUT	# save the mtab aside
ts_finalize_subtest		# checks the mtab

ts_init_subtest "mtab-umount"
$TESTPROG --remove /mnt/bar
$TESTPROG --remove /mnt/gogo
cp $LIBMOUNT_MTAB $TS_OUTPUT	# save the mtab aside
ts_finalize_subtest		# checks the mtab

ts_finalize