This unifys the test scripts to using 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 --- tests/capabilityschematest | 3 +-- tests/domaincapsschematest | 3 +-- tests/domainschematest | 3 +-- tests/domainsnapshotschematest | 3 +-- tests/interfaceschematest | 3 +-- tests/libvirtd-fail | 6 +----- tests/libvirtd-pool | 6 +----- tests/networkschematest | 3 +-- tests/nodedevschematest | 3 +-- tests/nwfilterschematest | 3 +-- tests/secretschematest | 3 +-- tests/storagepoolschematest | 3 +-- tests/storagevolschematest | 3 +-- tests/virconftest.sh | 4 +--- tests/virsh-all | 4 +--- tests/virsh-cpuset | 6 +----- tests/virsh-define-dev-segfault | 6 +----- tests/virsh-int-overflow | 6 +----- tests/virsh-optparse | 6 +----- tests/virsh-read-bufsiz | 6 +----- tests/virsh-read-non-seekable | 6 +----- tests/virsh-schedinfo | 6 +----- tests/virsh-start | 6 +----- tests/virsh-synopsis | 6 +----- tests/virsh-undefine | 6 +----- tests/virsh-uriprecedence | 3 +-- tests/virsh-vcpupin | 6 +----- 27 files changed, 27 insertions(+), 95 deletions(-) diff --git a/tests/capabilityschematest b/tests/capabilityschematest index 78fbc8e..458212e 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 2c19ac4..3b2021f 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 3271a28..c059c98 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 ba28e05..33b539a 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 47745ea..239b749 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 c6b6876..6c61b89 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 ca1db94..4be65c6 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 fe46893..adbc7f4 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 07b1f7b..1d85371 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 8703e21..408034c 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 23b0e2f..9c29021 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 ebea711..ebbf4d1 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 395df57..d3ba3a8 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 2920e28..0fd5bbe 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 4e456c6..4a91e4e 100755 --- a/tests/virsh-all +++ b/tests/virsh-all @@ -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 diff --git a/tests/virsh-cpuset b/tests/virsh-cpuset index 35803be..6616301 100755 --- a/tests/virsh-cpuset +++ b/tests/virsh-cpuset @@ -17,17 +17,13 @@ # 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 diff --git a/tests/virsh-define-dev-segfault b/tests/virsh-define-dev-segfault index 81a8773..44fc6dc 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 36e5536..e9eb03b 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 0fc261d..cbd6c30 100755 --- a/tests/virsh-optparse +++ b/tests/virsh-optparse @@ -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 diff --git a/tests/virsh-read-bufsiz b/tests/virsh-read-bufsiz index 23c3b53..116eff1 100755 --- a/tests/virsh-read-bufsiz +++ b/tests/virsh-read-bufsiz @@ -17,17 +17,13 @@ # 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. diff --git a/tests/virsh-read-non-seekable b/tests/virsh-read-non-seekable index 46e2831..0f7504c 100755 --- a/tests/virsh-read-non-seekable +++ b/tests/virsh-read-non-seekable @@ -17,17 +17,13 @@ # 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 diff --git a/tests/virsh-schedinfo b/tests/virsh-schedinfo index 37f7bd3..d6d9ac2 100755 --- a/tests/virsh-schedinfo +++ b/tests/virsh-schedinfo @@ -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 diff --git a/tests/virsh-start b/tests/virsh-start index 5d4c0a7..cb58c3b 100755 --- a/tests/virsh-start +++ b/tests/virsh-start @@ -17,17 +17,13 @@ # 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 diff --git a/tests/virsh-synopsis b/tests/virsh-synopsis index cacdee4..d0d1197 100755 --- a/tests/virsh-synopsis +++ b/tests/virsh-synopsis @@ -17,17 +17,13 @@ # 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 diff --git a/tests/virsh-undefine b/tests/virsh-undefine index f7ba495..6494b4a 100755 --- a/tests/virsh-undefine +++ b/tests/virsh-undefine @@ -17,17 +17,13 @@ # 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 diff --git a/tests/virsh-uriprecedence b/tests/virsh-uriprecedence index f9e3256..1cf3d22 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 9e656c0..306552a 100755 --- a/tests/virsh-vcpupin +++ b/tests/virsh-vcpupin @@ -17,17 +17,13 @@ # 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. -- 2.7.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list