[libvirt] adding tests....

Jim Meyering jim at meyering.net
Mon Jan 12 12:28:41 UTC 2009


"Daniel P. Berrange" <berrange at redhat.com> wrote:
>> +    if (remote_config_file == NULL) {
>> +	static const char *default_config_file
>> +	  = SYSCONF_DIR "/libvirt/libvirtd.conf";
>> +	remote_config_file =
>> +	  (access(default_config_file, X_OK) == 0
>> +	   ? default_config_file
>> +	   : "/dev/null");
>> +    }
>
> Indentation looks off-by-2 there.

Good catch.  I had TABs there.
Fixed.

>> +virsh --connect qemu:///session \
>> +    pool-define-as P dir src-host /src/path /src/dev S /target-path > out 2>&1 \
>> +  || fail=1
>> +virsh --connect qemu:///session pool-dumpxml P >> out 2>&1 || fail=1
>
> Using qemu:///session here is fragile because it'll see
> all existing user defined vms/network/storage/etc. Use
> the test:///default  driver instead (or test:///path/to/custom/config.xml)

I wanted to exercise a "real" drivers, not always test://.
How about using an unlikely pool name instead, i.e.,
via this incremental:

diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
index 72afa12..7ff6cd9 100755
--- a/tests/libvirtd-pool
+++ b/tests/libvirtd-pool
@@ -16,10 +16,12 @@ fail=0
 libvirtd > log 2>&1 & pid=$!
 sleep 1

+P=long-improbable-name-$$-$RANDOM-$PPID
 virsh --connect qemu:///session \
-    pool-define-as P dir src-host /src/path /src/dev S /target-path > out 2>&1 \
+    pool-define-as "$P" dir src-host /src/path /src/dev S /target-path \
+      > out 2>&1 \
   || fail=1
-virsh --connect qemu:///session pool-dumpxml P >> out 2>&1 || fail=1
+virsh --connect qemu:///session pool-dumpxml "$P" >> out 2>&1 || fail=1

 # remove random uuid
 sed 's/<uuid>.*/-/' out > k && mv k out || fail=1




More information about the libvir-list mailing list