Commit 5b9d7659 authored by Michal Privoznik's avatar Michal Privoznik

tests: run under distcheck

Signed-off-by: 's avatarMichal Privoznik <mprivozn@redhat.com>
parent 3e6a602e
......@@ -6,7 +6,9 @@ WL=@WL@
SHLIB_FLAGS=@SHLIB_FLAGS@
install-exec-local:
$(INSTALL) -m 644 -D $(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so
$(MKDIR_P) $(DESTDIR)$(PHPEDIR)
$(MKDIR_P) $(DESTDIR)$(PHPCDIR)
$(INSTALL) -m 644 -D .libs/$(PACKAGE).so $(DESTDIR)$(PHPEDIR)/$(PACKAGE).so
$(INSTALL) -m 755 -d $(DESTDIR)$(PHPCDIR)
$(ECHO) "extension=$(PACKAGE).so" > $(DESTDIR)$(PHPCDIR)/libvirt-php.ini
$(ECHO) >> $(DESTDIR)$(PHPCDIR)/libvirt-php.ini
......
......@@ -3,6 +3,9 @@ test_scripts = runtests.sh
TESTS = $(test_scripts)
EXTRA_DIST = $(test_scripts) \
runtests-report.sh \
data \
functions.phpt.in \
php.ini \
test-connect.phpt \
test-conn-limit.phpt \
test-domain-create-and-coredump.phpt \
......@@ -19,3 +22,14 @@ EXTRA_DIST = $(test_scripts) \
test-logging.phpt \
test-version-get.phpt \
test-version-check.phpt
runtests.sh: functions.phpt
functions.phpt: functions.phpt.in
$(AM_V_GEN)sed \
-e 's|[@]abs_srcdir[@]|$(abs_srcdir)|g' \
< $< > $@-t && \
chmod a+x $@-t && \
mv $@-t $@
CLEANFILES = functions.phpt
......@@ -29,8 +29,10 @@
exit(1);
}
$abs_srcdir = '@abs_srcdir@' ?: getcwd();
if (!extension_loaded('libvirt')) {
if (!dl('../src/libvirt-php.so'))
if (!dl('libvirt-php.so'))
bail('Cannot load libvirt-php extension. Please install libvirt-php first (using `make install`)');
}
?>
#!/bin/bash
: ${srcdir=.}
nf=$1
tests=( "test-version-check" "test-version-get" "test-get-emulator" "test-logging"
"test-connect" "test-conn-limit"
......@@ -15,7 +17,7 @@ run_test()
local nf=$2
ret=0
php -n -c "./php.ini" $name.phpt
php -n -c "${srcdir}/php.ini" "${srcdir}/${name}.phpt"
if [ "x$?" != "x0" ]; then
if [ "x$nf" == 'x1' ]; then
ret=1
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_create_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_create_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_create_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_create_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_define_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -5,8 +5,7 @@
if (!is_resource($conn))
bail('Connection to default hypervisor failed');
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-no-disk-and-media.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-no-disk-and-media.xml');
$res = libvirt_domain_define_xml($conn, $xml);
if (!is_resource($res))
......
......@@ -11,8 +11,7 @@
@libvirt_domain_undefine($res);
}
$curdir = getcwd();
$xml = file_get_contents($curdir.'/data/example-qcow2-disk.xml');
$xml = file_get_contents($abs_srcdir.'/data/example-qcow2-disk.xml');
/* This is applicable only for QEMU/KVM so check whether we're on QEMU/KVM */
$e = @libvirt_connect_get_emulator($conn);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment