m4: Fix check for yajl.pc
[libvirt/ericb.git] / tests / virsh-define-dev-segfault
blob06f548fda7742ec659d1c6e07e87bb5f47d21b57
1 #!/bin/sh
2 # Exercise a bug whereby defining a valid domain could kill libvirtd.
3 # The bug can also be exercised with a simple define/dumpxml pair to virsh.
5 . "$(dirname $0)/test-lib.sh"
7 if test "$VERBOSE" = yes; then
8 set -x
9 $abs_top_builddir/tools/virsh --version
12 fail=0
14 # Domain definition from Cole Robinson.
15 cat <<\EOF > D.xml || fail=1
16 <domain type='test'>
17 <name>D</name>
18 <uuid>aaa3ae22-fed2-bfbd-ac02-3bea3bcfad82</uuid>
19 <memory unit='KiB'>262144</memory>
20 <currentMemory unit='KiB'>262144</currentMemory>
21 <vcpu placement='static'>1</vcpu>
22 <os>
23 <type arch='i686' machine='pc'>hvm</type>
24 <boot dev='cdrom'/>
25 </os>
26 <features>
27 <acpi/>
28 </features>
29 <clock offset='utc'/>
30 <on_poweroff>destroy</on_poweroff>
31 <on_reboot>restart</on_reboot>
32 <on_crash>destroy</on_crash>
33 <devices>
34 <emulator>/usr/bin/qemu-system-i686</emulator>
35 <controller type='usb' index='0'/>
36 <serial type='pty'>
37 <target port='0'/>
38 </serial>
39 <serial type='pty'>
40 <target port='1'/>
41 </serial>
42 <serial type='pty'>
43 <target port='2'/>
44 </serial>
45 <parallel type='pty'>
46 <target port='0'/>
47 </parallel>
48 <parallel type='pty'>
49 <target port='1'/>
50 </parallel>
51 <parallel type='pty'>
52 <target port='2'/>
53 </parallel>
54 <console type='pty'>
55 <target type='serial' port='0'/>
56 </console>
57 <sound model='pcspk'/>
58 <sound model='es1370'/>
59 <memballoon model='virtio'/>
60 </devices>
61 </domain>
62 EOF
64 url=test:///default
65 $abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
67 cat > exp <<EOF || fail=1
68 Domain D defined from D.xml
70 $(cat D.xml)
72 EOF
74 compare exp out || fail=1
76 exit $fail