summaryrefslogtreecommitdiffstats
path: root/tests/ts/libmount/tabfiles-tags-py
blob: 05c2c207656d382248466c417dd388f140f535aa (plain) (blame)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash

TS_TOPDIR="$(dirname $0)/../.."
TS_DESC="tags-py"

. $TS_TOPDIR/functions.sh
ts_init "$*"
ts_init_py libmount
ts_skip_nonroot

TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB"

PYDBG="$PYTHON -m pdb"

DEVICE=$(ts_scsi_debug_init dev_size_mb=50 sector_size=512)
LABEL="testLibmount"
UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"

#
# Create filesystem
#
mkfs.ext3 -F -L $LABEL $DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
udevadm settle

ts_device_has_uuid $DEVICE || ts_die "Cannot find UUID on $DEVICE" $DEVICE

FSTAB="$TS_OUTDIR/fstab"

#
# Label in fstab
#
echo "LABEL=$LABEL /mnt/mountpoint auto defaults" > $FSTAB

ts_init_subtest "fstab-label2uuid"
$PYTHON $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "fstab-label2dev"
$PYTHON $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

#
# Add more enties for the same device
#
echo "UUID=$UUID  /mnt/mountpoint2 auto defaults" >> $FSTAB

ts_init_subtest "fstab-uuid"
# has to return /mnt/mountpoint2
$PYTHON $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

ts_init_subtest "fstab-label"
# has to return /mnt/mountpoint
$PYTHON $TESTPROG --find-forward $FSTAB source "LABEL=$LABEL" &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest


ts_init_subtest "fstab-dev2label"
# has to return /mnt/mountpoint
$PYTHON $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
ts_finalize_subtest

#
# Add devname
#
echo "$DEVICE  /mnt/mountpoint3 auto defaults" >> $FSTAB

ts_init_subtest "fstab-dev"
# has to return /mnt/mountpoint3
$PYTHON $TESTPROG --find-forward $FSTAB source $DEVICE &> $TS_OUTPUT
sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
sed -i -e 's/source: .*//g' $TS_OUTPUT		# devname is generated, remove it
ts_finalize_subtest

udevadm settle
rmmod scsi_debug
ts_finalize