pylibmount: add regression tests
Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
3246f4b98c
commit
90eb39874f
44 changed files with 1616 additions and 0 deletions
|
@ -21,6 +21,8 @@ pylibmount_la_CFLAGS = \
|
||||||
pylibmount_la_LDFLAGS = \
|
pylibmount_la_LDFLAGS = \
|
||||||
-avoid-version -module -shared -export-dynamic
|
-avoid-version -module -shared -export-dynamic
|
||||||
|
|
||||||
|
EXTRA_DIST += libmount/python/libmount/__init__.py
|
||||||
|
|
||||||
CLEANFILES += *.img
|
CLEANFILES += *.img
|
||||||
|
|
||||||
endif # BUILD_PYLIBMOUNT
|
endif # BUILD_PYLIBMOUNT
|
||||||
|
|
172
libmount/python/test_mount_context.py
Executable file
172
libmount/python/test_mount_context.py
Executable file
|
@ -0,0 +1,172 @@
|
||||||
|
#!/bin/python2
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import stat
|
||||||
|
import errno
|
||||||
|
import libmount as mnt
|
||||||
|
|
||||||
|
def usage(tss):
|
||||||
|
print "\nUsage:\n\t{:s} <test> [testoptions]\nTests:\n".format(sys.argv[0])
|
||||||
|
for i in tss:
|
||||||
|
print "\t{15:-s}".format(i[0])
|
||||||
|
if i[2] != "":
|
||||||
|
print " {:s}\n".format(i[2])
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def mnt_run_test(tss, argv):
|
||||||
|
rc = -1
|
||||||
|
if ((len(argv) < 2) or (argv[1] == "--help") or (argv[1] == "-h")):
|
||||||
|
return usage(tss)
|
||||||
|
|
||||||
|
#mnt_init_debug(0)
|
||||||
|
|
||||||
|
i=()
|
||||||
|
for i in tss:
|
||||||
|
if i[0] == argv[1]:
|
||||||
|
rc = i[1](i, argv[1:])
|
||||||
|
if rc:
|
||||||
|
print "FAILED [rc={:d}]".format(rc)
|
||||||
|
break
|
||||||
|
|
||||||
|
if ((rc < 0) and (i == ())):
|
||||||
|
return usage(tss)
|
||||||
|
return not not rc #because !!rc is too mainstream for python
|
||||||
|
|
||||||
|
def test_mount(ts, argv):
|
||||||
|
idx = 1
|
||||||
|
rc = 0
|
||||||
|
|
||||||
|
if len(argv) < 2:
|
||||||
|
return -errno.EINVAL
|
||||||
|
|
||||||
|
cxt = mnt.Cxt()
|
||||||
|
|
||||||
|
if argv[idx] == "-o":
|
||||||
|
cxt.options = argv[idx+1]
|
||||||
|
idx += 2
|
||||||
|
if argv[idx] == "-t":
|
||||||
|
cxt.fstype = argv[idx+1]
|
||||||
|
idx += 2
|
||||||
|
if len(argv) == idx + 1:
|
||||||
|
cxt.target = argv[idx]
|
||||||
|
idx+=1
|
||||||
|
elif (len(argv) == idx + 2):
|
||||||
|
cxt.source = argv[idx]
|
||||||
|
idx += 1
|
||||||
|
cxt.target = argv[idx]
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
cxt.mount()
|
||||||
|
except Exception:
|
||||||
|
print "failed to mount"
|
||||||
|
return -1
|
||||||
|
print "successfully mounted"
|
||||||
|
return rc
|
||||||
|
|
||||||
|
def test_umount(ts, argv):
|
||||||
|
idx = 1
|
||||||
|
rc = 0
|
||||||
|
if len(argv) < 2:
|
||||||
|
return -errno.EINVAL
|
||||||
|
|
||||||
|
cxt = mnt.Cxt()
|
||||||
|
|
||||||
|
if argv[idx] == "-t":
|
||||||
|
cxt.options = argv[idx+1]
|
||||||
|
idx += 2
|
||||||
|
|
||||||
|
if argv[idx] == "-f":
|
||||||
|
cxt.enable_force(True)
|
||||||
|
|
||||||
|
if argv[idx] == "-l":
|
||||||
|
cxt.enable_lazy(True)
|
||||||
|
idx += 1
|
||||||
|
elif argv[idx] == "-r":
|
||||||
|
cxt.enable_rdonly_umount(True)
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
if len(argv) == idx + 1:
|
||||||
|
cxt.target = argv[idx]
|
||||||
|
idx += 1
|
||||||
|
else:
|
||||||
|
return -errno.EINVAL
|
||||||
|
try:
|
||||||
|
cxt.umount()
|
||||||
|
except Exception:
|
||||||
|
print "failed to umount"
|
||||||
|
return 1
|
||||||
|
print "successfully umounted"
|
||||||
|
return rc
|
||||||
|
|
||||||
|
def test_flags(ts, argv):
|
||||||
|
idx = 1
|
||||||
|
rc = 0
|
||||||
|
opt = ""
|
||||||
|
flags = 0
|
||||||
|
cxt = mnt.Cxt()
|
||||||
|
|
||||||
|
if argv[idx] == "-o":
|
||||||
|
cxt.options = argv[idx + 1]
|
||||||
|
idx += 2
|
||||||
|
if len(argv) == idx + 1:
|
||||||
|
cxt.target = argv[idx]
|
||||||
|
idx += 1
|
||||||
|
|
||||||
|
try:
|
||||||
|
cxt.prepare_mount()
|
||||||
|
# catch ioerror here
|
||||||
|
except IOError as e:
|
||||||
|
print "failed to prepare mount {:s}".format(e.strerror)
|
||||||
|
|
||||||
|
opt = cxt.fs.options
|
||||||
|
if (opt):
|
||||||
|
print "options: {:s}", opt
|
||||||
|
|
||||||
|
print "flags: {08:lx}".format(cxt.mflags())
|
||||||
|
return rc
|
||||||
|
|
||||||
|
def test_mountall(ts, argv):
|
||||||
|
mntrc = 1
|
||||||
|
ignored = 1
|
||||||
|
idx = 1
|
||||||
|
cxt = mnt.Cxt()
|
||||||
|
|
||||||
|
if len(argv) > 2:
|
||||||
|
if argv[idx] == "-O":
|
||||||
|
cxt.options_pattern = argv[idx+1]
|
||||||
|
idx += 2
|
||||||
|
if argv[idx] == "-t":
|
||||||
|
cxt.fstype_pattern = argv[idx+1]
|
||||||
|
idx += 2
|
||||||
|
|
||||||
|
i = ()
|
||||||
|
while (cxt.next_mount()):
|
||||||
|
tgt = i.target
|
||||||
|
if (ignored == 1):
|
||||||
|
print "{:s}: ignored: not match".format(tgt)
|
||||||
|
elif (ignored == 2):
|
||||||
|
print "{:s}: ignored: already mounted".format(tgt)
|
||||||
|
elif (not cxt.status):
|
||||||
|
if (mntrc > 0):
|
||||||
|
# ?? errno = mntrc
|
||||||
|
print "{:s}: mount failed".format(tgt)
|
||||||
|
else:
|
||||||
|
print "{:s}: mount failed".format(tgt)
|
||||||
|
else:
|
||||||
|
print "{:s}: successfully mounted".format(tgt)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
tss = (
|
||||||
|
( "--mount", test_mount, "[-o <opts>] [-t <type>] <spec>|<src> <target>" ),
|
||||||
|
( "--umount", test_umount, "[-t <type>] [-f][-l][-r] <src>|<target>" ),
|
||||||
|
( "--mount-all", test_mountall, "[-O <pattern>] [-t <pattern] mount all filesystems from fstab" ),
|
||||||
|
( "--flags", test_flags, "[-o <opts>] <spec>" )
|
||||||
|
)
|
||||||
|
os.umask(stat.S_IWGRP | stat.S_IWOTH) #to be compatible with mount(8)
|
||||||
|
|
||||||
|
sys.exit(mnt_run_test(tss, sys.argv))
|
162
libmount/python/test_mount_tab.py
Executable file
162
libmount/python/test_mount_tab.py
Executable file
|
@ -0,0 +1,162 @@
|
||||||
|
#!/bin/python2
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import stat
|
||||||
|
import errno
|
||||||
|
import functools as ft
|
||||||
|
import libmount as mnt
|
||||||
|
|
||||||
|
def usage(tss):
|
||||||
|
print "\nUsage:\n\t{:s} <test> [testoptions]\nTests:\n".format(sys.argv[0])
|
||||||
|
for i in tss:
|
||||||
|
print "\t{15:-s}".format(i[0])
|
||||||
|
if i[2] != "":
|
||||||
|
print " {:s}\n".format(i[2])
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def mnt_run_test(tss, argv):
|
||||||
|
rc = -1
|
||||||
|
if ((len(argv) < 2) or (argv[1] == "--help") or (argv[1] == "-h")):
|
||||||
|
return usage(tss)
|
||||||
|
|
||||||
|
#mnt_init_debug(0)
|
||||||
|
|
||||||
|
i=()
|
||||||
|
for i in tss:
|
||||||
|
if i[0] == argv[1]:
|
||||||
|
rc = i[1](i, argv[1:])
|
||||||
|
if rc:
|
||||||
|
print "FAILED [rc={:d}]".format(rc)
|
||||||
|
break
|
||||||
|
|
||||||
|
if ((rc < 0) and (i == ())):
|
||||||
|
return usage(tss)
|
||||||
|
return not not rc #because !!rc is too mainstream for python
|
||||||
|
|
||||||
|
def parser_errcb(tb, fname, line):
|
||||||
|
print "{:s}:{:d}: parse error".format(fname, line)
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def create_table(f, comments):
|
||||||
|
if not f:
|
||||||
|
return None
|
||||||
|
tb = mnt.Tab()
|
||||||
|
tb.enable_comments(comments)
|
||||||
|
tb.errcb = parser_errcb
|
||||||
|
|
||||||
|
try:
|
||||||
|
tb.parse_file(f)
|
||||||
|
except Exception:
|
||||||
|
print "{:s}: parsing failed".format(f)
|
||||||
|
return None
|
||||||
|
return tb
|
||||||
|
|
||||||
|
def test_copy_fs(ts, argv):
|
||||||
|
rc = -1
|
||||||
|
tb = create_table(argv[1], False)
|
||||||
|
fs = tb.find_target("/", mnt.MNT_ITER_FORWARD)
|
||||||
|
if not fs:
|
||||||
|
return rc
|
||||||
|
|
||||||
|
print "ORIGINAL:"
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
|
||||||
|
fs = fs.copy_fs(None)
|
||||||
|
if not fs:
|
||||||
|
return rc
|
||||||
|
print "COPY:"
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def test_parse(ts, argv):
|
||||||
|
parse_comments = False
|
||||||
|
|
||||||
|
if len(argv) == 3 and argv[2] == "--comments":
|
||||||
|
parse_comments = True
|
||||||
|
tb = create_table(argv[1], parse_comments)
|
||||||
|
|
||||||
|
if tb.intro_comment:
|
||||||
|
print "Initial comment:\n\"{:s}\"".format(tb.intro_comment)
|
||||||
|
#while ((fs = tb.next_fs()) != None):
|
||||||
|
for fs in iter(ft.partial(tb.next_fs), None):
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
if tb.trailing_comment:
|
||||||
|
print "Trailing comment:\n\"{:s}\"".format(tb.trailing_comment)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def test_find(ts, argv, dr):
|
||||||
|
if len(argv) != 4:
|
||||||
|
print "try --help"
|
||||||
|
return -errno.EINVAL
|
||||||
|
|
||||||
|
f, find, what = argv[1:]
|
||||||
|
|
||||||
|
tb = create_table(f, False)
|
||||||
|
if find.lower() == "source":
|
||||||
|
fs = tb.find_source(what, dr)
|
||||||
|
elif find.lower() == "target":
|
||||||
|
fs = tb.find_target(what, dr)
|
||||||
|
|
||||||
|
if not fs:
|
||||||
|
print "{:s}: not found {:s} '{:s}'".format(f, find, what)
|
||||||
|
else:
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def test_find_fw(ts, argv):
|
||||||
|
return test_find(ts, argv, mnt.MNT_ITER_FORWARD)
|
||||||
|
|
||||||
|
def test_find_bw(ts, argv):
|
||||||
|
return test_find(ts, argv, mnt.MNT_ITER_BACKWARD)
|
||||||
|
|
||||||
|
def test_find_pair(ts, argv):
|
||||||
|
rc = -1
|
||||||
|
tb = create_table(argv[1], False)
|
||||||
|
fs = tb.find_pair(argv[2], argv[3], mnt.MNT_ITER_FORWARD)
|
||||||
|
if not fs:
|
||||||
|
return rc
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def test_is_mounted(ts, argv):
|
||||||
|
rc = -1
|
||||||
|
tb = mnt.Tab(path="/proc/self/mountinfo")
|
||||||
|
if not tb:
|
||||||
|
print "failed to parse mountinto"
|
||||||
|
return rc
|
||||||
|
|
||||||
|
fstab = create_table(argv[1], False)
|
||||||
|
if not fstab:
|
||||||
|
return rc
|
||||||
|
fs = ()
|
||||||
|
for fs in ft.iter(tb.next_fs(), -1):
|
||||||
|
if tb.is_fs_mounted(fs):
|
||||||
|
print "{:s} already mounted on {:s}".format(fs.source, fs.target)
|
||||||
|
else:
|
||||||
|
print "{:s} not mounted on {:s}".format(fs.source, fs.target)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
def test_find_mountpoint(ts, argv):
|
||||||
|
rc = -1
|
||||||
|
tb = mnt.Tab("/proc/self/mountinfo")
|
||||||
|
if not tb:
|
||||||
|
return rc
|
||||||
|
fs = tb.find_mountpoint(argv[1], mnt.MNT_ITER_BACKWARD)
|
||||||
|
if not fs:
|
||||||
|
return rc
|
||||||
|
fs.print_debug(sys.stdout)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
tss = (
|
||||||
|
( "--parse", test_parse, "<file> [--comments] parse and print tab" ),
|
||||||
|
( "--find-forward", test_find_fw, "<file> <source|target> <string>" ),
|
||||||
|
( "--find-backward", test_find_bw, "<file> <source|target> <string>" ),
|
||||||
|
( "--find-pair", test_find_pair, "<file> <source> <target>" ),
|
||||||
|
( "--find-mountpoint", test_find_mountpoint, "<path>" ),
|
||||||
|
( "--copy-fs", test_copy_fs, "<file> copy root FS from the file" ),
|
||||||
|
( "--is-mounted", test_is_mounted, "<fstab> check what from <file> are already mounted" ),
|
||||||
|
)
|
||||||
|
sys.exit(mnt_run_test(tss, sys.argv))
|
58
libmount/python/test_mount_tab_update.py
Executable file
58
libmount/python/test_mount_tab_update.py
Executable file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/python2
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import stat
|
||||||
|
import errno
|
||||||
|
import libmount as mnt
|
||||||
|
|
||||||
|
def usage(tss):
|
||||||
|
print "\nUsage:\n\t{:s} <test> [testoptions]\nTests:\n".format(sys.argv[0])
|
||||||
|
for i in tss:
|
||||||
|
print "\t{15:-s}".format(i[0])
|
||||||
|
if i[2] != "":
|
||||||
|
print " {:s}\n".format(i[2])
|
||||||
|
|
||||||
|
print("\n")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def mnt_run_test(tss, argv):
|
||||||
|
rc = -1
|
||||||
|
if ((len(argv) < 2) or (argv[1] == "--help") or (argv[1] == "-h")):
|
||||||
|
return usage(tss)
|
||||||
|
|
||||||
|
#mnt_init_debug(0)
|
||||||
|
|
||||||
|
i=()
|
||||||
|
for i in tss:
|
||||||
|
if i[0] == argv[1]:
|
||||||
|
rc = i[1](i, argv[1:])
|
||||||
|
if rc:
|
||||||
|
print "FAILED [rc={:d}]".format(rc)
|
||||||
|
break
|
||||||
|
|
||||||
|
if ((rc < 0) and (i == ())):
|
||||||
|
return usage(tss)
|
||||||
|
return not not rc #because !!rc is too mainstream for python
|
||||||
|
|
||||||
|
def test_replace(ts, argv):
|
||||||
|
fs = mnt.Fs()
|
||||||
|
tb = mnt.Tab()
|
||||||
|
|
||||||
|
if (len(argv) < 3):
|
||||||
|
return -1
|
||||||
|
tb.enable_comments(True)
|
||||||
|
tb.parse_fstab()
|
||||||
|
|
||||||
|
fs.source = argv[1]
|
||||||
|
fs.target = argv[2]
|
||||||
|
#TODO: resolve None + string
|
||||||
|
fs.comment = "# this is new filesystem\n"
|
||||||
|
tb.add_fs(fs)
|
||||||
|
tb.replace_file(os.environ["LIBMOUNT_FSTAB"])
|
||||||
|
return 0
|
||||||
|
|
||||||
|
tss = (
|
||||||
|
( "--replace",test_replace, "<src> <target> Add a line to LIBMOUNT_FSTAB and replace the original file" ),
|
||||||
|
)
|
||||||
|
|
||||||
|
sys.exit(mnt_run_test(tss, sys.argv))
|
|
@ -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_TAB="$top_builddir/test_mount_tab"
|
||||||
TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update"
|
TS_HELPER_LIBMOUNT_UPDATE="$top_builddir/test_mount_tab_update"
|
||||||
TS_HELPER_LIBMOUNT_UTILS="$top_builddir/test_mount_utils"
|
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_LOGINDEFS="$top_builddir/test_logindefs"
|
||||||
TS_HELPER_MD5="$top_builddir/test_md5"
|
TS_HELPER_MD5="$top_builddir/test_md5"
|
||||||
TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"}
|
TS_HELPER_MORE=${TS_HELPER_MORE-"$top_builddir/test_more"}
|
||||||
|
|
5
tests/expected/libmount/context-py
Normal file
5
tests/expected/libmount/context-py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Init device
|
||||||
|
Create partitions
|
||||||
|
Create filesystem
|
||||||
|
Do tests...
|
||||||
|
...done.
|
1
tests/expected/libmount/context-py-mount-by-devname
Normal file
1
tests/expected/libmount/context-py-mount-by-devname
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
1
tests/expected/libmount/context-py-mount-by-label
Normal file
1
tests/expected/libmount/context-py-mount-by-label
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
2
tests/expected/libmount/context-py-mount-by-uuid
Normal file
2
tests/expected/libmount/context-py-mount-by-uuid
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
successfully mounted
|
||||||
|
successfully umounted
|
5
tests/expected/libmount/context-py-mount-flags
Normal file
5
tests/expected/libmount/context-py-mount-flags
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
successfully mounted
|
||||||
|
ro,nosuid,noexec
|
||||||
|
successfully mounted
|
||||||
|
rw,nosuid,noexec
|
||||||
|
successfully umounted
|
2
tests/expected/libmount/context-py-mount-loopdev
Normal file
2
tests/expected/libmount/context-py-mount-loopdev
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
successfully mounted
|
||||||
|
successfully umounted
|
1
tests/expected/libmount/context-py-umount-by-devname
Normal file
1
tests/expected/libmount/context-py-umount-by-devname
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully umounted
|
1
tests/expected/libmount/context-py-umount-by-mountpoint
Normal file
1
tests/expected/libmount/context-py-umount-by-mountpoint
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully umounted
|
1
tests/expected/libmount/context-py-x-mount.mkdir
Normal file
1
tests/expected/libmount/context-py-x-mount.mkdir
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
9
tests/expected/libmount/context-utab-py
Normal file
9
tests/expected/libmount/context-utab-py
Normal file
|
@ -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.
|
1
tests/expected/libmount/context-utab-py-mount-by-devname
Normal file
1
tests/expected/libmount/context-utab-py-mount-by-devname
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
1
tests/expected/libmount/context-utab-py-mount-uhelper
Normal file
1
tests/expected/libmount/context-utab-py-mount-uhelper
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
|
@ -0,0 +1 @@
|
||||||
|
successfully mounted
|
1
tests/expected/libmount/context-utab-py-umount
Normal file
1
tests/expected/libmount/context-utab-py-umount
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully umounted
|
|
@ -0,0 +1 @@
|
||||||
|
successfully umounted
|
1
tests/expected/libmount/context-utab-py-umount-subvol
Normal file
1
tests/expected/libmount/context-utab-py-umount-subvol
Normal file
|
@ -0,0 +1 @@
|
||||||
|
successfully umounted
|
18
tests/expected/libmount/tabfiles-py-copy
Normal file
18
tests/expected/libmount/tabfiles-py-copy
Normal file
|
@ -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
|
6
tests/expected/libmount/tabfiles-py-find-pair
Normal file
6
tests/expected/libmount/tabfiles-py-find-pair
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
------ fs:
|
||||||
|
source: /dev/mapper/kzak-home
|
||||||
|
target: /home/kzak
|
||||||
|
fstype: ext4
|
||||||
|
optstr: rw,noatime
|
||||||
|
VFS-optstr: rw,noatime
|
8
tests/expected/libmount/tabfiles-py-find-source
Normal file
8
tests/expected/libmount/tabfiles-py-find-source
Normal file
|
@ -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
|
6
tests/expected/libmount/tabfiles-py-find-target
Normal file
6
tests/expected/libmount/tabfiles-py-find-target
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
------ fs:
|
||||||
|
source: /dev/mapper/foo
|
||||||
|
target: /home/foo
|
||||||
|
fstype: ext4
|
||||||
|
optstr: noatime,defaults
|
||||||
|
VFS-optstr: noatime
|
5
tests/expected/libmount/tabfiles-py-find-target2
Normal file
5
tests/expected/libmount/tabfiles-py-find-target2
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: /dev/foo
|
||||||
|
target: /any/foo/
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
5
tests/expected/libmount/tabfiles-py-find-target3
Normal file
5
tests/expected/libmount/tabfiles-py-find-target3
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: /dev/foo
|
||||||
|
target: /any/foo/
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
65
tests/expected/libmount/tabfiles-py-parse-fstab
Normal file
65
tests/expected/libmount/tabfiles-py-parse-fstab
Normal file
|
@ -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
|
63
tests/expected/libmount/tabfiles-py-parse-fstab-broken
Normal file
63
tests/expected/libmount/tabfiles-py-parse-fstab-broken
Normal file
|
@ -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
|
83
tests/expected/libmount/tabfiles-py-parse-fstab-full
Normal file
83
tests/expected/libmount/tabfiles-py-parse-fstab-full
Normal file
|
@ -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
|
||||||
|
"
|
352
tests/expected/libmount/tabfiles-py-parse-mountinfo
Normal file
352
tests/expected/libmount/tabfiles-py-parse-mountinfo
Normal file
|
@ -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
|
68
tests/expected/libmount/tabfiles-py-parse-mtab
Normal file
68
tests/expected/libmount/tabfiles-py-parse-mtab
Normal file
|
@ -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
|
5
tests/expected/libmount/tabfiles-tags-py-fstab-dev
Normal file
5
tests/expected/libmount/tabfiles-tags-py-fstab-dev
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
|
||||||
|
target: /mnt/mountpoint3
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
5
tests/expected/libmount/tabfiles-tags-py-fstab-dev2label
Normal file
5
tests/expected/libmount/tabfiles-tags-py-fstab-dev2label
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: LABEL=testLibmount
|
||||||
|
target: /mnt/mountpoint
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
5
tests/expected/libmount/tabfiles-tags-py-fstab-label
Normal file
5
tests/expected/libmount/tabfiles-tags-py-fstab-label
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: LABEL=testLibmount
|
||||||
|
target: /mnt/mountpoint
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
5
tests/expected/libmount/tabfiles-tags-py-fstab-label2dev
Normal file
5
tests/expected/libmount/tabfiles-tags-py-fstab-label2dev
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: LABEL=testLibmount
|
||||||
|
target: /mnt/mountpoint
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: LABEL=testLibmount
|
||||||
|
target: /mnt/mountpoint
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
5
tests/expected/libmount/tabfiles-tags-py-fstab-uuid
Normal file
5
tests/expected/libmount/tabfiles-tags-py-fstab-uuid
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
------ fs:
|
||||||
|
source: UUID=de1bc6e9-34ab-4151-a1d7-900042eee8d9
|
||||||
|
target: /mnt/mountpoint2
|
||||||
|
fstype: auto
|
||||||
|
optstr: defaults
|
24
tests/expected/libmount/update-py-fstab-replace
Normal file
24
tests/expected/libmount/update-py-fstab-replace
Normal file
|
@ -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
|
145
tests/ts/libmount/context-py
Executable file
145
tests/ts/libmount/context-py
Executable file
|
@ -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
|
120
tests/ts/libmount/context-utab-py
Executable file
120
tests/ts/libmount/context-utab-py
Executable file
|
@ -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
|
73
tests/ts/libmount/tabfiles-py
Executable file
73
tests/ts/libmount/tabfiles-py
Executable file
|
@ -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
|
84
tests/ts/libmount/tabfiles-tags-py
Executable file
84
tests/ts/libmount/tabfiles-tags-py
Executable file
|
@ -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
|
30
tests/ts/libmount/update-py
Executable file
30
tests/ts/libmount/update-py
Executable file
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue