tests: add libmount utils.c tests

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2010-10-19 11:44:30 +02:00
parent 9208fc2292
commit f27feed36e
21 changed files with 100 additions and 5 deletions

View File

@ -16,8 +16,9 @@ TS_HELPER_STRTOSIZE="$top_builddir/lib/test_strtosize"
TS_HELPER_CPUSET="$top_builddir/lib/test_cpuset"
# libmount
TS_HELPER_OPTSTR="$top_builddir/shlibs/mount/src/test_optstr"
TS_HELPER_TABFILES="$top_builddir/shlibs/mount/src/test_tab"
TS_HELPER_LIBMOUNT_OPTSTR="$top_builddir/shlibs/mount/src/test_optstr"
TS_HELPER_LIBMOUNT_TAB="$top_builddir/shlibs/mount/src/test_tab"
TS_HELPER_LIBMOUNT_UTILS="$top_builddir/shlibs/mount/src/test_utils"
# TODO: use partx
TS_HELPER_PARTITIONS="$top_builddir/shlibs/blkid/samples/partitions"

View File

@ -0,0 +1 @@
YES

View File

@ -0,0 +1 @@
/proc: /

View File

@ -0,0 +1 @@
/proc/sys/kernel: /sys/kernel

View File

@ -0,0 +1 @@
/etc: /etc

View File

@ -0,0 +1 @@
MATCH

View File

@ -0,0 +1 @@
NOT-MATCH

View File

@ -0,0 +1 @@
NOT-MATCH

View File

@ -0,0 +1 @@
MATCH

View File

@ -0,0 +1 @@
MATCH

View File

@ -0,0 +1 @@
MATCH

View File

@ -0,0 +1 @@
NOT-MATCH

View File

@ -0,0 +1 @@
MATCH

View File

@ -0,0 +1 @@
/proc: /proc

View File

@ -0,0 +1 @@
/: /

View File

@ -0,0 +1 @@
/proc/sys/kernel: /proc

View File

@ -0,0 +1 @@
YES

View File

@ -8,7 +8,7 @@ TS_DESC="options string"
. $TS_TOPDIR/functions.sh
ts_init "$*"
TESTPROG="$TS_HELPER_OPTSTR"
TESTPROG="$TS_HELPER_LIBMOUNT_OPTSTR"
ts_init_subtest "append"
$TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT

View File

@ -8,7 +8,7 @@ TS_DESC="tab files"
. $TS_TOPDIR/functions.sh
ts_init "$*"
TESTPROG="$TS_HELPER_TABFILES"
TESTPROG="$TS_HELPER_LIBMOUNT_TAB"
ts_init_subtest "parse-fstab"
$TESTPROG --parse "$TS_SELF/files/fstab" &> $TS_OUTPUT

View File

@ -7,6 +7,8 @@ TS_DESC="tags"
ts_init "$*"
ts_skip_nonroot
TESTPROG="$TS_HELPER_LIBMOUNT_TAB"
#
# Init device
#
@ -32,7 +34,6 @@ UUID="de1bc6e9-34ab-4151-a1d7-900042eee8d9"
mkfs.ext3 -F -L $LABEL $DEVICE -U $UUID &> /dev/null || ts_die "Cannot make ext3 on $DEVICE" $DEVICE
ts_device_has_uuid $DEVICE || ts_die "Cannot found UUID on $DEVICE" $DEVICE
TESTPROG="$TS_HELPER_TABFILES"
FSTAB="$TS_OUTDIR/fstab"
#

77
tests/ts/libmount/utils Executable file
View File

@ -0,0 +1,77 @@
#!/bin/bash
# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
TS_TOPDIR="$(dirname $0)/../.."
TS_DESC="utils"
. $TS_TOPDIR/functions.sh
ts_init "$*"
TESTPROG="$TS_HELPER_LIBMOUNT_UTILS"
ts_init_subtest "match-fstype"
$TESTPROG --match-fstype ext3 "ext2,ext3,cifs" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-fstype-neg"
$TESTPROG --match-fstype cifs "ext2,ext3,nocifs" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-fstype-neg2"
$TESTPROG --match-fstype cifs "noext2,ext3,cifs" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-options"
$TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ccc" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-options-list"
$TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ccc,aaa,ddd" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-options-neg"
$TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "noxxx" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-options-neg-list"
$TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "ddd,noaaa" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "match-options-neg-list2"
$TESTPROG --match-options "aaa,bbb=BBB,ccc,ddd" "noxxx,ccc,aaa" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "starts-with"
$TESTPROG --starts-with "AAAbbbCCC" "AAA" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "ends-with"
$TESTPROG --ends-with "AAAbbbCCC" "CCC" &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "mountpoint"
$TESTPROG --mountpoint /proc &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "mountpoint-subdir"
$TESTPROG --mountpoint /proc/sys/kernel &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "mountpoint-root"
$TESTPROG --mountpoint / &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "fs-root"
$TESTPROG --fs-root /proc &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "fs-root-subdir"
$TESTPROG --fs-root /proc/sys/kernel &> $TS_OUTPUT
ts_finalize_subtest
ts_init_subtest "fs-root-subdir2"
$TESTPROG --fs-root /etc &> $TS_OUTPUT
ts_finalize_subtest
ts_finalize