diff --git a/tests/capabilityschematest b/tests/capabilityschematest
index 78fbc8ee0cc2392dad335b841da26f30b0df7aa7..458212e1e662840b3449fab70084f7d8049ed95d 100755
--- a/tests/capabilityschematest
+++ b/tests/capabilityschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="capabilityschemadata xencapsdata"
diff --git a/tests/domaincapsschematest b/tests/domaincapsschematest
index 2c19ac40048f8b10b8068b7cba689484b54d7fbc..3b2021f75beb78c6dd2fae470ac9f755bcf881d9 100755
--- a/tests/domaincapsschematest
+++ b/tests/domaincapsschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS=""
diff --git a/tests/domainschematest b/tests/domainschematest
index 3271a28c29ab999dc87ad7a460ee0d19fa67ff7a..c059c986587275b1f056646e060f9e430af2352f 100755
--- a/tests/domainschematest
+++ b/tests/domainschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS=""
diff --git a/tests/domainsnapshotschematest b/tests/domainsnapshotschematest
index ba28e051f1db0c7ebc92e87423d760ed3f320ee6..33b539adc50d209b2f4c16537b7ec117206db200 100755
--- a/tests/domainsnapshotschematest
+++ b/tests/domainsnapshotschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="domainsnapshotxml2xmlin domainsnapshotxml2xmlout"
diff --git a/tests/interfaceschematest b/tests/interfaceschematest
index 47745eaf65f8f1d7b58007eb783d3afa40ad5aa5..239b74974c94f51430ffcda3fdf565163ccf2953 100755
--- a/tests/interfaceschematest
+++ b/tests/interfaceschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="interfaceschemadata"
diff --git a/tests/libvirtd-fail b/tests/libvirtd-fail
index c6b6876bfee57f7ab838f22cf7c660ab700eb4a0..6c61b892cb38735dae671c9b09e63fabb0040621 100755
--- a/tests/libvirtd-fail
+++ b/tests/libvirtd-fail
@@ -1,17 +1,13 @@
#!/bin/sh
# Ensure that libvirt fails when given nonexistent --config=FILE
-test -z "$srcdir" && srcdir=$(pwd)
-test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
-test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/daemon/libvirtd --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
$abs_top_builddir/daemon/libvirtd --config=no-such-conf --timeout=5 2> log
diff --git a/tests/libvirtd-pool b/tests/libvirtd-pool
index ca1db94ad6b1c184f98e2884dfcf243a83811c4e..4be65c68fec5febc6aed75d1879940184cf5275f 100755
--- a/tests/libvirtd-pool
+++ b/tests/libvirtd-pool
@@ -1,17 +1,13 @@
#!/bin/sh
# Get coverage of virsh pool-define-as XML formatting
-test -z "$srcdir" && srcdir=$(pwd)
-test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
-test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
pwd=$(pwd) || fail=1
diff --git a/tests/networkschematest b/tests/networkschematest
index fe46893eadc690102e24441af00c473ac1768cd4..adbc7f4714e756e00cc746c10454ab8f7b1d7ba9 100755
--- a/tests/networkschematest
+++ b/tests/networkschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="../src/network networkxml2xmlin networkxml2xmlout"
diff --git a/tests/nodedevschematest b/tests/nodedevschematest
index 07b1f7b4a04347bf72298144aa5b17184bb0e7c1..1d853718098f0a3e209ff2116be89990490398a3 100755
--- a/tests/nodedevschematest
+++ b/tests/nodedevschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="nodedevschemadata"
diff --git a/tests/nwfilterschematest b/tests/nwfilterschematest
index 8703e21b4ccd53b635c479006ab697eeab494e78..408034cdd437fd254af38ce5ae40715179a520b9 100755
--- a/tests/nwfilterschematest
+++ b/tests/nwfilterschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="nwfilterxml2xmlout"
diff --git a/tests/secretschematest b/tests/secretschematest
index 23b0e2f4441ca2fa7e2ca77fb0a79779f620d2d8..9c290212558827e018916675bfe020949efea323 100755
--- a/tests/secretschematest
+++ b/tests/secretschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="secretxml2xmlin"
diff --git a/tests/storagepoolschematest b/tests/storagepoolschematest
index ebea71104b589c9986723094ac7b4c0a1404c8f0..ebbf4d1a10e71e4dc876c2c61b0f82792f8fd591 100755
--- a/tests/storagepoolschematest
+++ b/tests/storagepoolschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="storagepoolxml2xmlin storagepoolxml2xmlout storagepoolschemadata"
diff --git a/tests/storagevolschematest b/tests/storagevolschematest
index 395df572f467ad1708451c1e6ee91203e708ab17..d3ba3a8e695d17a7163a96dfda36e260c0157f1a 100755
--- a/tests/storagevolschematest
+++ b/tests/storagevolschematest
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
. $abs_srcdir/schematestutils.sh
DIRS="storagevolxml2xmlin storagevolxml2xmlout storagevolschemadata"
diff --git a/tests/virconftest.sh b/tests/virconftest.sh
index 2920e283165506673376adc44cea7f47f798f0f6..0fd5bbe75179ac70e56e9bcf6b410d32d8216be6 100755
--- a/tests/virconftest.sh
+++ b/tests/virconftest.sh
@@ -1,8 +1,6 @@
#!/bin/sh
-test -z "$srcdir" && srcdir=$(pwd)
-
-. "$srcdir/test-lib.sh"
+. "$(dirname $0)/test-lib.sh"
test_intro $this_test
diff --git a/tests/virsh-all b/tests/virsh-all
index 4e456c68eb7e35dc3d8d91bce9a696be8b0b258c..4a91e4e102f475117483837a3adac5a27cde57fb 100755
--- a/tests/virsh-all
+++ b/tests/virsh-all
@@ -17,9 +17,7 @@
# along with this program. If not, see
# .
-test -z "$srcdir" && srcdir=$(pwd)
-
-. "$srcdir/test-lib.sh"
+. "$(dirname $0)/test-lib.sh"
test_expensive
diff --git a/tests/virsh-cpuset b/tests/virsh-cpuset
index 35803be02c1db6e73294d094ff521608fb84be8c..66163013c281e16a5e30cda56463563951979623 100755
--- a/tests/virsh-cpuset
+++ b/tests/virsh-cpuset
@@ -17,17 +17,13 @@
# 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)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
# generate input
diff --git a/tests/virsh-define-dev-segfault b/tests/virsh-define-dev-segfault
index 81a8773def87bbf9d1b3ab527c6f1c6d2c0f103b..44fc6dca9a205c149494c77b830e8d76bc138ce2 100755
--- a/tests/virsh-define-dev-segfault
+++ b/tests/virsh-define-dev-segfault
@@ -2,17 +2,13 @@
# 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.
-test -z "$srcdir" && srcdir=$(pwd)
-test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
-test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
# Domain definition from Cole Robinson.
diff --git a/tests/virsh-int-overflow b/tests/virsh-int-overflow
index 36e55368adad675d50e2bb485b70a5cf4cdcd1bb..e9eb03bfbb25e64cefcbf8ccf7bcf77ce845a3a4 100755
--- a/tests/virsh-int-overflow
+++ b/tests/virsh-int-overflow
@@ -2,17 +2,13 @@
# Ensure that an invalid domain ID isn't interpreted as a valid one.
# Before, an ID of 2^32+2 would be treated just like an ID of 2.
-test -z "$srcdir" && srcdir=$(pwd)
-test -z "$abs_top_srcdir" && abs_top_srcdir=$(pwd)/..
-test -z "$abs_top_builddir" && abs_top_builddir=$(pwd)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
echo "error: failed to get domain '4294967298'" > exp || fail=1
$abs_top_builddir/tools/virsh --quiet \
--connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
diff --git a/tests/virsh-optparse b/tests/virsh-optparse
index 0fc261dffb62139398f64d0c3427c9f9f2ec3b95..cbd6c30a946cd8595fed4e0a4d735bc143b3a0fd 100755
--- a/tests/virsh-optparse
+++ b/tests/virsh-optparse
@@ -17,9 +17,7 @@
# along with this program. If not, see
# .
-: ${srcdir=$(pwd)}
-: ${abs_top_srcdir=$(pwd)/..}
-: ${abs_top_builddir=$(pwd)/..}
+. "$(dirname $0)/test-lib.sh"
# If $abs_top_builddir/tools is not early in $PATH, put it there,
# so that we can safely invoke "virsh" simply with its name.
@@ -34,8 +32,6 @@ if test "$VERBOSE" = yes; then
virsh --version
fi
-. "$srcdir/test-lib.sh"
-
cat <<\EOF > exp-out || framework_failure
setvcpus: trying as domain NAME
diff --git a/tests/virsh-read-bufsiz b/tests/virsh-read-bufsiz
index 23c3b531d9ae0bc03dec2b8cb9492103e53662c9..116eff1c4c4364bb6ac2a29b0dcff39fd9462571 100755
--- a/tests/virsh-read-bufsiz
+++ b/tests/virsh-read-bufsiz
@@ -17,17 +17,13 @@
# 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`/..
+. "$(dirname $0)/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.
diff --git a/tests/virsh-read-non-seekable b/tests/virsh-read-non-seekable
index 46e2831eb9c50a3cc11ade8b359da509ace81f96..0f7504c800d46b09e3fd4c30b2cf2d34b8eb005d 100755
--- a/tests/virsh-read-non-seekable
+++ b/tests/virsh-read-non-seekable
@@ -17,17 +17,13 @@
# 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`/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
cat <<\EOF > dom
diff --git a/tests/virsh-schedinfo b/tests/virsh-schedinfo
index 37f7bd3550e598fced012d1d6ca728ea1a69a6c7..d6d9ac2d59ed32f18ad55b73a007b1ed3e3984f9 100755
--- a/tests/virsh-schedinfo
+++ b/tests/virsh-schedinfo
@@ -17,9 +17,7 @@
# along with this program. If not, see
# .
-: ${srcdir=$(pwd)}
-: ${abs_top_srcdir=$(pwd)/..}
-: ${abs_top_builddir=$(pwd)/..}
+. "$(dirname $0)/test-lib.sh"
# If $abs_top_builddir/tools is not early in $PATH, put it there,
# so that we can safely invoke "virsh" simply with its name.
@@ -34,8 +32,6 @@ if test "$VERBOSE" = yes; then
virsh --version
fi
-. "$srcdir/test-lib.sh"
-
printf 'Scheduler : fair\n\n' > exp-out || framework_failure
printf 'error: invalid scheduler option: j\n' > exp-err || framework_failure
diff --git a/tests/virsh-start b/tests/virsh-start
index 5d4c0a73c76d04e8811311473f7b91297598c555..cb58c3b09ce98946533f6405a22161f1a027e6f3 100755
--- a/tests/virsh-start
+++ b/tests/virsh-start
@@ -17,17 +17,13 @@
# 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)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
test_url=test:///default
diff --git a/tests/virsh-synopsis b/tests/virsh-synopsis
index cacdee487669cda994956776dc4a0ed1cdf2964d..d0d1197fab05c165405bc0200eb728a0ffacb432 100755
--- a/tests/virsh-synopsis
+++ b/tests/virsh-synopsis
@@ -17,17 +17,13 @@
# 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)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
test_url=test:///default
diff --git a/tests/virsh-undefine b/tests/virsh-undefine
index f7ba49593373850b596b348bad22b2188a7961bc..6494b4adf0b5934aed2e4953ba13bc0cff9498e7 100755
--- a/tests/virsh-undefine
+++ b/tests/virsh-undefine
@@ -17,17 +17,13 @@
# 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)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
# Attempt to undefine a running domain, by domain name. Every time a new
diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence
index f9e32565890040105bfbe14135509c8af7a40233..1cf3d22ec74c176a42e2e78b2f2774fe47630871 100755
--- a/tests/virsh-uriprecedence
+++ b/tests/virsh-uriprecedence
@@ -1,7 +1,6 @@
#!/bin/sh
-: ${srcdir=.}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
# This test checks if virsh obeys the proper precedence of different
# URI settings
diff --git a/tests/virsh-vcpupin b/tests/virsh-vcpupin
index 9e656c0aa1c0e8d5811b3c1793bc96afe8c98e05..306552a8f4d158c90bb26b4ad1e2c67a5fec1f5e 100755
--- a/tests/virsh-vcpupin
+++ b/tests/virsh-vcpupin
@@ -17,17 +17,13 @@
# 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)/..
+. "$(dirname $0)/test-lib.sh"
if test "$VERBOSE" = yes; then
set -x
$abs_top_builddir/tools/virsh --version
fi
-. "$srcdir/test-lib.sh"
-
fail=0
# Invalid syntax.