]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: test for a recent fix
authorJim Meyering <meyering@redhat.com>
Mon, 2 Mar 2009 18:41:00 +0000 (18:41 +0000)
committerJim Meyering <meyering@redhat.com>
Mon, 2 Mar 2009 18:41:00 +0000 (18:41 +0000)
* tests/libvirtd-net-persist: New file.  Test for today's
"Mark 'defined' networks as persistent" fix.
* tests/Makefile.am (test_scripts): Add it.

ChangeLog
tests/Makefile.am
tests/libvirtd-net-persist [new file with mode: 0755]

index 487290d1b76689d96888cfd393859dfdada401a0..cd91d72292eb45afb9a5ff32fd689f34f930aeab 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Mar 2 19:32:18 +0100 2009 Jim Meyering <meyering@redhat.com>
+
+       tests: test for a recent fix
+       * tests/libvirtd-net-persist: New file.  Test for today's
+       "Mark 'defined' networks as persistent" fix.
+       * tests/Makefile.am (test_scripts): Add it.
+
 Mon Mar 2 19:32:18 +0100 2009 Jim Meyering <meyering@redhat.com>
 
        virsh: tweak a format string to avoid emitting trailing space
index bec4f60548f20089ec8ee0bf707c2d3aaff4f043..7479e03dbecc77cb0483abfaf1401c199f7a2c50 100644 (file)
@@ -81,6 +81,7 @@ test_scripts +=                               \
        daemon-conf                     \
        define-dev-segfault             \
        int-overflow                    \
+       libvirtd-net-persist            \
        read-bufsiz                     \
        read-non-seekable               \
        start                           \
diff --git a/tests/libvirtd-net-persist b/tests/libvirtd-net-persist
new file mode 100755 (executable)
index 0000000..50a1ef4
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+# ensure that net-destroy doesn't make network disappear (persistence-related)
+
+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
+
+cat > net.xml <<EOF || fail=1
+<network>
+  <name>N</name>
+  <ip address="192.168.199.1" netmask="255.255.255.0"></ip>
+</network>
+EOF
+
+cat > exp <<EOF || fail=1
+Network N defined from net.xml
+
+Network N destroyed
+
+Name                 State      Autostart
+-----------------------------------------
+N                    inactive no
+
+EOF
+
+libvirtd --config=conf > libvirtd-log 2>&1 & pid=$!
+sleep 1
+
+url="qemu:///session?socket=@$sock_dir/libvirt-sock"
+virsh -c "$url" \
+    'net-define net.xml; net-destroy N; net-list --all' > out 2>&1 \
+  || fail=1
+
+# if libvird's log is empty, sleep for a second before killing it
+test -s libvirtd-log || sleep 1
+kill $pid
+
+compare exp out || fail=1
+
+printf "Shutting down network 'N'\n" > log-exp
+compare log-exp libvirtd-log || fail=1
+
+exit $fail