]> err.no Git - util-linux/commitdiff
tests: add libmount utils.c tests
authorKarel Zak <kzak@redhat.com>
Tue, 19 Oct 2010 09:44:30 +0000 (11:44 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 3 Jan 2011 11:28:45 +0000 (12:28 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
21 files changed:
tests/commands.sh.in
tests/expected/libmount/utils-ends-with [new file with mode: 0644]
tests/expected/libmount/utils-fs-root [new file with mode: 0644]
tests/expected/libmount/utils-fs-root-subdir [new file with mode: 0644]
tests/expected/libmount/utils-fs-root-subdir2 [new file with mode: 0644]
tests/expected/libmount/utils-match-fstype [new file with mode: 0644]
tests/expected/libmount/utils-match-fstype-neg [new file with mode: 0644]
tests/expected/libmount/utils-match-fstype-neg2 [new file with mode: 0644]
tests/expected/libmount/utils-match-options [new file with mode: 0644]
tests/expected/libmount/utils-match-options-list [new file with mode: 0644]
tests/expected/libmount/utils-match-options-neg [new file with mode: 0644]
tests/expected/libmount/utils-match-options-neg-list [new file with mode: 0644]
tests/expected/libmount/utils-match-options-neg-list2 [new file with mode: 0644]
tests/expected/libmount/utils-mountpoint [new file with mode: 0644]
tests/expected/libmount/utils-mountpoint-root [new file with mode: 0644]
tests/expected/libmount/utils-mountpoint-subdir [new file with mode: 0644]
tests/expected/libmount/utils-starts-with [new file with mode: 0644]
tests/ts/libmount/optstr
tests/ts/libmount/tabfiles
tests/ts/libmount/tabfiles-tags
tests/ts/libmount/utils [new file with mode: 0755]

index 94c34e77e12eca23730414f4e2716ce03c8795c3..d5e166bdf7272ece966d4fda2b2b066cc668a376 100644 (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"
diff --git a/tests/expected/libmount/utils-ends-with b/tests/expected/libmount/utils-ends-with
new file mode 100644 (file)
index 0000000..f033a50
--- /dev/null
@@ -0,0 +1 @@
+YES
diff --git a/tests/expected/libmount/utils-fs-root b/tests/expected/libmount/utils-fs-root
new file mode 100644 (file)
index 0000000..7746b28
--- /dev/null
@@ -0,0 +1 @@
+/proc: /
diff --git a/tests/expected/libmount/utils-fs-root-subdir b/tests/expected/libmount/utils-fs-root-subdir
new file mode 100644 (file)
index 0000000..09cdb8d
--- /dev/null
@@ -0,0 +1 @@
+/proc/sys/kernel: /sys/kernel
diff --git a/tests/expected/libmount/utils-fs-root-subdir2 b/tests/expected/libmount/utils-fs-root-subdir2
new file mode 100644 (file)
index 0000000..2e8b89a
--- /dev/null
@@ -0,0 +1 @@
+/etc: /etc
diff --git a/tests/expected/libmount/utils-match-fstype b/tests/expected/libmount/utils-match-fstype
new file mode 100644 (file)
index 0000000..4736e08
--- /dev/null
@@ -0,0 +1 @@
+MATCH
diff --git a/tests/expected/libmount/utils-match-fstype-neg b/tests/expected/libmount/utils-match-fstype-neg
new file mode 100644 (file)
index 0000000..8262239
--- /dev/null
@@ -0,0 +1 @@
+NOT-MATCH
diff --git a/tests/expected/libmount/utils-match-fstype-neg2 b/tests/expected/libmount/utils-match-fstype-neg2
new file mode 100644 (file)
index 0000000..8262239
--- /dev/null
@@ -0,0 +1 @@
+NOT-MATCH
diff --git a/tests/expected/libmount/utils-match-options b/tests/expected/libmount/utils-match-options
new file mode 100644 (file)
index 0000000..4736e08
--- /dev/null
@@ -0,0 +1 @@
+MATCH
diff --git a/tests/expected/libmount/utils-match-options-list b/tests/expected/libmount/utils-match-options-list
new file mode 100644 (file)
index 0000000..4736e08
--- /dev/null
@@ -0,0 +1 @@
+MATCH
diff --git a/tests/expected/libmount/utils-match-options-neg b/tests/expected/libmount/utils-match-options-neg
new file mode 100644 (file)
index 0000000..4736e08
--- /dev/null
@@ -0,0 +1 @@
+MATCH
diff --git a/tests/expected/libmount/utils-match-options-neg-list b/tests/expected/libmount/utils-match-options-neg-list
new file mode 100644 (file)
index 0000000..8262239
--- /dev/null
@@ -0,0 +1 @@
+NOT-MATCH
diff --git a/tests/expected/libmount/utils-match-options-neg-list2 b/tests/expected/libmount/utils-match-options-neg-list2
new file mode 100644 (file)
index 0000000..4736e08
--- /dev/null
@@ -0,0 +1 @@
+MATCH
diff --git a/tests/expected/libmount/utils-mountpoint b/tests/expected/libmount/utils-mountpoint
new file mode 100644 (file)
index 0000000..47fb251
--- /dev/null
@@ -0,0 +1 @@
+/proc: /proc
diff --git a/tests/expected/libmount/utils-mountpoint-root b/tests/expected/libmount/utils-mountpoint-root
new file mode 100644 (file)
index 0000000..c86cf0d
--- /dev/null
@@ -0,0 +1 @@
+/: /
diff --git a/tests/expected/libmount/utils-mountpoint-subdir b/tests/expected/libmount/utils-mountpoint-subdir
new file mode 100644 (file)
index 0000000..f21d31b
--- /dev/null
@@ -0,0 +1 @@
+/proc/sys/kernel: /proc
diff --git a/tests/expected/libmount/utils-starts-with b/tests/expected/libmount/utils-starts-with
new file mode 100644 (file)
index 0000000..f033a50
--- /dev/null
@@ -0,0 +1 @@
+YES
index 1bc8d18c639b0f7d22ecc69034749d037157afdc..11b707d07fcfd79e3bb9cb5679aec99ad2d91810 100755 (executable)
@@ -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
index 3367fab5bbd90bea01df88d674510ef63b0a40bd..2de86807cbd174f41ae3485fccc36d51cf6b3a7a 100755 (executable)
@@ -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
index 2f9f6c45d2b807c928144fe3fca1e5b39b1e3293..da76724bb68f16017ba62088e6e12f51f63e1536 100755 (executable)
@@ -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"
 
 #
diff --git a/tests/ts/libmount/utils b/tests/ts/libmount/utils
new file mode 100755 (executable)
index 0000000..e06c9b9
--- /dev/null
@@ -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