diff options
author | Karel Zak <kzak@redhat.com> | 2010-10-15 15:53:33 +0200 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2011-01-03 12:28:45 +0100 |
commit | af0b9283879b9aa0cfae942663c4fe7f9bf88aee (patch) | |
tree | ea0ba0c6d4c5b94b1e718b7363b20e265a5d24d9 | |
parent | 6f8ab4de470fa0bc6a2932a20795fb9ff1d8241e (diff) | |
download | util-linux-old-af0b9283879b9aa0cfae942663c4fe7f9bf88aee.tar.gz |
tests: add libmount optstr.c tests
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | tests/commands.sh.in | 2 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-append | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-append-value | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-apply-linux | 2 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-apply-user | 2 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-fix | 2 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-flags | 2 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-get | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-get-value | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-prepend | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-prepend-value | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-remove | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-remove-value | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-set-large | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-set-new | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-set-new-end | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-set-remove | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-set-small | 1 | ||||
-rw-r--r-- | tests/expected/libmount/optstr-split | 3 | ||||
-rwxr-xr-x | tests/ts/libmount/optstr | 85 |
20 files changed, 111 insertions, 0 deletions
diff --git a/tests/commands.sh.in b/tests/commands.sh.in index d56e1d21..a13e00c9 100644 --- a/tests/commands.sh.in +++ b/tests/commands.sh.in @@ -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 index 00000000..10933cb1 --- /dev/null +++ b/tests/expected/libmount/optstr-append @@ -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 index 00000000..e0116f63 --- /dev/null +++ b/tests/expected/libmount/optstr-append-value @@ -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 index 00000000..50a52a79 --- /dev/null +++ b/tests/expected/libmount/optstr-apply-linux @@ -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 index 00000000..2f34732b --- /dev/null +++ b/tests/expected/libmount/optstr-apply-user @@ -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 index 00000000..9eb68179 --- /dev/null +++ b/tests/expected/libmount/optstr-fix @@ -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 index 00000000..013e22c4 --- /dev/null +++ b/tests/expected/libmount/optstr-flags @@ -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 index 00000000..7eafc658 --- /dev/null +++ b/tests/expected/libmount/optstr-get @@ -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 index 00000000..509843f7 --- /dev/null +++ b/tests/expected/libmount/optstr-get-value @@ -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 index 00000000..cdcf7519 --- /dev/null +++ b/tests/expected/libmount/optstr-prepend @@ -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 index 00000000..debc7eed --- /dev/null +++ b/tests/expected/libmount/optstr-prepend-value @@ -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 index 00000000..4c28ed20 --- /dev/null +++ b/tests/expected/libmount/optstr-remove @@ -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 index 00000000..eee5c95b --- /dev/null +++ b/tests/expected/libmount/optstr-remove-value @@ -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 index 00000000..b518c268 --- /dev/null +++ b/tests/expected/libmount/optstr-set-large @@ -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 index 00000000..5d45b4fa --- /dev/null +++ b/tests/expected/libmount/optstr-set-new @@ -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 index 00000000..39675a48 --- /dev/null +++ b/tests/expected/libmount/optstr-set-new-end @@ -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 index 00000000..0505bed9 --- /dev/null +++ b/tests/expected/libmount/optstr-set-remove @@ -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 index 00000000..6c358b3a --- /dev/null +++ b/tests/expected/libmount/optstr-set-small @@ -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 index 00000000..bd2bc237 --- /dev/null +++ b/tests/expected/libmount/optstr-split @@ -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 index 00000000..1bc8d18c --- /dev/null +++ b/tests/ts/libmount/optstr @@ -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 |