mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 10:52:22 +00:00
add two tests
* tests/libvirtd-pool: New file. Exercise the new unix_sock_dir option * tests/libvirtd-fail: New file. * tests/Makefile.am (test_scripts): Add libvirtd-fail and libvirtd-pool.
This commit is contained in:
parent
0bfa7cbb29
commit
d15549aee0
@ -1,3 +1,11 @@
|
|||||||
|
Mon Mar 2 21:00:00 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
|
add two tests
|
||||||
|
* tests/libvirtd-pool: New file.
|
||||||
|
Exercise the new unix_sock_dir option
|
||||||
|
* tests/libvirtd-fail: New file.
|
||||||
|
* tests/Makefile.am (test_scripts): Add libvirtd-fail and libvirtd-pool.
|
||||||
|
|
||||||
Mon Mar 2 20:01:55 +0100 2009 Jim Meyering <meyering@redhat.com>
|
Mon Mar 2 20:01:55 +0100 2009 Jim Meyering <meyering@redhat.com>
|
||||||
|
|
||||||
tests: fix an error that made us skip the daemon-conf test
|
tests: fix an error that made us skip the daemon-conf test
|
||||||
|
@ -81,7 +81,9 @@ test_scripts += \
|
|||||||
daemon-conf \
|
daemon-conf \
|
||||||
define-dev-segfault \
|
define-dev-segfault \
|
||||||
int-overflow \
|
int-overflow \
|
||||||
|
libvirtd-fail \
|
||||||
libvirtd-net-persist \
|
libvirtd-net-persist \
|
||||||
|
libvirtd-pool \
|
||||||
read-bufsiz \
|
read-bufsiz \
|
||||||
read-non-seekable \
|
read-non-seekable \
|
||||||
start \
|
start \
|
||||||
|
21
tests/libvirtd-fail
Executable file
21
tests/libvirtd-fail
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Ensure that libvirt fails when given nonexistent --config=FILE
|
||||||
|
|
||||||
|
if test "$VERBOSE" = yes; then
|
||||||
|
set -x
|
||||||
|
libvirtd --version
|
||||||
|
fi
|
||||||
|
|
||||||
|
test -z "$srcdir" && srcdir=$(pwd)
|
||||||
|
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||||
|
. "$srcdir/test-lib.sh"
|
||||||
|
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
libvirtd --config=no-such-file > log 2>&1 && fail=1
|
||||||
|
cat <<\EOF > exp
|
||||||
|
Failed to open file 'no-such-file': No such file or directory
|
||||||
|
EOF
|
||||||
|
|
||||||
|
compare exp log || fail=1
|
||||||
|
exit $fail
|
63
tests/libvirtd-pool
Executable file
63
tests/libvirtd-pool
Executable file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Get coverage of libvirtd's config-parsing code.
|
||||||
|
|
||||||
|
if test "$VERBOSE" = yes; then
|
||||||
|
set -x
|
||||||
|
libvirtd --version
|
||||||
|
virsh --version
|
||||||
|
fi
|
||||||
|
|
||||||
|
test -z "$srcdir" && srcdir=$(pwd)
|
||||||
|
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
|
||||||
|
. "$srcdir/test-lib.sh"
|
||||||
|
|
||||||
|
fail=0
|
||||||
|
|
||||||
|
pwd=$(pwd) || fail=1
|
||||||
|
sock_dir="$pwd"
|
||||||
|
cat > conf <<EOF || fail=1
|
||||||
|
unix_sock_dir = "$sock_dir"
|
||||||
|
log_outputs = "3:file:$pwd/log"
|
||||||
|
EOF
|
||||||
|
|
||||||
|
libvirtd --config=conf > libvirtd-log 2>&1 & pid=$!
|
||||||
|
sleep 1
|
||||||
|
|
||||||
|
url="qemu:///session?socket=@$sock_dir/libvirt-sock"
|
||||||
|
virsh --connect "$url" \
|
||||||
|
pool-define-as P dir src-host /src/path /src/dev S /target-path > out 2>&1 \
|
||||||
|
|| fail=1
|
||||||
|
virsh --connect "$url" pool-dumpxml P >> out 2>&1 || fail=1
|
||||||
|
|
||||||
|
# remove random uuid
|
||||||
|
sed 's/<uuid>.*/-/' out > k && mv k out || fail=1
|
||||||
|
|
||||||
|
kill $pid
|
||||||
|
|
||||||
|
cat <<EOF > pool-list-exp
|
||||||
|
Pool P defined
|
||||||
|
|
||||||
|
<pool type='dir'>
|
||||||
|
<name>P</name>
|
||||||
|
-
|
||||||
|
<capacity>0</capacity>
|
||||||
|
<allocation>0</allocation>
|
||||||
|
<available>0</available>
|
||||||
|
<source>
|
||||||
|
</source>
|
||||||
|
<target>
|
||||||
|
<path>/target-path</path>
|
||||||
|
<permissions>
|
||||||
|
<mode>0700</mode>
|
||||||
|
<owner>500</owner>
|
||||||
|
<group>500</group>
|
||||||
|
</permissions>
|
||||||
|
</target>
|
||||||
|
</pool>
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
compare pool-list-exp out || fail=1
|
||||||
|
compare /dev/null libvirtd-log || fail=1
|
||||||
|
|
||||||
|
exit $fail
|
Loading…
x
Reference in New Issue
Block a user