diff --git a/tests/Makefile.am b/tests/Makefile.am
index 97bdf551ee..a837150ffa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -158,7 +158,7 @@ TESTS += nodedevxml2xmltest
TESTS += interfacexml2xmltest
-path_add = $$abs_top_builddir/src$(PATH_SEPARATOR)$$abs_top_builddir/daemon
+path_add = $$abs_top_builddir/src$(PATH_SEPARATOR)$$abs_top_builddir/daemon$(PATH_SEPARATOR)$$abs_top_builddir/tools
# NB, automake < 1.10 does not provide the real
# abs_top_{src/build}dir variables, so don't rely
diff --git a/tests/cpuset b/tests/cpuset
index eeb0ee269c..9f4326951e 100755
--- a/tests/cpuset
+++ b/tests/cpuset
@@ -16,17 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-. $srcdir/test-lib.sh
+. "$srcdir/test-lib.sh"
fail=0
# generate input
-virsh --connect test:///default dumpxml 1 > xml || fail=1
+$abs_top_builddir/tools/virsh --connect test:///default dumpxml 1 > xml || fail=1
# require the presence of the string we'll transform
grep '' xml > /dev/null || fail=1
@@ -34,7 +38,7 @@ grep '' xml > /dev/null || fail=1
sed "s/vcpu>/vcpu cpuset='aaa'>/" xml > xml-invalid || fail=1
# Require failure and a diagnostic.
-virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
+$abs_top_builddir/tools/virsh --connect test:///default define xml-invalid > out 2>&1 && fail=1
cat <<\EOF > exp || fail=1
error: Failed to define domain from xml-invalid
error: failed Xen syscall topology cpuset syntax error
diff --git a/tests/daemon-conf b/tests/daemon-conf
index 071497e1e4..722fe4e436 100755
--- a/tests/daemon-conf
+++ b/tests/daemon-conf
@@ -1,16 +1,20 @@
#!/bin/sh
# Get coverage of libvirtd's config-parsing code.
-if test "$VERBOSE" = yes; then
- set -x
- libvirtd --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
-. $srcdir/test-lib.sh
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
-grep '^#define WITH_QEMU 1' $CONFIG_HEADER > /dev/null ||
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/daemon/libvirtd --version
+fi
+
+. "$srcdir/test-lib.sh"
+
+test -z "$CONFIG_HEADER" && CONFIG_HEADER="$abs_top_builddir/config.h"
+
+grep '^#define WITH_QEMU 1' "$CONFIG_HEADER" > /dev/null ||
skip_test_ "configured without QEMU support"
conf="$abs_top_srcdir/daemon/libvirtd.conf"
@@ -40,7 +44,7 @@ while :; do
esac
# Run libvirtd, expecting it to fail.
- libvirtd --config=$f 2> err && fail=1
+ $abs_top_builddir/daemon/libvirtd --config=$f 2> err && fail=1
case $rhs in
# '"'*) msg='should be a string';;
@@ -73,7 +77,7 @@ sed 's,^log_outputs.*,log_outputs="3:file:'"$(pwd)/log"'",' tmp.conf > k \
mv k tmp.conf || fail=1
printf "running libvirtd with a valid config file ($sleep_secs seconds)\n" 1>&2
-libvirtd --pid-file=pid-file --config=tmp.conf > log 2>&1 & pid=$!
+$abs_top_builddir/daemon/libvirtd --pid-file=pid-file --config=tmp.conf > log 2>&1 & pid=$!
sleep $sleep_secs
kill $pid
diff --git a/tests/define-dev-segfault b/tests/define-dev-segfault
index 4ae286fe2d..e0b953ad84 100755
--- a/tests/define-dev-segfault
+++ b/tests/define-dev-segfault
@@ -2,13 +2,15 @@
# Exercise a bug whereby defining a valid domain could kill libvirtd.
# The bug can also be exercised with a simple define/dumpxml pair to virsh.
-if test "$VERBOSE" = yes; then
- set -x
- virsh --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/tools/virsh --version
+fi
+
. "$srcdir/test-lib.sh"
fail=0
@@ -62,7 +64,7 @@ cat <<\EOF > D.xml || fail=1
EOF
url=test:///default
-virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
+$abs_top_builddir/tools/virsh --connect "$url" 'define D.xml; dumpxml D' > out 2>&1 || fail=1
cat > exp < exp || fail=1
echo domname 4294967298 | $abs_top_builddir/tools/virsh --quiet \
diff --git a/tests/libvirtd-fail b/tests/libvirtd-fail
index eeb1ee68fc..c6b6876bfe 100755
--- a/tests/libvirtd-fail
+++ b/tests/libvirtd-fail
@@ -1,18 +1,20 @@
#!/bin/sh
# Ensure that libvirt fails when given nonexistent --config=FILE
-if test "$VERBOSE" = yes; then
- set -x
- libvirtd --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/daemon/libvirtd --version
+fi
+
. "$srcdir/test-lib.sh"
fail=0
-libvirtd --config=no-such-conf --timeout=5 2> log
+$abs_top_builddir/daemon/libvirtd --config=no-such-conf --timeout=5 2> log
RET=$?
test "$RET" != "0" && exit 0 || exit 1
diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
index 59da5a696d..ca1db94ad6 100755
--- a/tests/libvirtd-pool
+++ b/tests/libvirtd-pool
@@ -1,20 +1,22 @@
#!/bin/sh
# Get coverage of virsh pool-define-as XML formatting
-if test "$VERBOSE" = yes; then
- set -x
- virsh --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/tools/virsh --version
+fi
+
. "$srcdir/test-lib.sh"
fail=0
pwd=$(pwd) || fail=1
-virsh --connect test:///default \
+$abs_top_builddir/tools/virsh --connect test:///default \
pool-define-as --print-xml \
P dir src-host /src/path /src/dev S /target-path \
1>out 2>&1
diff --git a/tests/read-bufsiz b/tests/read-bufsiz
index 7d53735bfa..5baa7c5903 100755
--- a/tests/read-bufsiz
+++ b/tests/read-bufsiz
@@ -16,20 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-if test "$VERBOSE" = yes; then
- set -x
- virsh --version
-fi
-
test -z "$srcdir" && srcdir=`pwd`
test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/..
+test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/..
-. $srcdir/test-lib.sh
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/tools/virsh --version
+fi
+
+. "$srcdir/test-lib.sh"
fail=0
# Output a valid definition, to be used as input.
-virsh -c test:///default dumpxml 1 > xml || fail=1
+$abs_top_builddir/tools/virsh -c test:///default dumpxml 1 > xml || fail=1
for i in before after; do
# The largest BUFSIZ I've seen is 128K. This is slightly larger.
@@ -38,7 +39,7 @@ for i in before after; do
# Append or prepend enough spaces to push the size over the limit:
( test $i = before && cat sp xml || cat xml sp ) > $in || fail=1
- virsh --connect test:///default define $in > out || fail=1
+ $abs_top_builddir/tools/virsh --connect test:///default define $in > out || fail=1
printf "Domain test defined from $in\n\n" > exp || fail=1
compare exp out || fail=1
done
diff --git a/tests/read-non-seekable b/tests/read-non-seekable
index 8a7bdcdf22..59c2389d62 100755
--- a/tests/read-non-seekable
+++ b/tests/read-non-seekable
@@ -16,12 +16,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_top_srcdir" && abs_top_srcdir=`pwd`/..
+test -z "$abs_top_builddir" && abs_top_builddir=`pwd`/..
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-. $srcdir/test-lib.sh
+. "$srcdir/test-lib.sh"
fail=0
@@ -40,11 +44,11 @@ cat <<\EOF > dom
EOF
-virsh -c test:///default define dom > /dev/null || fail=1
+$abs_top_builddir/tools/virsh -c test:///default define dom > /dev/null || fail=1
mkfifo_or_skip_ fifo
cat dom > fifo &
-virsh -c test:///default define fifo > /dev/null || fail=1
+$abs_top_builddir/tools/virsh -c test:///default define fifo > /dev/null || fail=1
(exit $fail); exit $fail
diff --git a/tests/start b/tests/start
index f457d5939e..930a6d9e46 100755
--- a/tests/start
+++ b/tests/start
@@ -16,13 +16,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-if test "$VERBOSE" = yes; then
- set -x
- virsh --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/tools/virsh --version
+fi
+
. "$srcdir/test-lib.sh"
fail=0
@@ -30,7 +32,7 @@ fail=0
test_url=test:///default
# expect this to fail
-virsh -c $test_url start test > out 2> err && fail=1
+$abs_top_builddir/tools/virsh -c $test_url start test > out 2> err && fail=1
# stdout gets a newline
echo > exp || fail=1
diff --git a/tests/test_conf.sh b/tests/test_conf.sh
index 62c2324495..682f1f5684 100755
--- a/tests/test_conf.sh
+++ b/tests/test_conf.sh
@@ -1,17 +1,19 @@
#!/bin/sh
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+test -z "$abs_srcdir" && abs_srcdir=$(pwd)
+test -z "$abs_builddir" && abs_builddir=$(pwd)
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-. $srcdir/test-lib.sh
+. "$srcdir/test-lib.sh"
set -e
-if test "x$abs_srcdir" = x; then
- abs_srcdir=`pwd`
- abs_builddir=`pwd`
-fi
fail=0
i=1
diff --git a/tests/undefine b/tests/undefine
index fafdae72a8..48b0ad9b0a 100755
--- a/tests/undefine
+++ b/tests/undefine
@@ -16,17 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-. $srcdir/test-lib.sh
+. "$srcdir/test-lib.sh"
fail=0
# Attempt to undefine a running domain, by domain name.
-virsh -q -c test:///default undefine test > out 2>&1
+$abs_top_builddir/tools/virsh -q -c test:///default undefine test > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: Failed to undefine domain test
@@ -35,7 +39,7 @@ EOF
compare exp out || fail=1
# A different diagnostic when specifying a domain ID
-virsh -q -c test:///default undefine 1 > out 2>&1
+$abs_top_builddir/tools/virsh -q -c test:///default undefine 1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: a running domain like 1 cannot be undefined;
@@ -44,7 +48,7 @@ EOF
compare exp out || fail=1
# Succeed, now: first shut down, then undefine, both via name.
-virsh -q -c test:///default 'shutdown test; undefine test' > out 2>&1
+$abs_top_builddir/tools/virsh -q -c test:///default 'shutdown test; undefine test' > out 2>&1
test $? = 0 || fail=1
cat <<\EOF > exp || fail=1
Domain test is being shutdown
diff --git a/tests/vcpupin b/tests/vcpupin
index 79b02dc23b..a72ad4ceaf 100755
--- a/tests/vcpupin
+++ b/tests/vcpupin
@@ -16,17 +16,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-. $srcdir/test-lib.sh
+. "$srcdir/test-lib.sh"
fail=0
# Invalid syntax.
-virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
+$abs_top_builddir/tools/virsh --connect test:///default vcpupin test a 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpupin: Invalid or missing vCPU number.
@@ -35,7 +39,7 @@ EOF
compare exp out || fail=1
# An out-of-range vCPU number deserves a diagnostic, too.
-virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
+$abs_top_builddir/tools/virsh --connect test:///default vcpupin test 100 0,1 > out 2>&1
test $? = 1 || fail=1
cat <<\EOF > exp || fail=1
error: vcpupin: Invalid vCPU number.
diff --git a/tests/virsh-all b/tests/virsh-all
index 03ea4668f5..81b3e57514 100755
--- a/tests/virsh-all
+++ b/tests/virsh-all
@@ -16,27 +16,29 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-if test "$VERBOSE" = yes; then
- set -x
- virsh --version
-fi
-
test -z "$srcdir" && srcdir=$(pwd)
test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
+if test "$VERBOSE" = yes; then
+ set -x
+ $abs_top_builddir/tools/virsh --version
+fi
+
. "$srcdir/test-lib.sh"
fail=0
test_url=test:///default
-virsh -c $test_url help > cmds || framework_failure
+$abs_top_builddir/tools/virsh -c $test_url help > cmds || framework_failure
cmds=$(sed -n 's/^ \([^ ][^ ]*\) .*/\1/p' cmds) || framework_failure
test -n "$cmds" || framework_failure
for i in $cmds; do
echo testing $i... 1>&2
# For now, just run the command and ignore output and exit status.
- virsh -c $test_url $i < /dev/null > /dev/null 2>&1
+ $abs_top_builddir/tools/virsh -c $test_url $i < /dev/null > /dev/null 2>&1
done
(exit $fail); exit $fail
diff --git a/tests/virsh-synopsis b/tests/virsh-synopsis
index 24038dd057..d72e8871b4 100755
--- a/tests/virsh-synopsis
+++ b/tests/virsh-synopsis
@@ -16,24 +16,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
+test -z "$srcdir" && srcdir=$(pwd)
+test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
+test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+
if test "$VERBOSE" = yes; then
set -x
- virsh --version
+ $abs_top_builddir/tools/virsh --version
fi
-test -z "$srcdir" && srcdir=$(pwd)
. "$srcdir/test-lib.sh"
fail=0
test_url=test:///default
-virsh -c $test_url help > cmds || framework_failure
+$abs_top_builddir/tools/virsh -c $test_url help > cmds || framework_failure
cmds=$(sed -n 's/^ \([^ ][^ ]*\) .*/\1/p' cmds) || framework_failure
test -n "$cmds" || framework_failure
for i in $cmds; do
- virsh -c $test_url help $i > help || fail=1
+ $abs_top_builddir/tools/virsh -c $test_url help $i > help || fail=1
grep -A1 '^ SYNOPSIS$' help > synopsis \
|| { echo 1>&2 missing or invalid help SYNOPSIS for $i; fail=1; }
sed -n 2p synopsis > s2 || framework_failure