[libvirt-php PATCH 23/29] convert test-domain-create-and-coredump.phpt to real phpt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Remi Collet <fedora@xxxxxxxxxxxxxxxxx>

---
 src/tests/example-no-disk-and-media.xml        | 41 +++++++++++++++++++++
 src/tests/test-domain-create-and-coredump.phpt | 49 ++++++++++++++++++++++++++
 2 files changed, 90 insertions(+)
 create mode 100644 src/tests/example-no-disk-and-media.xml
 create mode 100644 src/tests/test-domain-create-and-coredump.phpt

diff --git a/src/tests/example-no-disk-and-media.xml b/src/tests/example-no-disk-and-media.xml
new file mode 100644
index 0000000..a691ff4
--- /dev/null
+++ b/src/tests/example-no-disk-and-media.xml
@@ -0,0 +1,41 @@
+<domain type='test'>
+  <name>test-guest-no-disk-and-media</name>
+  <uuid>28a15e00-9c40-ddc1-b6df-9a08921b93f0</uuid>
+  <memory>65535</memory>
+  <currentMemory>65535</currentMemory>
+  <vcpu>1</vcpu>
+  <os>
+    <type arch='i686'>hvm</type>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <controller type='ide' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='scsi' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </controller>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <input type='mouse' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'/>
+    <video>
+      <model type='cirrus' vram='9216' heads='1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+  </devices>
+</domain>
+
diff --git a/src/tests/test-domain-create-and-coredump.phpt b/src/tests/test-domain-create-and-coredump.phpt
new file mode 100644
index 0000000..790da97
--- /dev/null
+++ b/src/tests/test-domain-create-and-coredump.phpt
@@ -0,0 +1,49 @@
+--TEST--
+libvirt_domain_core_dump
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+	echo "# libvirt_connect\n";
+	var_dump($conn = libvirt_connect('test:///default',  false));
+	if (!is_resource($conn))
+		die('Connection to default hypervisor failed');
+
+	$xml = file_get_contents(__DIR__.'/example-no-disk-and-media.xml');
+
+	echo "# libvirt_domain_create_xml\n";
+	var_dump($res = libvirt_domain_create_xml($conn, $xml));
+	if (!is_resource($res))
+		die('Domain definition failed with error: '.libvirt_get_last_error());
+
+	$name = tempnam(sys_get_temp_dir(), 'guestdumptest');
+	echo "# libvirt_domain_core_dump\n";
+	var_dump($ret = libvirt_domain_core_dump($res, $name));
+	if (!$ret)
+		die('Cannot dump core of the guest: '.libvirt_get_last_error());
+	var_dump(file_exists($name));
+
+	echo "# libvirt_domain_destroy\n";
+	var_dump($ret = libvirt_domain_destroy($res));
+	if (!$ret) {
+		unlink($name);
+		die('Domain destroy failed with error: '.libvirt_get_last_error());
+	}
+
+	unset($res);
+	unset($conn);
+	unlink($name);
+?>
+Done
+--EXPECTF--
+# libvirt_connect
+resource(%d) of type (Libvirt connection)
+# libvirt_domain_create_xml
+resource(%d) of type (Libvirt domain)
+# libvirt_domain_core_dump
+bool(true)
+bool(true)
+# libvirt_domain_destroy
+bool(true)
+Done
+
-- 
2.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]