]> err.no Git - util-linux/commitdiff
tests: add libmount optstr.c tests
authorKarel Zak <kzak@redhat.com>
Fri, 15 Oct 2010 13:53:33 +0000 (15:53 +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>
20 files changed:
tests/commands.sh.in
tests/expected/libmount/optstr-append [new file with mode: 0644]
tests/expected/libmount/optstr-append-value [new file with mode: 0644]
tests/expected/libmount/optstr-apply-linux [new file with mode: 0644]
tests/expected/libmount/optstr-apply-user [new file with mode: 0644]
tests/expected/libmount/optstr-fix [new file with mode: 0644]
tests/expected/libmount/optstr-flags [new file with mode: 0644]
tests/expected/libmount/optstr-get [new file with mode: 0644]
tests/expected/libmount/optstr-get-value [new file with mode: 0644]
tests/expected/libmount/optstr-prepend [new file with mode: 0644]
tests/expected/libmount/optstr-prepend-value [new file with mode: 0644]
tests/expected/libmount/optstr-remove [new file with mode: 0644]
tests/expected/libmount/optstr-remove-value [new file with mode: 0644]
tests/expected/libmount/optstr-set-large [new file with mode: 0644]
tests/expected/libmount/optstr-set-new [new file with mode: 0644]
tests/expected/libmount/optstr-set-new-end [new file with mode: 0644]
tests/expected/libmount/optstr-set-remove [new file with mode: 0644]
tests/expected/libmount/optstr-set-small [new file with mode: 0644]
tests/expected/libmount/optstr-split [new file with mode: 0644]
tests/ts/libmount/optstr [new file with mode: 0755]

index d56e1d217686c5e0236f14fd57d4f15359c7c823..a13e00c94161237d66d22825508975eea69ed9d6 100644 (file)
@@ -15,6 +15,8 @@ TS_HELPER_ISMOUNTED="$top_builddir/lib/test_ismounted"
 TS_HELPER_STRTOSIZE="$top_builddir/lib/test_strtosize"
 TS_HELPER_CPUSET="$top_builddir/lib/test_cpuset"
 
+TS_HELPER_OPTSTR="$top_builddir/shlibs/mount/src/test_optstr"
+
 # TODO: use partx
 TS_HELPER_PARTITIONS="$top_builddir/shlibs/blkid/samples/partitions"
 
diff --git a/tests/expected/libmount/optstr-append b/tests/expected/libmount/optstr-append
new file mode 100644 (file)
index 0000000..10933cb
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb=BBB,ccc,ddd<
diff --git a/tests/expected/libmount/optstr-append-value b/tests/expected/libmount/optstr-append-value
new file mode 100644 (file)
index 0000000..e0116f6
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb=BBB,ccc,ddd=DDD<
diff --git a/tests/expected/libmount/optstr-apply-linux b/tests/expected/libmount/optstr-apply-linux
new file mode 100644 (file)
index 0000000..50a52a7
--- /dev/null
@@ -0,0 +1,2 @@
+flags:  0x00000400
+optstr: rw,user=kzak,noatime
diff --git a/tests/expected/libmount/optstr-apply-user b/tests/expected/libmount/optstr-apply-user
new file mode 100644 (file)
index 0000000..2f34732
--- /dev/null
@@ -0,0 +1,2 @@
+flags:  0x00000408
+optstr: noexec,nosuid,user,nofail
diff --git a/tests/expected/libmount/optstr-fix b/tests/expected/libmount/optstr-fix
new file mode 100644 (file)
index 0000000..9eb6817
--- /dev/null
@@ -0,0 +1,2 @@
+optstr: uid=root,gid=root
+fixed:  uid=0,gid=0
diff --git a/tests/expected/libmount/optstr-flags b/tests/expected/libmount/optstr-flags
new file mode 100644 (file)
index 0000000..013e22c
--- /dev/null
@@ -0,0 +1,2 @@
+mountflags:           0x0000000a
+userspace-mountflags: 0x00000208
diff --git a/tests/expected/libmount/optstr-get b/tests/expected/libmount/optstr-get
new file mode 100644 (file)
index 0000000..7eafc65
--- /dev/null
@@ -0,0 +1 @@
+found; name: aaa
diff --git a/tests/expected/libmount/optstr-get-value b/tests/expected/libmount/optstr-get-value
new file mode 100644 (file)
index 0000000..509843f
--- /dev/null
@@ -0,0 +1 @@
+found; name: bbb, argument: size=3 data=BBB
diff --git a/tests/expected/libmount/optstr-prepend b/tests/expected/libmount/optstr-prepend
new file mode 100644 (file)
index 0000000..cdcf751
--- /dev/null
@@ -0,0 +1 @@
+result: >ddd,aaa,bbb=BBB,ccc<
diff --git a/tests/expected/libmount/optstr-prepend-value b/tests/expected/libmount/optstr-prepend-value
new file mode 100644 (file)
index 0000000..debc7ee
--- /dev/null
@@ -0,0 +1 @@
+result: >ddd=DDD,aaa,bbb=BBB,ccc<
diff --git a/tests/expected/libmount/optstr-remove b/tests/expected/libmount/optstr-remove
new file mode 100644 (file)
index 0000000..4c28ed2
--- /dev/null
@@ -0,0 +1 @@
+result: >bbb=BBB,ccc<
diff --git a/tests/expected/libmount/optstr-remove-value b/tests/expected/libmount/optstr-remove-value
new file mode 100644 (file)
index 0000000..eee5c95
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,ccc<
diff --git a/tests/expected/libmount/optstr-set-large b/tests/expected/libmount/optstr-set-large
new file mode 100644 (file)
index 0000000..b518c26
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb=XXX-YYY-ZZZ,ccc<
diff --git a/tests/expected/libmount/optstr-set-new b/tests/expected/libmount/optstr-set-new
new file mode 100644 (file)
index 0000000..5d45b4f
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa=XXX,bbb=BBB,ccc<
diff --git a/tests/expected/libmount/optstr-set-new-end b/tests/expected/libmount/optstr-set-new-end
new file mode 100644 (file)
index 0000000..39675a4
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb=BBB,ccc=XXX<
diff --git a/tests/expected/libmount/optstr-set-remove b/tests/expected/libmount/optstr-set-remove
new file mode 100644 (file)
index 0000000..0505bed
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb,ccc<
diff --git a/tests/expected/libmount/optstr-set-small b/tests/expected/libmount/optstr-set-small
new file mode 100644 (file)
index 0000000..6c358b3
--- /dev/null
@@ -0,0 +1 @@
+result: >aaa,bbb=X,ccc<
diff --git a/tests/expected/libmount/optstr-split b/tests/expected/libmount/optstr-split
new file mode 100644 (file)
index 0000000..bd2bc23
--- /dev/null
@@ -0,0 +1,3 @@
+user : user=kzak,loop=/dev/loop0
+vfs  : noexec,nosuid
+fs   : aaa,bbb=BBB,ccc
diff --git a/tests/ts/libmount/optstr b/tests/ts/libmount/optstr
new file mode 100755 (executable)
index 0000000..1bc8d18
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/bash
+
+# Copyright (C) 2010 Karel Zak <kzak@redhat.com>
+
+TS_TOPDIR="$(dirname $0)/../.."
+TS_DESC="options string"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+TESTPROG="$TS_HELPER_OPTSTR"
+
+ts_init_subtest "append"
+$TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "append-value"
+$TESTPROG --append "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend"
+$TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "prepend-value"
+$TESTPROG --prepend "aaa,bbb=BBB,ccc" "ddd" "DDD" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-remove"
+$TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-small"
+$TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "X" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-large"
+$TESTPROG --set "aaa,bbb=BBB,ccc" "bbb" "XXX-YYY-ZZZ" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new"
+$TESTPROG --set "aaa,bbb=BBB,ccc" "aaa" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "set-new-end"
+$TESTPROG --set "aaa,bbb=BBB,ccc" "ccc" "XXX" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get"
+$TESTPROG --get "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "get-value"
+$TESTPROG --get "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove"
+$TESTPROG --remove "aaa,bbb=BBB,ccc" "aaa" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "remove-value"
+$TESTPROG --remove "aaa,bbb=BBB,ccc" "bbb" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "split"
+$TESTPROG --split "aaa,bbb=BBB,ccc,user=kzak,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "flags"
+$TESTPROG --flags "aaa,bbb=BBB,ccc,user=kzak,noexec,nosuid,loop=/dev/loop0" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-linux"  # add noatime and remove noexec and nosuid
+$TESTPROG --apply --linux "user=kzak,noexec,nosuid" 0x400 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "apply-user"   # add user,nofail and remove loop
+$TESTPROG --apply --user "noexec,nosuid,loop=/dev/looop0" 0x408 &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_init_subtest "fix"
+$TESTPROG --fix "uid=root,gid=root" &> $TS_OUTPUT
+ts_finalize_subtest
+
+ts_finalize