]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tests/ts/libmount/tabfiles-tags-py
5e72a6f907918d632744d5a5cb69c7bbe0e539fe
[thirdparty/util-linux.git] / tests / ts / libmount / tabfiles-tags-py
1 #!/bin/bash
2
3 TS_TOPDIR="${0%/*}/../.."
4 TS_DESC="tags-py"
5
6 . $TS_TOPDIR/functions.sh
7 ts_init "$*"
8
9 ts_skip_nonroot
10
11 ts_init_py libmount
12
13 if [ -f "$ASAN_SYMBOLIZER_PATH" ]; then
14 TS_KNOWN_FAIL="yes"
15 fi
16
17 TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB"
18 [ -x $TESTPROG ] || ts_die "test script missing"
19
20 ts_check_prog "mkfs.ext3"
21
22 PYDBG="$PYTHON -m pdb"
23
24 # set global variable TS_DEVICE
25 ts_scsi_debug_init dev_size_mb=50 sector_size=512
26 LABEL="testLibmount"
27 UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
28
29 #
30 # Create filesystem
31 #
32 mkfs.ext3 -F -L $LABEL $TS_DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $TS_DEVICE"
33 ts_device_has "LABEL" "$LABEL" "$TS_DEVICE" || ts_die "Cannot find LABEL '$LABEL' on $TS_DEVICE"
34 ts_device_has "UUID" "$UUID" "$TS_DEVICE" || ts_die "Cannot find $UUID on $TS_DEVICE"
35
36 FSTAB="$TS_OUTDIR/fstab"
37
38 #
39 # Label in fstab
40 #
41 echo "LABEL=$LABEL /mnt/mountpoint auto defaults" > $FSTAB
42 ts_udevadm_settle "$DEVICE" "LABEL" "UUID"
43
44 ts_init_subtest "fstab-label2uuid"
45 $PYTHON $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
46 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
47 ts_finalize_subtest
48
49 ts_init_subtest "fstab-label2dev"
50 $PYTHON $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
51 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
52 ts_finalize_subtest
53
54 #
55 # Add more enties for the same device
56 #
57 echo "UUID=$UUID /mnt/mountpoint2 auto defaults" >> $FSTAB
58
59 ts_init_subtest "fstab-uuid"
60 # has to return /mnt/mountpoint2
61 $PYTHON $TESTPROG --find-forward $FSTAB source "UUID=$UUID" &> $TS_OUTPUT
62 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
63 ts_finalize_subtest
64
65 ts_init_subtest "fstab-label"
66 # has to return /mnt/mountpoint
67 $PYTHON $TESTPROG --find-forward $FSTAB source "LABEL=$LABEL" &> $TS_OUTPUT
68 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
69 ts_finalize_subtest
70
71
72 ts_init_subtest "fstab-dev2label"
73 # has to return /mnt/mountpoint
74 $PYTHON $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
75 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
76 ts_finalize_subtest
77
78 #
79 # Add devname
80 #
81 echo "$TS_DEVICE /mnt/mountpoint3 auto defaults" >> $FSTAB
82
83 ts_init_subtest "fstab-dev"
84 # has to return /mnt/mountpoint3
85 $PYTHON $TESTPROG --find-forward $FSTAB source $TS_DEVICE &> $TS_OUTPUT
86 sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT
87 sed -i -e 's/source: .*//g' $TS_OUTPUT # devname is generated, remove it
88 ts_finalize_subtest
89
90 ts_finalize