diff options
Diffstat (limited to 'tests')
40 files changed, 1222 insertions, 0 deletions
diff --git a/tests/commands.sh b/tests/commands.sh index 01e21c2b7..84da40061 100644 --- a/tests/commands.sh +++ b/tests/commands.sh @@ -13,6 +13,9 @@ TS_HELPER_LIBMOUNT_TABDIFF="$top_builddir/test_mount_tab_diff" TS_HELPER_LIBMOUNT_TAB="$top_builddir/test_mount_tab" TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update" TS_HELPER_LIBMOUNT_UTILS="$top_builddir/test_mount_utils" +TS_HELPER_PYLIBMOUNT_CONTEXT="$top_builddir/libmount/python/test_mount_context.py" +TS_HELPER_PYLIBMOUNT_TAB="$top_builddir/libmount/python/test_mount_tab.py" +TS_HELPER_PYLIBMOUNT_UPDATE="$top_builddir/libmount/python/test_mount_tab_update.py" TS_HELPER_LOGINDEFS="$top_builddir/test_logindefs" TS_HELPER_MD5="$top_builddir/test_md5" TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"} diff --git a/tests/expected/libmount/context-py b/tests/expected/libmount/context-py new file mode 100644 index 000000000..5e268a319 --- /dev/null +++ b/tests/expected/libmount/context-py @@ -0,0 +1,5 @@ +Init device +Create partitions +Create filesystem +Do tests... +...done. diff --git a/tests/expected/libmount/context-py-mount-by-devname b/tests/expected/libmount/context-py-mount-by-devname new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-py-mount-by-devname @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-py-mount-by-label b/tests/expected/libmount/context-py-mount-by-label new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-py-mount-by-label @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-py-mount-by-uuid b/tests/expected/libmount/context-py-mount-by-uuid new file mode 100644 index 000000000..2f44fc47a --- /dev/null +++ b/tests/expected/libmount/context-py-mount-by-uuid @@ -0,0 +1,2 @@ +successfully mounted +successfully umounted diff --git a/tests/expected/libmount/context-py-mount-flags b/tests/expected/libmount/context-py-mount-flags new file mode 100644 index 000000000..960641863 --- /dev/null +++ b/tests/expected/libmount/context-py-mount-flags @@ -0,0 +1,5 @@ +successfully mounted +ro,nosuid,noexec +successfully mounted +rw,nosuid,noexec +successfully umounted diff --git a/tests/expected/libmount/context-py-mount-loopdev b/tests/expected/libmount/context-py-mount-loopdev new file mode 100644 index 000000000..2f44fc47a --- /dev/null +++ b/tests/expected/libmount/context-py-mount-loopdev @@ -0,0 +1,2 @@ +successfully mounted +successfully umounted diff --git a/tests/expected/libmount/context-py-umount-by-devname b/tests/expected/libmount/context-py-umount-by-devname new file mode 100644 index 000000000..319236f1d --- /dev/null +++ b/tests/expected/libmount/context-py-umount-by-devname @@ -0,0 +1 @@ +successfully umounted diff --git a/tests/expected/libmount/context-py-umount-by-mountpoint b/tests/expected/libmount/context-py-umount-by-mountpoint new file mode 100644 index 000000000..319236f1d --- /dev/null +++ b/tests/expected/libmount/context-py-umount-by-mountpoint @@ -0,0 +1 @@ +successfully umounted diff --git a/tests/expected/libmount/context-py-x-mount.mkdir b/tests/expected/libmount/context-py-x-mount.mkdir new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-py-x-mount.mkdir @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-utab-py b/tests/expected/libmount/context-utab-py new file mode 100644 index 000000000..cde2e3fbb --- /dev/null +++ b/tests/expected/libmount/context-utab-py @@ -0,0 +1,9 @@ +Init device +Create partitions +Create filesystem +Do tests... +Create filesystem [btrfs] +All mount options (btrfs subvolume + utab) --- +rw,relatime,ssd,uhelper=foo +--- +...done. diff --git a/tests/expected/libmount/context-utab-py-mount-by-devname b/tests/expected/libmount/context-utab-py-mount-by-devname new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-utab-py-mount-by-devname @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-utab-py-mount-uhelper b/tests/expected/libmount/context-utab-py-mount-uhelper new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-utab-py-mount-uhelper @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-utab-py-mount-uhelper-subvol b/tests/expected/libmount/context-utab-py-mount-uhelper-subvol new file mode 100644 index 000000000..7504a7e83 --- /dev/null +++ b/tests/expected/libmount/context-utab-py-mount-uhelper-subvol @@ -0,0 +1 @@ +successfully mounted diff --git a/tests/expected/libmount/context-utab-py-umount b/tests/expected/libmount/context-utab-py-umount new file mode 100644 index 000000000..319236f1d --- /dev/null +++ b/tests/expected/libmount/context-utab-py-umount @@ -0,0 +1 @@ +successfully umounted diff --git a/tests/expected/libmount/context-utab-py-umount-by-devname b/tests/expected/libmount/context-utab-py-umount-by-devname new file mode 100644 index 000000000..319236f1d --- /dev/null +++ b/tests/expected/libmount/context-utab-py-umount-by-devname @@ -0,0 +1 @@ +successfully umounted diff --git a/tests/expected/libmount/context-utab-py-umount-subvol b/tests/expected/libmount/context-utab-py-umount-subvol new file mode 100644 index 000000000..319236f1d --- /dev/null +++ b/tests/expected/libmount/context-utab-py-umount-subvol @@ -0,0 +1 @@ +successfully umounted diff --git a/tests/expected/libmount/tabfiles-py-copy b/tests/expected/libmount/tabfiles-py-copy new file mode 100644 index 000000000..0054586bf --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-copy @@ -0,0 +1,18 @@ +ORIGINAL: +------ fs: +source: UUID=d3a8f783-df75-4dc8-9163-975a891052c0 +target: / +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 1 +COPY: +------ fs: +source: UUID=d3a8f783-df75-4dc8-9163-975a891052c0 +target: / +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 1 diff --git a/tests/expected/libmount/tabfiles-py-find-pair b/tests/expected/libmount/tabfiles-py-find-pair new file mode 100644 index 000000000..fbd730a60 --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-find-pair @@ -0,0 +1,6 @@ +------ fs: +source: /dev/mapper/kzak-home +target: /home/kzak +fstype: ext4 +optstr: rw,noatime +VFS-optstr: rw,noatime diff --git a/tests/expected/libmount/tabfiles-py-find-source b/tests/expected/libmount/tabfiles-py-find-source new file mode 100644 index 000000000..474652cbd --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-find-source @@ -0,0 +1,8 @@ +------ fs: +source: UUID=fef7ccb3-821c-4de8-88dc-71472be5946f +target: /boot +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 2 diff --git a/tests/expected/libmount/tabfiles-py-find-target b/tests/expected/libmount/tabfiles-py-find-target new file mode 100644 index 000000000..1a51bd5b0 --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-find-target @@ -0,0 +1,6 @@ +------ fs: +source: /dev/mapper/foo +target: /home/foo +fstype: ext4 +optstr: noatime,defaults +VFS-optstr: noatime diff --git a/tests/expected/libmount/tabfiles-py-find-target2 b/tests/expected/libmount/tabfiles-py-find-target2 new file mode 100644 index 000000000..8a6c57b5e --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-find-target2 @@ -0,0 +1,5 @@ +------ fs: +source: /dev/foo +target: /any/foo/ +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-py-find-target3 b/tests/expected/libmount/tabfiles-py-find-target3 new file mode 100644 index 000000000..8a6c57b5e --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-find-target3 @@ -0,0 +1,5 @@ +------ fs: +source: /dev/foo +target: /any/foo/ +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-py-parse-fstab b/tests/expected/libmount/tabfiles-py-parse-fstab new file mode 100644 index 000000000..d66152676 --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-parse-fstab @@ -0,0 +1,65 @@ +------ fs: +source: UUID=d3a8f783-df75-4dc8-9163-975a891052c0 +target: / +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 1 +------ fs: +source: UUID=fef7ccb3-821c-4de8-88dc-71472be5946f +target: /boot +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 2 +------ fs: +source: UUID=1f2aa318-9c34-462e-8d29-260819ffd657 +target: swap +fstype: swap +optstr: defaults +------ fs: +source: tmpfs +target: /dev/shm +fstype: tmpfs +optstr: defaults +------ fs: +source: devpts +target: /dev/pts +fstype: devpts +optstr: gid=5,mode=620 +FS-opstr: gid=5,mode=620 +------ fs: +source: sysfs +target: /sys +fstype: sysfs +optstr: defaults +------ fs: +source: proc +target: /proc +fstype: proc +optstr: defaults +------ fs: +source: /dev/mapper/foo +target: /home/foo +fstype: ext4 +optstr: noatime,defaults +VFS-optstr: noatime +------ fs: +source: foo.com:/mnt/share +target: /mnt/remote +fstype: nfs +optstr: noauto +user-optstr: noauto +------ fs: +source: //bar.com/gogogo +target: /mnt/gogogo +fstype: cifs +optstr: user=SRGROUP/baby,noauto +user-optstr: user=SRGROUP/baby,noauto +------ fs: +source: /dev/foo +target: /any/foo/ +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-py-parse-fstab-broken b/tests/expected/libmount/tabfiles-py-parse-fstab-broken new file mode 100644 index 000000000..b838fbcc7 --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-parse-fstab-broken @@ -0,0 +1,63 @@ + + +------ fs: +source: UUID=d3a8f783-df75-4dc8-9163-975a891052c0 +target: / +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 1 +------ fs: +source: UUID=fef7ccb3-821c-4de8-88dc-71472be5946f +target: /boot +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 2 +------ fs: +source: UUID=1f2aa318-9c34-462e-8d29-260819ffd657 +target: swap +fstype: swap +optstr: defaults +------ fs: +source: tmpfs +target: /dev/shm +fstype: tmpfs +optstr: defaults +------ fs: +source: devpts +target: /dev/pts +fstype: devpts +optstr: gid=5,mode=620 +FS-opstr: gid=5,mode=620 +------ fs: +source: sysfs +target: /sys +fstype: sysfs +optstr: defaults +------ fs: +source: proc +target: /proc +fstype: proc +optstr: defaults +------ fs: +source: /dev/mapper/foo +target: /home/foo +fstype: ext4 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +------ fs: +source: foo.com:/mnt/share +target: /mnt/remote +fstype: nfs +optstr: noauto +user-optstr: noauto +------ fs: +source: //bar.com/gogogo +target: /mnt/gogogo +fstype: cifs +optstr: user=SRGROUP/baby,noauto +user-optstr: user=SRGROUP/baby,noauto diff --git a/tests/expected/libmount/tabfiles-py-parse-fstab-full b/tests/expected/libmount/tabfiles-py-parse-fstab-full new file mode 100644 index 000000000..f1caff6d9 --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-parse-fstab-full @@ -0,0 +1,83 @@ +Initial comment: +"# + # this is a leading comment +# + +" +------ fs: +source: UUID=d3a8f783-df75-4dc8-9163-975a891052c0 +target: / +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 1 +comment: '# this comments belongs to the first fs +' +------ fs: +source: UUID=fef7ccb3-821c-4de8-88dc-71472be5946f +target: /boot +fstype: ext3 +optstr: noatime,defaults +VFS-optstr: noatime +freq: 1 +pass: 2 +------ fs: +source: UUID=1f2aa318-9c34-462e-8d29-260819ffd657 +target: swap +fstype: swap +optstr: defaults +comment: ' +# 3rd fs comment + newline padding + +' +------ fs: +source: tmpfs +target: /dev/shm +fstype: tmpfs +optstr: defaults +------ fs: +source: devpts +target: /dev/pts +fstype: devpts +optstr: gid=5,mode=620 +FS-opstr: gid=5,mode=620 +------ fs: +source: sysfs +target: /sys +fstype: sysfs +optstr: defaults +------ fs: +source: proc +target: /proc +fstype: proc +optstr: defaults +------ fs: +source: /dev/mapper/foo +target: /home/foo +fstype: ext4 +optstr: noatime,defaults +VFS-optstr: noatime +comment: '# this is comment +' +------ fs: +source: foo.com:/mnt/share +target: /mnt/remote +fstype: nfs +optstr: noauto +user-optstr: noauto +------ fs: +source: //bar.com/gogogo +target: /mnt/gogogo +fstype: cifs +optstr: user=SRGROUP/baby,noauto +user-optstr: user=SRGROUP/baby,noauto +------ fs: +source: /dev/foo +target: /any/foo/ +fstype: auto +optstr: defaults +Trailing comment: +" +#this is a trailing comment +" diff --git a/tests/expected/libmount/tabfiles-py-parse-mountinfo b/tests/expected/libmount/tabfiles-py-parse-mountinfo new file mode 100644 index 000000000..44708011d --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-parse-mountinfo @@ -0,0 +1,352 @@ +------ fs: +source: /proc +target: /proc +fstype: proc +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 15 +parent: 20 +devno: 0:3 +------ fs: +source: /sys +target: /sys +fstype: sysfs +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 16 +parent: 20 +devno: 0:15 +------ fs: +source: udev +target: /dev +fstype: devtmpfs +optstr: rw,relatime,size=1983516k,nr_inodes=495879,mode=755 +VFS-optstr: rw,relatime +FS-opstr: rw,size=1983516k,nr_inodes=495879,mode=755 +root: / +id: 17 +parent: 20 +devno: 0:5 +------ fs: +source: devpts +target: /dev/pts +fstype: devpts +optstr: rw,relatime,gid=5,mode=620,ptmxmode=000 +VFS-optstr: rw,relatime +FS-opstr: rw,gid=5,mode=620,ptmxmode=000 +root: / +id: 18 +parent: 17 +devno: 0:10 +------ fs: +source: tmpfs +target: /dev/shm +fstype: tmpfs +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 19 +parent: 17 +devno: 0:16 +------ fs: +source: /dev/sda4 +target: / +fstype: ext3 +optstr: rw,noatime,errors=continue,user_xattr,acl,barrier=0,data=ordered +VFS-optstr: rw,noatime +FS-opstr: rw,errors=continue,user_xattr,acl,barrier=0,data=ordered +root: / +id: 20 +parent: 1 +devno: 8:4 +------ fs: +source: tmpfs +target: /sys/fs/cgroup +fstype: tmpfs +optstr: rw,nosuid,nodev,noexec,relatime,mode=755 +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,mode=755 +root: / +id: 21 +parent: 16 +devno: 0:17 +------ fs: +source: cgroup +target: /sys/fs/cgroup/systemd +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd +root: / +id: 22 +parent: 21 +devno: 0:18 +------ fs: +source: cgroup +target: /sys/fs/cgroup/cpuset +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,cpuset +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,cpuset +root: / +id: 23 +parent: 21 +devno: 0:19 +------ fs: +source: cgroup +target: /sys/fs/cgroup/ns +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,ns +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,ns +root: / +id: 24 +parent: 21 +devno: 0:20 +------ fs: +source: cgroup +target: /sys/fs/cgroup/cpu +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,cpu +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,cpu +root: / +id: 25 +parent: 21 +devno: 0:21 +------ fs: +source: cgroup +target: /sys/fs/cgroup/cpuacct +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,cpuacct +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,cpuacct +root: / +id: 26 +parent: 21 +devno: 0:22 +------ fs: +source: cgroup +target: /sys/fs/cgroup/memory +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,memory +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,memory +root: / +id: 27 +parent: 21 +devno: 0:23 +------ fs: +source: cgroup +target: /sys/fs/cgroup/devices +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,devices +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,devices +root: / +id: 28 +parent: 21 +devno: 0:24 +------ fs: +source: cgroup +target: /sys/fs/cgroup/freezer +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,freezer +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,freezer +root: / +id: 29 +parent: 21 +devno: 0:25 +------ fs: +source: cgroup +target: /sys/fs/cgroup/net_cls +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,net_cls +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,net_cls +root: / +id: 30 +parent: 21 +devno: 0:26 +------ fs: +source: cgroup +target: /sys/fs/cgroup/blkio +fstype: cgroup +optstr: rw,nosuid,nodev,noexec,relatime,blkio +VFS-optstr: rw,nosuid,nodev,noexec,relatime +FS-opstr: rw,blkio +root: / +id: 31 +parent: 21 +devno: 0:27 +------ fs: +source: systemd-1 +target: /sys/kernel/security +fstype: autofs +optstr: rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +VFS-optstr: rw,relatime +FS-opstr: rw,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / +id: 32 +parent: 16 +devno: 0:28 +------ fs: +source: systemd-1 +target: /dev/hugepages +fstype: autofs +optstr: rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +VFS-optstr: rw,relatime +FS-opstr: rw,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / +id: 33 +parent: 17 +devno: 0:29 +------ fs: +source: systemd-1 +target: /sys/kernel/debug +fstype: autofs +optstr: rw,relatime,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +VFS-optstr: rw,relatime +FS-opstr: rw,fd=24,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / +id: 34 +parent: 16 +devno: 0:30 +------ fs: +source: systemd-1 +target: /proc/sys/fs/binfmt_misc +fstype: autofs +optstr: rw,relatime,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +VFS-optstr: rw,relatime +FS-opstr: rw,fd=25,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / +id: 35 +parent: 15 +devno: 0:31 +------ fs: +source: systemd-1 +target: /dev/mqueue +fstype: autofs +optstr: rw,relatime,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +VFS-optstr: rw,relatime +FS-opstr: rw,fd=26,pgrp=1,timeout=300,minproto=5,maxproto=5,direct +root: / +id: 36 +parent: 17 +devno: 0:32 +------ fs: +source: /proc/bus/usb +target: /proc/bus/usb +fstype: usbfs +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 37 +parent: 15 +devno: 0:14 +------ fs: +source: hugetlbfs +target: /dev/hugepages +fstype: hugetlbfs +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 38 +parent: 33 +devno: 0:33 +------ fs: +source: mqueue +target: /dev/mqueue +fstype: mqueue +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 39 +parent: 36 +devno: 0:12 +------ fs: +source: /dev/sda6 +target: /boot +fstype: ext3 +optstr: rw,noatime,errors=continue,barrier=0,data=ordered +VFS-optstr: rw,noatime +FS-opstr: rw,errors=continue,barrier=0,data=ordered +root: / +id: 40 +parent: 20 +devno: 8:6 +------ fs: +source: /dev/mapper/kzak-home +target: /home/kzak +fstype: ext4 +optstr: rw,noatime,barrier=1,data=ordered +VFS-optstr: rw,noatime +FS-opstr: rw,barrier=1,data=ordered +root: / +id: 41 +parent: 20 +devno: 253:0 +------ fs: +source: none +target: /proc/sys/fs/binfmt_misc +fstype: binfmt_misc +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 42 +parent: 35 +devno: 0:34 +------ fs: +source: fusectl +target: /sys/fs/fuse/connections +fstype: fusectl +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 43 +parent: 16 +devno: 0:35 +------ fs: +source: gvfs-fuse-daemon +target: /home/kzak/.gvfs +fstype: fuse.gvfs-fuse-daemon +optstr: rw,nosuid,nodev,relatime,user_id=500,group_id=500 +VFS-optstr: rw,nosuid,nodev,relatime +FS-opstr: rw,user_id=500,group_id=500 +root: / +id: 44 +parent: 41 +devno: 0:36 +------ fs: +source: sunrpc +target: /var/lib/nfs/rpc_pipefs +fstype: rpc_pipefs +optstr: rw,relatime +VFS-optstr: rw,relatime +FS-opstr: rw +root: / +id: 45 +parent: 20 +devno: 0:37 +------ fs: +source: //foo.home/bar/ +target: /mnt/sounds +fstype: cifs +optstr: rw,relatime,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +VFS-optstr: rw,relatime +FS-opstr: rw,unc=\\foo.home\bar,username=kzak,domain=SRGROUP,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.111.1,posixpaths,serverino,acl,rsize=16384,wsize=57344 +root: / +id: 47 +parent: 20 +devno: 0:38 diff --git a/tests/expected/libmount/tabfiles-py-parse-mtab b/tests/expected/libmount/tabfiles-py-parse-mtab new file mode 100644 index 000000000..ffd0c139d --- /dev/null +++ b/tests/expected/libmount/tabfiles-py-parse-mtab @@ -0,0 +1,68 @@ +------ fs: +source: /dev/sda4 +target: / +fstype: ext3 +optstr: rw,noatime +VFS-optstr: rw,noatime +------ fs: +source: proc +target: /proc +fstype: proc +optstr: rw +VFS-optstr: rw +------ fs: +source: sysfs +target: /sys +fstype: sysfs +optstr: rw +VFS-optstr: rw +------ fs: +source: devpts +target: /dev/pts +fstype: devpts +optstr: rw,gid=5,mode=620 +VFS-optstr: rw +FS-opstr: gid=5,mode=620 +------ fs: +source: tmpfs +target: /dev/shm +fstype: tmpfs +optstr: rw +VFS-optstr: rw +------ fs: +source: /dev/sda6 +target: /boot +fstype: ext3 +optstr: rw,noatime +VFS-optstr: rw,noatime +------ fs: +source: /dev/mapper/kzak-home +target: /home/kzak +fstype: ext4 +optstr: rw,noatime +VFS-optstr: rw,noatime +------ fs: +source: none +target: /proc/sys/fs/binfmt_misc +fstype: binfmt_misc +optstr: rw +VFS-optstr: rw +------ fs: +source: fusectl +target: /sys/fs/fuse/connections +fstype: fusectl +optstr: rw +VFS-optstr: rw +------ fs: +source: gvfs-fuse-daemon +target: /home/kzak/.gvfs +fstype: fuse.gvfs-fuse-daemon +optstr: rw,nosuid,nodev,user=kzak +VFS-optstr: rw,nosuid,nodev +user-optstr: user=kzak +------ fs: +source: sunrpc +target: /var/lib/nfs/rpc_pipefs +fstype: rpc_pipefs +optstr: rw +VFS-optstr: rw diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-dev b/tests/expected/libmount/tabfiles-tags-py-fstab-dev new file mode 100644 index 000000000..823a19cac --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-dev @@ -0,0 +1,5 @@ +------ fs: + +target: /mnt/mountpoint3 +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-dev2label b/tests/expected/libmount/tabfiles-tags-py-fstab-dev2label new file mode 100644 index 000000000..78d04a4be --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-dev2label @@ -0,0 +1,5 @@ +------ fs: +source: LABEL=testLibmount +target: /mnt/mountpoint +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-label b/tests/expected/libmount/tabfiles-tags-py-fstab-label new file mode 100644 index 000000000..78d04a4be --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-label @@ -0,0 +1,5 @@ +------ fs: +source: LABEL=testLibmount +target: /mnt/mountpoint +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-label2dev b/tests/expected/libmount/tabfiles-tags-py-fstab-label2dev new file mode 100644 index 000000000..78d04a4be --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-label2dev @@ -0,0 +1,5 @@ +------ fs: +source: LABEL=testLibmount +target: /mnt/mountpoint +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-label2uuid b/tests/expected/libmount/tabfiles-tags-py-fstab-label2uuid new file mode 100644 index 000000000..78d04a4be --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-label2uuid @@ -0,0 +1,5 @@ +------ fs: +source: LABEL=testLibmount +target: /mnt/mountpoint +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/tabfiles-tags-py-fstab-uuid b/tests/expected/libmount/tabfiles-tags-py-fstab-uuid new file mode 100644 index 000000000..67d4e7ba3 --- /dev/null +++ b/tests/expected/libmount/tabfiles-tags-py-fstab-uuid @@ -0,0 +1,5 @@ +------ fs: +source: UUID=de1bc6e9-34ab-4151-a1d7-900042eee8d9 +target: /mnt/mountpoint2 +fstype: auto +optstr: defaults diff --git a/tests/expected/libmount/update-py-fstab-replace b/tests/expected/libmount/update-py-fstab-replace new file mode 100644 index 000000000..dc8d1dfbc --- /dev/null +++ b/tests/expected/libmount/update-py-fstab-replace @@ -0,0 +1,24 @@ +# + # this is a leading comment +# + +# this comments belongs to the first fs +UUID=d3a8f783-df75-4dc8-9163-975a891052c0 / ext3 noatime,defaults 1 1 +UUID=fef7ccb3-821c-4de8-88dc-71472be5946f /boot ext3 noatime,defaults 1 2 + +# 3rd fs comment + newline padding + +UUID=1f2aa318-9c34-462e-8d29-260819ffd657 swap swap defaults 0 0 +tmpfs /dev/shm tmpfs defaults 0 0 +devpts /dev/pts devpts gid=5,mode=620 0 0 +sysfs /sys sysfs defaults 0 0 +proc /proc proc defaults 0 0 +# this is comment +/dev/mapper/foo /home/foo ext4 noatime,defaults 0 0 +foo.com:/mnt/share /mnt/remote nfs noauto 0 0 +//bar.com/gogogo /mnt/gogogo cifs user=SRGROUP/baby,noauto 0 0 +/dev/foo /any/foo/ auto defaults 0 0 +# this is new filesystem +LABEL=foo /mnt/foo none rw 0 0 + +#this is a trailing comment diff --git a/tests/ts/libmount/context-py b/tests/ts/libmount/context-py new file mode 100755 index 000000000..20f56ec31 --- /dev/null +++ b/tests/ts/libmount/context-py @@ -0,0 +1,145 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> + +TS_TOPDIR="$(dirname $0)/../.." +export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" +export PYTHONPATH="$TS_TOPDIR/../libmount/python:$TS_TOPDIR/../.libs" +TS_DESC="context-py" +PYDBG="python -m pdb" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT" +LABEL=libmount-test +UUID=$(uuidgen) +MOUNTPOINT="$TS_MOUNTPOINT" +TS_NOEXIST="$TS_OUTDIR/${TS_TESTNAME}-${TS_SUBNAME}-noex" +[ -d $TS_NOEXIST ] && rmdir $TS_NOEXIST + +[ -x $TESTPROG ] || ts_skip "test not compiled" + +ts_log "Init device" +umount $MOUNTPOINT &> /dev/null + +DEVICE=$(ts_scsi_debug_init dev_size_mb=100) +DEVNAME=$(basename $DEVICE) + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF +n +p +1 + + +w +q +EOF + +DEVICE="${DEVICE}1" + +sleep 1 +udevadm settle + +grep -q $DEVNAME /proc/partitions +if [ $? -ne 0 ]; then + rmmod scsi_debug + ts_skip "no partition!" +fi + +ts_log "Create filesystem" +mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null + +ts_log "Do tests..." + +export LIBMOUNT_MTAB=$TS_OUTPUT.mtab +> $LIBMOUNT_MTAB + +udevadm settle +ts_device_has "TYPE" "ext4" $DEVICE || ts_die "Cannot find ext3 on $DEVICE" $DEVICE + +ts_init_subtest "mount-by-devname" +mkdir -p $MOUNTPOINT &> /dev/null +$TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1 + +grep -q $DEVICE $LIBMOUNT_MTAB || \ + echo "(by device) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "umount-by-devname" +$TESTPROG --umount $DEVICE >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB && + echo "umount (device) failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "mount-by-label" +mkdir -p $MOUNTPOINT &> /dev/null +$TESTPROG --mount LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB || \ + echo "(by label) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "umount-by-mountpoint" +$TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB && \ + echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "mount-by-uuid" +mkdir -p $MOUNTPOINT &> /dev/null +$TESTPROG --mount UUID="$UUID" $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB || \ + echo "(by uuid) cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +$TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB && + echo "umount failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "mount-flags" +mkdir -p $MOUNTPOINT &> /dev/null +$TESTPROG --mount -o ro,noexec,nosuid,strictatime $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1 +$TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB || \ + echo "cannot find $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 + +$TESTPROG --mount -o remount,rw $MOUNTPOINT >> $TS_OUTPUT 2>&1 +$TS_CMD_FINDMNT --kernel $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>&1 + +$TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_MTAB && + echo "umount failed: found $DEVICE in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "mount-loopdev" +mkdir -p $MOUNTPOINT &> /dev/null +img=$(ts_image_init) +mkfs.ext3 -F $img &> /dev/null +udevadm settle + +$TESTPROG --mount -o loop $img $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $MOUNTPOINT $LIBMOUNT_MTAB || \ + echo "(loopdev) cannot find $MOUNTPOINT in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +udevadm settle +$TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $MOUNTPOINT $LIBMOUNT_MTAB && + echo "umount failed: found $MOUNTPOINT in $LIBMOUNT_MTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +ts_init_subtest "x-mount.mkdir" +$TS_CMD_MOUNT -o x-mount.mkdir --bind $MOUNTPOINT $TS_NOEXIST >> $TS_OUTPUT 2>&1 && + echo "successfully mounted" >> $TS_OUTPUT +ts_finalize_subtest + +$TS_CMD_UMOUNT $TS_NOEXIST +rmdir $TS_NOEXIST + +ts_log "...done." +rmmod scsi_debug +ts_finalize diff --git a/tests/ts/libmount/context-utab-py b/tests/ts/libmount/context-utab-py new file mode 100755 index 000000000..2b0d21d0c --- /dev/null +++ b/tests/ts/libmount/context-utab-py @@ -0,0 +1,120 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> +TS_TOPDIR="$(dirname $0)/../.." +export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" +export PYTHONPATH="$TS_TOPDIR/../libmount/python:$TS_TOPDIR/../.libs" +TS_DESC="context-py (utab)" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +TESTPROG="$TS_HELPER_PYLIBMOUNT_CONTEXT" +LABEL=libmount-test +UUID=$(uuidgen) +MOUNTPOINT="$TS_MOUNTPOINT" + +[ -x $TESTPROG ] || ts_skip "test not compiled" + +DEVICE=$(ts_scsi_debug_init dev_size_mb=100) +DEVNAME=$(basename $DEVICE) + +ts_log "Create partitions" +$TS_CMD_FDISK ${DEVICE} &> /dev/null <<EOF +n +p +1 + + +w +q +EOF + +DEVICE="${DEVICE}1" + +sleep 1 +udevadm settle + +grep -q $DEVNAME /proc/partitions +if [ $? -ne 0 ]; then + rmmod scsi_debug + ts_skip "no partition!" +fi + +ts_log "Create filesystem" +mkfs.ext4 -L "$LABEL" -U "$UUID" $DEVICE &> /dev/null + +ts_log "Do tests..." + +export LIBMOUNT_MTAB=$TS_OUTPUT.mtab +rm -f $LIBMOUNT_MTAB +ln -s /proc/mounts $LIBMOUNT_MTAB + +export LIBMOUNT_UTAB=$TS_OUTPUT.utab +rm -f $LIBMOUNT_UTAB +> $LIBMOUNT_UTAB + +udevadm settle + +ts_init_subtest "mount-by-devname" +mkdir -p $MOUNTPOINT &> /dev/null +ts_valgrind $TESTPROG --mount $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE /proc/mounts || \ + echo "(by device) cannot find $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "umount-by-devname" +ts_valgrind $TESTPROG --umount $DEVICE >> $TS_OUTPUT 2>&1 +grep -q $DEVICE /proc/mounts && + echo "umount (device) failed: found $DEVICE in /proc/mounts" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "mount-uhelper" +mkdir -p $MOUNTPOINT &> /dev/null +ts_valgrind $TESTPROG --mount -o uhelper=foo,rw LABEL="$LABEL" $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_UTAB || \ + echo "(by label) cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + + +ts_init_subtest "umount" +ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 +grep -q $DEVICE $LIBMOUNT_UTAB && \ + echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1 +ts_finalize_subtest + +if [ -x "/sbin/mkfs.btrfs" ]; then + ts_log "Create filesystem [btrfs]" + /sbin/mkfs.btrfs -L "$LABEL" $DEVICE &> /dev/null + udevadm settle + + mount -t btrfs $DEVICE $MOUNTPOINT &> /dev/null + /sbin/btrfsctl -S sub $MOUNTPOINT &> /dev/null + umount $MOUNTPOINT &> /dev/null + + udevadm settle + + ts_init_subtest "mount-uhelper-subvol" + mkdir -p $MOUNTPOINT &> /dev/null + ts_valgrind $TESTPROG --mount -o uhelper=foo,rw,subvol=sub $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>&1 + grep -q $DEVICE $LIBMOUNT_UTAB || \ + echo "cannot find $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1 + ts_finalize_subtest + + ts_log "All mount options (btrfs subvolume + utab) ---" + $TS_CMD_FINDMNT --mtab $MOUNTPOINT -o OPTIONS -n >> $TS_OUTPUT 2>&1 + ts_log "---" + + ts_init_subtest "umount-subvol" + ts_valgrind $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>&1 + grep -q $DEVICE $LIBMOUNT_UTAB && \ + echo "umount (mountpoint) failed: found $DEVICE in $LIBMOUNT_UTAB" >> $TS_OUTPUT 2>&1 + ts_finalize_subtest +fi + +ts_log "...done." +rmmod scsi_debug +ts_finalize diff --git a/tests/ts/libmount/tabfiles-py b/tests/ts/libmount/tabfiles-py new file mode 100755 index 000000000..86e7766ba --- /dev/null +++ b/tests/ts/libmount/tabfiles-py @@ -0,0 +1,73 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> + +TS_TOPDIR="$(dirname $0)/../.." +export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" +export PYTHONPATH="$TS_TOPDIR/../libmount/python:$TS_TOPDIR/../.libs" +TS_DESC="tab files-py" +PYDBG="python -m pdb" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB" + +[ -x $TESTPROG ] || ts_skip "test not compiled" + +ts_init_subtest "parse-fstab" +$TESTPROG --parse "$TS_SELF/files/fstab" &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "parse-fstab-full" +ts_valgrind $TESTPROG --parse "$TS_SELF/files/fstab.comment" --comments &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "parse-mtab" +ts_valgrind $TESTPROG --parse "$TS_SELF/files/mtab" &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "parse-fstab-broken" +ts_valgrind $TESTPROG --parse "$TS_SELF/files/fstab.broken" &> $TS_OUTPUT +sed -i -e 's/.*fstab.broken:[[:digit:]]*: parse error//g; s/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "parse-mountinfo" +ts_valgrind $TESTPROG --parse "$TS_SELF/files/mountinfo" &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "copy" +ts_valgrind $TESTPROG --copy-fs "$TS_SELF/files/fstab" &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "find-source" +ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" source UUID=fef7ccb3-821c-4de8-88dc-71472be5946f &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "find-target" +ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /home/foo &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "find-target2" +ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /any/foo &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "find-target3" +ts_valgrind $TESTPROG --find-forward "$TS_SELF/files/fstab" target /any/foo/ &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_init_subtest "find-pair" +ts_valgrind $TESTPROG --find-pair "$TS_SELF/files/mtab" /dev/mapper/kzak-home /home/kzak &> $TS_OUTPUT +sed -i -e 's/fs: 0x.*/fs:/g' $TS_OUTPUT +ts_finalize_subtest + +ts_finalize diff --git a/tests/ts/libmount/tabfiles-tags-py b/tests/ts/libmount/tabfiles-tags-py new file mode 100755 index 000000000..65d832541 --- /dev/null +++ b/tests/ts/libmount/tabfiles-tags-py @@ -0,0 +1,84 @@ +#!/bin/bash + +TS_TOPDIR="$(dirname $0)/../.." +export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" +export PYTHONPATH="$TS_TOPDIR/../libmount/python:$TS_TOPDIR/../.libs" +TS_DESC="tags-py" +PYDBG="python -m pdb" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +TESTPROG="$TS_HELPER_PYLIBMOUNT_TAB" + +[ -x $TESTPROG ] || ts_skip "test not compiled" + +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" +ts_valgrind $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" +ts_valgrind $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 +ts_valgrind $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 +ts_valgrind $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 +ts_valgrind $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 +ts_valgrind $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 diff --git a/tests/ts/libmount/update-py b/tests/ts/libmount/update-py new file mode 100755 index 000000000..2f867a23c --- /dev/null +++ b/tests/ts/libmount/update-py @@ -0,0 +1,30 @@ +#!/bin/bash + +# Copyright (C) 2010 Karel Zak <kzak@redhat.com> + +TS_TOPDIR="$(dirname $0)/../.." +export LD_LIBRARY_PATH="$TS_TOPDIR/../.libs" +export PYTHONPATH="$TS_TOPDIR/../libmount/python:$TS_TOPDIR/../.libs" +TS_DESC="tab update-py" + +. $TS_TOPDIR/functions.sh +ts_init "$*" +ts_skip_nonroot + +TESTPROG="$TS_HELPER_PYLIBMOUNT_UPDATE" + +[ -x $TESTPROG ] || ts_skip "test not compiled" + +# +# fstab - replace +# +export LIBMOUNT_FSTAB=$TS_OUTPUT.fstab +rm -f $LIBMOUNT_FSTAB +cp "$TS_SELF/files/fstab.comment" $LIBMOUNT_FSTAB + +ts_init_subtest "fstab-replace" +$TESTPROG --replace "LABEL=foo" "/mnt/foo" +cp $LIBMOUNT_FSTAB $TS_OUTPUT # save the fstab aside +ts_finalize_subtest #checks the fstab + +ts_finalize |