]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: consistently source test-lib.sh in scripts
authorCole Robinson <crobinso@redhat.com>
Thu, 21 Apr 2016 17:50:18 +0000 (13:50 -0400)
committerCole Robinson <crobinso@redhat.com>
Sat, 23 Apr 2016 19:41:40 +0000 (15:41 -0400)
This unifies the test scripts to all use the similar pattern added for
schematests in ace4aecd. This gives the following

- Enables running all tests from outside of tests/ dir
- Drops redundant abs_* definitions, which are set by test-lib.sh
- Drops unnecessary srcdir variable which was only used for sourcing
    test-lib.sh

Behavior changes:

- srcdir can no longer be overwritten, but I don't know why anyone would
    really need to...
- Script VERBOSE setting no longer prints commands executed by test-lib.sh.
    if anyone cares I suggest handling this in test-lib.sh which already
    has other verbose style handling

27 files changed:
tests/capabilityschematest
tests/domaincapsschematest
tests/domainschematest
tests/domainsnapshotschematest
tests/interfaceschematest
tests/libvirtd-fail
tests/libvirtd-pool
tests/networkschematest
tests/nodedevschematest
tests/nwfilterschematest
tests/secretschematest
tests/storagepoolschematest
tests/storagevolschematest
tests/virconftest.sh
tests/virsh-all
tests/virsh-cpuset
tests/virsh-define-dev-segfault
tests/virsh-int-overflow
tests/virsh-optparse
tests/virsh-read-bufsiz
tests/virsh-read-non-seekable
tests/virsh-schedinfo
tests/virsh-start
tests/virsh-synopsis
tests/virsh-undefine
tests/virsh-uriprecedence
tests/virsh-vcpupin

index 78fbc8ee0cc2392dad335b841da26f30b0df7aa7..458212e1e662840b3449fab70084f7d8049ed95d 100755 (executable)
@@ -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"
index 2c19ac40048f8b10b8068b7cba689484b54d7fbc..3b2021f75beb78c6dd2fae470ac9f755bcf881d9 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS=""
index 3271a28c29ab999dc87ad7a460ee0d19fa67ff7a..c059c986587275b1f056646e060f9e430af2352f 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS=""
index ba28e051f1db0c7ebc92e87423d760ed3f320ee6..33b539adc50d209b2f4c16537b7ec117206db200 100755 (executable)
@@ -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"
index 47745eaf65f8f1d7b58007eb783d3afa40ad5aa5..239b74974c94f51430ffcda3fdf565163ccf2953 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS="interfaceschemadata"
index c6b6876bfee57f7ab838f22cf7c660ab700eb4a0..6c61b892cb38735dae671c9b09e63fabb0040621 100755 (executable)
@@ -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
index ca1db94ad6b1c184f98e2884dfcf243a83811c4e..4be65c68fec5febc6aed75d1879940184cf5275f 100755 (executable)
@@ -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
index fe46893eadc690102e24441af00c473ac1768cd4..adbc7f4714e756e00cc746c10454ab8f7b1d7ba9 100755 (executable)
@@ -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"
index 07b1f7b4a04347bf72298144aa5b17184bb0e7c1..1d853718098f0a3e209ff2116be89990490398a3 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS="nodedevschemadata"
index 8703e21b4ccd53b635c479006ab697eeab494e78..408034cdd437fd254af38ce5ae40715179a520b9 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS="nwfilterxml2xmlout"
index 23b0e2f4441ca2fa7e2ca77fb0a79779f620d2d8..9c290212558827e018916675bfe020949efea323 100755 (executable)
@@ -1,7 +1,6 @@
 #!/bin/sh
 
-: ${srcdir=$(dirname $0)}
-. $srcdir/test-lib.sh
+. "$(dirname $0)/test-lib.sh"
 . $abs_srcdir/schematestutils.sh
 
 DIRS="secretxml2xmlin"
index ebea71104b589c9986723094ac7b4c0a1404c8f0..ebbf4d1a10e71e4dc876c2c61b0f82792f8fd591 100755 (executable)
@@ -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"
index 395df572f467ad1708451c1e6ee91203e708ab17..d3ba3a8e695d17a7163a96dfda36e260c0157f1a 100755 (executable)
@@ -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"
index 2920e283165506673376adc44cea7f47f798f0f6..0fd5bbe75179ac70e56e9bcf6b410d32d8216be6 100755 (executable)
@@ -1,8 +1,6 @@
 #!/bin/sh
 
-test -z "$srcdir" && srcdir=$(pwd)
-
-. "$srcdir/test-lib.sh"
+. "$(dirname $0)/test-lib.sh"
 
 test_intro $this_test
 
index 4e456c68eb7e35dc3d8d91bce9a696be8b0b258c..4a91e4e102f475117483837a3adac5a27cde57fb 100755 (executable)
@@ -17,9 +17,7 @@
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-test -z "$srcdir" && srcdir=$(pwd)
-
-. "$srcdir/test-lib.sh"
+. "$(dirname $0)/test-lib.sh"
 
 test_expensive
 
index 35803be02c1db6e73294d094ff521608fb84be8c..66163013c281e16a5e30cda56463563951979623 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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
index 81a8773def87bbf9d1b3ab527c6f1c6d2c0f103b..44fc6dca9a205c149494c77b830e8d76bc138ce2 100755 (executable)
@@ -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.
index 36e55368adad675d50e2bb485b70a5cf4cdcd1bb..e9eb03bfbb25e64cefcbf8ccf7bcf77ce845a3a4 100755 (executable)
@@ -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 \
index 0fc261dffb62139398f64d0c3427c9f9f2ec3b95..cbd6c30a946cd8595fed4e0a4d735bc143b3a0fd 100755 (executable)
@@ -17,9 +17,7 @@
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-: ${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: <domain> trying as domain NAME
index 23c3b531d9ae0bc03dec2b8cb9492103e53662c9..116eff1c4c4364bb6ac2a29b0dcff39fd9462571 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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.
index 46e2831eb9c50a3cc11ade8b359da509ace81f96..0f7504c800d46b09e3fd4c30b2cf2d34b8eb005d 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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
index 37f7bd3550e598fced012d1d6ca728ea1a69a6c7..d6d9ac2d59ed32f18ad55b73a007b1ed3e3984f9 100755 (executable)
@@ -17,9 +17,7 @@
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-: ${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
 
index 5d4c0a73c76d04e8811311473f7b91297598c555..cb58c3b09ce98946533f6405a22161f1a027e6f3 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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
index cacdee487669cda994956776dc4a0ed1cdf2964d..d0d1197fab05c165405bc0200eb728a0ffacb432 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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
index f7ba49593373850b596b348bad22b2188a7961bc..6494b4adf0b5934aed2e4953ba13bc0cff9498e7 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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
index f9e32565890040105bfbe14135509c8af7a40233..1cf3d22ec74c176a42e2e78b2f2774fe47630871 100755 (executable)
@@ -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
index 9e656c0aa1c0e8d5811b3c1793bc96afe8c98e05..306552a8f4d158c90bb26b4ad1e2c67a5fec1f5e 100755 (executable)
 # along with this program.  If not, see
 # <http://www.gnu.org/licenses/>.
 
-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.